isql return codes
Posted in 1991
Cheryl Gross writes "you're in a world of hurt "
[ ... but this'll fix it ... ]
In respect of checking isql error codes from C function calls, you may
have a small problem. I'd expect a failed system() to return -1, or
1, or something similar. That's not what we see here, and I
believe the same occurs running from the shell. Kinda suggests
isql isn't setting a return code: 0 should indicate success.
By the way, this isn't any kind of criticism, just a caveat.
Captured session starts here.
----------------------------------------------------------------------
theskett> cat tmp.c
#include <stdio.h>
main()
{
char * sel_stmt = "isql - <<!\\ndatabase foo; select foo from bar;\\n!";
printf("return code: %d\\n", system(sel_stmt));
}
theskett> make tmp
cc -O tmp.c -o tmp
theskett> script
Script started on Tue Aug 20 23:44:37 1991
theskett> tmp
329: Database not found or no system permission.
2: No such file or directory
Error in line 1Near character position 13
349: Database not selected yet.
Error in line 1Near character position 34
return code: 0
theskett> ^D
script done on Tue Aug 20 23:44:43 1991
____________________________________________________________________________
Who: Tony Heskett | DHL Systems Ltd, Kings House,
How: theskett@lhr-sys.ssf-sys.dhl.com | Great West Road, Brentford, TW8 9HS
Vox: (+44) 81 747 8330 x 363 | Fax: (+44) 81 747 0875