#include "WorkingDialog.h" int SaGetBlob(int vendor, char *sv, char *db, char *tab, char *col, int coltype, char *where, int chunksize, void **chunk);
SaGetBlob
will retrieve the data for a single column of a given row in a table. It must be called until a 0 is returned, which signifies there is no more data. It must be terminated before all results are retrieved; the function SaGetBlobDone
can be called.
Data returned by SaGetBlob
must be free'd to avoid memory leaks.
If the column type specified is SA_TEXT, the data will be in character form. If the column type specified is SA_BINARY, the data returned will be in binary form.
Data returned by SaGetBlob
is not NULL terminated, regardless of the column type that was specified.
If a call to SaGetBlob
is made before a previous one was completed, the request will fail, and the original call to SaGetBlob
will be aborted. When a failure occurs at any time while calling SaGetBlob, the blob retrieval mechanism is automatically reset. A subsequent call would work because the blob retrieval mechanism has reset.
SaGetBlobDone
before calling SaGetBlob
.#include "WorkingDialog.h" ... void *data; int size; SaGetBlobDone(SGESYBASE); while((size = SaGetBlob(SGESYBASE, "CEZANNE", "pubs2", "au_pix", "pic", SA_BINARY, "where au_id = `192-748-2293'", -1, &data)) > 0) { write(file_descriptor, (char *)data, size); free(data); } if(size < 0) printf("Error reading blob.\n"); else printf("Blob successfully read!\n"); ...