NULL Terminator in VARCHAR!
Date: 2 May 1993 14:37:02 GMT
Message-ID: <1s0mae$dlg_at_menudo.uh.edu>
HI,
I am having a problem here which I just can't get around! I have 2 host variables, img_pathname (an output host variable) and image_file (an input host variable). Both of them have been declared as
EXEC SQL BEGIN DECLARE SECTION
VARCHAR img_pathname[36]; char image_file[20]; EXEC SQL VAR image_file IS STRING(20);
EXEC SQL END DECLARE SECTION; The intention of the code piece is to retrieve the image pathname from the database, given the image filename as an input host variable.
I wrote:
EXEC SQL SELECT PATHNAME INTO :img_pathname FROM IMAGE_STORE WHERE IMAGE = :image_file;
img_pathname.arr[img_pathname.len] = '\0';
When I next read the values of image_file and img_pathname, image_file is correct, but there nothing is read into img_pathname from the database, and the query fails, because of absence of a null terminator. Isn't the last line, null terminating the string img_pathname??
Note that the size of img_pathname and image_file are the maximum sizes.
Any help on this would be greatly appreciated. Please forward your suggestions to namita_at_cs.uh.edu.
Thanks!
Namita Received on Sun May 02 1993 - 16:37:02 CEST