Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> what's wrong ,can you tell me ?

what's wrong ,can you tell me ?

From: liujd <liujd_at_cti.ac.cn>
Date: Wed, 26 Mar 2003 04:58:39 -0800
Message-ID: <F001.00573091.20030326045839@fatcity.com>


i write two function .
one is login function as login(char * password,int contextId).

    This function initialize the context environment .and login database.
two is getGroupInfo(char * groupName,int contextId);

        this function is as his name to get one group information.And refer to
ctx[contextId] in the
login function initial the sql_context variable is declared in the *.h as
following
EXEC SQL BEGIN DECLARE SECTION;

	 sql_context ctx[20];
EXEC SQL  END	DECLARE SECTION;

Now I find a weird thing.
When I connect the database and then disconnect . that is ok; After disconnection, The function getGroupInfo() can handle the error well in the first time .then run function getGroupInfo() once again. It can't handle the error, and hange.
The core sentences is following :

	EXEC SQL WHENEVER SQLERROR DO handleError("error");
 	EXEC SQL CONTEXT USE :ctx[contextId];
 	EXEC SQL WHENEVER NOT FOUND DO handleError("not select row!");
 	EXEC SQL SELECT logId,accessId,description
INTO :newLoginId,:newAccessId,:newDescription
 		FROM groupInfo WHERE groupid=:newGroupId;

The function disconnect() code :
Disconnect(int contextId=0)
{

	//declare extern sql_context ctx[20];
	EXEC SQL WHENEVER SQLERROR DO handleError("error when
disconnect");
 	EXEC SQL CONTEXT USE :ctx[contextId];
	EXEC SQL COMMIT WORK RELEASE;
	EXEC SQL CONTEXT FREE :ctx[contextId];

}

Can you tell me why ?
Thanks!

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: liujd
  INET: liujd_at_cti.ac.cn

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed Mar 26 2003 - 06:58:39 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US