Pro C Issue on AIX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • msamir
    New Member
    • Feb 2008
    • 1

    Pro C Issue on AIX

    Hello,

    I have the following piece of code in pro c to authenticate to a custom application I am creating
    [code=c]
    EXEC SQL BEGIN DECLARE SECTION;
    char sLOGIN[50];
    char sPWD[50];
    char sROW_ID1[15];
    char sROW_ID2[15];
    EXEC SQL END DECLARE SECTION;

    strcpy(sLOGIN,l ogin);
    strcpy(sPWD,pas swd);

    EXEC SQL SELECT LOGIN
    INTO :sROW_ID1
    FROM USERS
    WHERE LOGIN = :sLOGIN
    AND PWD = sPWD;

    EXEC SQL SELECT LOGIN
    INTO :sROW_ID2
    FROM USERS
    WHERE LOGIN = :sLOGIN;

    fprintf(file,"R ES : -%s-,-%s-|-%s-,-%s-\n",sROW_ID1,sR OW_ID2,trim_rig ht(sROW_ID1),tr im_right(sROW_I D2));
    [/code]
    if I enter a correct username/password the program executes as expected with output like:

    ###########INPU T : -demouser-,-1234-
    RES : -demouser-,-demouser-|-demouser-,-demouser-

    however when I enter an incorrect username/password the output is like
    ###########INPU T : -toto-,-lebo-
    RES : -13f-,-13eαé "K╤┌z^L-|-13f-,-13eαé "K╤┌z^L-

    that is my sROW_ID1 and sROW_ID2 get trash values somehow, I am sure that when I execute this query on the database it returns null. Is there any specific handling that maybe i should do if the query does not return any rows?

    appreciate your assistance
    Last edited by sicarie; Feb 25 '08, 02:38 PM. Reason: Code tags
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    What does ProC say about checking for a NULL cursor on the SELECT return. That is, no rows or invalid SQL statement ??

    Comment

    Working...