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
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
Comment