BLOB objects selection
Posted in 1999
Hello all, I have a some problem... I have a database, containing a table with a next columns set: RFCID INTEGER UNIQUE, RFC_NUM INTEGER, RFC_NAME CHAR(50), RFC_DATA BYTE; I can success add a data to the table, but I have troubles with a getting it. Last column, RFC_DATA, contain a text data from the some file. For inserting, as always, I use a code: EXEC SQL INCLUDE locator; EXEC SQL BEGIN DECLARE SECTION; .... -- some variables loc_t rfc_data; char my_rfc_file[256]; EXEC SQL END DECLARE SECTION; /* some portions of code .... */ add_func() { rfc_data.loc_loctype = LOCFNAME; rfc_data.loc_fname = my_rfc_file; EXEC SQL INSERT INTO tabname VALUES (...., ...., :rfc_data); .... } /* and etc ...*/ It's works fine.In the next program I try to get a document by it's RFCID: EXEC SQL BEGIN DECLARE SECTION; loc_t rfc_data; ... -- some other variables; EXEC SQL END DECLARE SECTION; /* ... */ /* fname contain a file name for saving a document, id contain a index number for selection */ get_document(char *fname, int id) { rfc_data.loc_lctype = LOCFNAME; rfc_data.loc_fname = fname; EXEC SQL SELECT RFC_DATA INTO :rfc_data WHERE RFCID = :id; ..... } In result, I have a _empty_ file, named <fname> in the current directory. I had try to use a LOCFILE as loc_lctype with file descriptor,but with same result. I'm always get a empty file (but when a work with a binary files, JPEG or GIF, for example, all working correctly). Where is my mistake? I'm very sorry for this big message, but I want to show more information for understanding... Thank you very much, Ruslan Satlykov.