Displaying 1 result from an estimated 1 matches for "sqlgetdata".
2008 May 16
2
Fetching Binary data from SQL Server
..., and not able to fetch the rest of the file, below is the code that i am using to do so,
fd = open(fullpath, O_RDWR | O_CREAT | O_TRUNC, 0770);
if (fd < 0) {
ast_log(LOG_WARNING, "Failed to write '%s': %s\n", fullpath, strerror(errno));
res = -1;
goto free_res;
}
res = SQLGetData(stmt, 1, SQL_BINARY, empty, 0, &colsize);
fdlen = colsize;
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "COLSIZE = %d", colsize); //PRINTING COLSIZE ON CLI
if (fd > -1) {
char tmp[1]="";
lseek(fd, fdlen - 1, SEEK_SET);
if (write(fd, tmp, 1) != 1) {
clos...