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: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to