bool CDBL_BlobResult::Fetch() { if (m_EOR) return false; STATUS s; if (m_CurrItem == 0) { while ((s = Check(dbreadtext(GetCmd(), m_Buff, (DBINT) sizeof(m_Buff)))) > 0) { ; } switch (s) { case 0: break; case NO_MORE_ROWS: m_EOR = true; return false; default: DATABASE_DRIVER_ERROR( "Error in fetching row." + GetDbgInfo(), 280003 ); } } else { m_CurrItem = 0; } s = Check(dbreadtext(GetCmd(), m_Buff, (DBINT) sizeof(m_Buff))); if (s == NO_MORE_ROWS) return false; if (s < 0) { DATABASE_DRIVER_ERROR( "Error in fetching row." + GetDbgInfo(), 280003 ); } m_BytesInBuffer= s; m_ReadedBytes= 0; return true; }
CDB_Object* CDBL_BlobResult::GetItem(CDB_Object* item_buff, I_Result::EGetItem policy) { if (m_CurrItem) return 0; EDB_Type b_type = item_buff ? item_buff->GetType() : eDB_UnsupportedType; if (item_buff && b_type != eDB_Text && b_type != eDB_Image) { DATABASE_DRIVER_ERROR( "Wrong type of CDB_Object." + GetDbgInfo(), 230020 ); } CDB_Stream* val = NULL; if (item_buff) { val = static_cast<CDB_Stream*>(item_buff); if (policy == I_Result::eAssignLOB) { // Explicitly truncate previous value ... val->Truncate(); } } else if (m_ColFmt.data_type == eDB_Text) { val = new CDB_Text; } else { val = new CDB_Image; } _ASSERT(val); // check if we do have something in buffer if(m_ReadedBytes < m_BytesInBuffer) { val->Append(m_Buff + m_ReadedBytes, m_BytesInBuffer - m_ReadedBytes); m_ReadedBytes= m_BytesInBuffer; } if(m_BytesInBuffer == 0) { return item_buff; } STATUS s; while ((s = Check(dbreadtext(GetCmd(), m_Buff, (DBINT) sizeof(m_Buff)))) > 0) { val->Append(m_Buff, (size_t(s) < sizeof(m_Buff))? size_t(s) : sizeof(m_Buff)); } switch (s) { case NO_MORE_ROWS: m_EOR = true; case 0: m_CurrItem = 1; break; default: DATABASE_DRIVER_ERROR( "dbreadtext failed." + GetDbgInfo(), 280003 ); } return item_buff; }
size_t CDBL_BlobResult::ReadItem(void* buffer, size_t buffer_size, bool* is_null) { if(m_BytesInBuffer == 0) m_CurrItem= 1; if (m_CurrItem != 0) { if (is_null) *is_null = true; return 0; } size_t l= 0; // check if we do have something in buffer if(m_ReadedBytes < m_BytesInBuffer) { l= m_BytesInBuffer - m_ReadedBytes; if(l >= buffer_size) { memcpy(buffer, m_Buff + m_ReadedBytes, buffer_size); m_ReadedBytes+= buffer_size; if (is_null) *is_null = false; return buffer_size; } memcpy(buffer, m_Buff + m_ReadedBytes, l); } STATUS s = Check(dbreadtext(GetCmd(), (void*)((char*)buffer + l), (DBINT)(buffer_size-l))); switch (s) { case NO_MORE_ROWS: m_EOR = true; case 0: m_CurrItem = 1; break; case -1: DATABASE_DRIVER_ERROR( "dbreadtext failed." + GetDbgInfo(), 280003 ); default: break; } if (is_null) { *is_null = (m_BytesInBuffer == 0 && s <= 0); } return (size_t) s + l; }
bool CDBL_BlobResult::SkipItem() { if (m_EOR || m_CurrItem) return false; STATUS s; while ((s = Check(dbreadtext(GetCmd(), m_Buff, sizeof(m_Buff)))) > 0) { continue; } switch (s) { case NO_MORE_ROWS: m_EOR = true; case 0: m_CurrItem = 1; break; default: DATABASE_DRIVER_ERROR( "dbreadtext failed." + GetDbgInfo(), 280003 ); } return true; }
void read_lebenslauf(void){ long bytes; /*anzeige aller berufe*/ dbcmd(dbproc,"SELECT Lebenslauf FROM Mitarbeiter"); dbsqlexec(dbproc); while (dbresults(dbproc)!=NO_MORE_RESULTS) { while ((bytes= dbreadtext(dbproc,(void *)buf,BUFSIZE)) != NO_MORE_ROWS) { if ( bytes == 0){ printf("end of row"); } else{ buf[bytes] = '\0'; printf("%s\n",buf); } } } }
static int test(int argc, char **argv, int over4k) { const int rows_to_add = 3; LOGINREC *login; DBPROCESS *dbproc; DBPROCESS *blobproc; int i; DBINT testint; FILE *fp; long result, isiz; char *blob, *rblob; unsigned char *textPtr, *timeStamp; char objname[256]; char sqlCmd[256]; char rbuf[BLOB_BLOCK_SIZE]; long numread; int numtowrite, numwritten; set_malloc_options(); read_login_info(argc, argv); fprintf(stdout, "Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); fprintf(stdout, "About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0014"); fprintf(stdout, "About to open %s..%s for user '%s'\n", SERVER, DATABASE, USER); dbproc = dbopen(login, SERVER); blobproc = dbopen(login, SERVER); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); dbuse(blobproc, DATABASE); } dbloginfree(login); fprintf(stdout, "After logon\n"); fprintf(stdout, "About to read binary input file\n"); if (argc == 1) { argv = testargs; argc = 3; } if (argc < 3) { fprintf(stderr, "Usage: %s infile outfile\n", argv[0]); return 1; } if ((fp = fopen(argv[1], "rb")) == NULL) { fprintf(stderr, "Cannot open input file: %s\n", argv[1]); return 2; } result = fseek(fp, 0, SEEK_END); isiz = ftell(fp); result = fseek(fp, 0, SEEK_SET); blob = (char *) malloc(isiz); result = fread((void *) blob, isiz, 1, fp); assert(result == 1); fclose(fp); /* FIXME this test seem to not work using temporary tables (sybase?)... */ fprintf(stdout, "Dropping table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } fprintf(stdout, "creating table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } fprintf(stdout, "insert\n"); for (i = 0; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } } for (i = 0; i < rows_to_add; i++) { sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Error inserting blob\n"); return 4; } while ((result = dbnextrow(dbproc)) != NO_MORE_ROWS) { result = REG_ROW; result = DBTXPLEN; strcpy(objname, "dblib0014.PigTure"); textPtr = dbtxptr(dbproc, 1); timeStamp = dbtxtimestamp(dbproc, 1); if (!textPtr && !timeStamp && dbtds(dbproc) >= DBTDS_7_2) { printf("Protocol 7.2+ detected, test not supported\n"); free(blob); dbexit(); exit(0); } /* * Use #ifdef if you want to test dbmoretext mode (needed for 16-bit apps) * Use #ifndef for big buffer version (32-bit) */ if (over4k) { if (dbwritetext(blobproc, objname, textPtr, DBTXPLEN, timeStamp, TRUE, isiz, (BYTE*) blob) != SUCCEED) return 5; } else { if (dbwritetext(blobproc, objname, textPtr, DBTXPLEN, timeStamp, TRUE, isiz, NULL) != SUCCEED) return 15; dbsqlok(blobproc); dbresults(blobproc); numtowrite = 0; /* Send the update value in chunks. */ for (numwritten = 0; numwritten < isiz; numwritten += numtowrite) { numtowrite = (isiz - numwritten); if (numtowrite > BLOB_BLOCK_SIZE) numtowrite = BLOB_BLOCK_SIZE; dbmoretext(blobproc, (DBINT) numtowrite, (BYTE *) (blob + numwritten)); } dbsqlok(blobproc); while (dbresults(blobproc) != NO_MORE_RESULTS); } } } fprintf(stdout, "select\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stdout, "Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) { printf("col %d is %s\n", i, dbcolname(dbproc, i)); } if (SUCCEED != dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & testint)) { fprintf(stderr, "Had problem with bind\n"); abort(); } for (i = 0; i < rows_to_add; i++) { char expected[1024]; sprintf(expected, "row %03d", i); if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != i) { fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } /* get the image */ strcpy(sqlCmd, "SET TEXTSIZE 2147483647"); dbcmd(blobproc, sqlCmd); dbsqlexec(blobproc); if (dbresults(blobproc) != SUCCEED) { dbcancel(blobproc); return 16; } sprintf(sqlCmd, "SELECT PigTure FROM dblib0014 WHERE i = %d", i); dbcmd(blobproc, sqlCmd); dbsqlexec(blobproc); if (dbresults(blobproc) != SUCCEED) { fprintf(stderr, "Error extracting blob\n"); return 6; } numread = 0; rblob = NULL; while ((result = dbreadtext(blobproc, rbuf, BLOB_BLOCK_SIZE)) != NO_MORE_ROWS) { if (result != 0) { /* this indicates not end of row */ rblob = (char*) realloc(rblob, result + numread); memcpy((void *) (rblob + numread), (void *) rbuf, result); numread += result; } } if (i == 0) { printf("Saving first blob data row to file: %s\n", argv[2]); if ((fp = fopen(argv[2], "wb")) == NULL) { fprintf(stderr, "Unable to open output file: %s\n", argv[2]); return 3; } result = fwrite((void *) rblob, numread, 1, fp); fclose(fp); } printf("Read blob data row %d --> %s %ld byte comparison\n", (int) testint, (memcmp(blob, rblob, numread)) ? "failed" : "PASSED", numread); free(rblob); } if (dbnextrow(dbproc) != NO_MORE_ROWS) { fprintf(stderr, "Was expecting no more rows\n"); exit(1); } free(blob); fprintf(stdout, "Dropping table\n"); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } dbexit(); return 0; }
int main(int argc, const char *argv[]) { LOGINREC *login; DBPROCESS *dbproc; int i; DBINT testint; FILE *fp; long result, isiz; char *blob, *rblob; unsigned char *textPtr = NULL, *timeStamp = NULL; char objname[256]; char sqlCmd[256]; char rbuf[BLOB_BLOCK_SIZE]; long numread; BOOL readFirstImage; char cmd[1024]; set_malloc_options(); read_login_info(); fprintf(stdout, "Start\n"); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); fprintf(stdout, "About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0013"); fprintf(stdout, "About to open, PASSWORD: %s, USER: %s, SERVER: %s\n", "", "", ""); /* PASSWORD, USER, SERVER); */ dbproc = dbopen(login, SERVER); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); } fprintf(stdout, "After logon\n"); fprintf(stdout, "About to read binary input file\n"); if (argc == 1) { argv = testargs; argc = 3; } if (argc < 3) { fprintf(stderr, "Usage: %s infile outfile\n", argv[0]); return 1; } if ((fp = fopen(argv[1], "rb")) == NULL) { fprintf(stderr, "Cannot open input file: %s\n", argv[1]); return 2; } result = fseek(fp, 0, SEEK_END); isiz = ftell(fp); result = fseek(fp, 0, SEEK_SET); blob = (char *) malloc(isiz); fread((void *) blob, isiz, 1, fp); fclose(fp); fprintf(stdout, "Dropping table\n"); dbcmd(dbproc, "drop table #dblib0013"); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } fprintf(stdout, "creating table\n"); dbcmd(dbproc, "create table #dblib0013 (i int not null, PigTure image not null)"); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } fprintf(stdout, "insert\n"); sprintf(cmd, "insert into #dblib0013 values (1, '')"); fprintf(stdout, "%s\n", cmd); dbcmd(dbproc, cmd); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sprintf(sqlCmd, "SELECT PigTure FROM #dblib0013 WHERE i = 1"); dbcmd(dbproc, sqlCmd); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Error inserting blob\n"); return 4; } while ((result = dbnextrow(dbproc)) != NO_MORE_ROWS) { result = REG_ROW; result = DBTXPLEN; strcpy(objname, "#dblib0013.PigTure"); textPtr = dbtxptr(dbproc, 1); timeStamp = dbtxtimestamp(dbproc, 1); } /* Use #ifdef if you want to test dbmoretext mode (needed for 16-bit apps) * Use #ifndef for big buffer version (32-bit) */ #ifndef DBWRITE_OK_FOR_OVER_4K if (dbwritetext(dbproc, objname, textPtr, DBTXPLEN, timeStamp, FALSE, isiz, (BYTE*) blob) != SUCCEED) return 5; #else if (dbwritetext(dbproc, objname, textPtr, DBTXPLEN, timeStamp, FALSE, isiz, NULL) != SUCCEED) return 15; dbsqlok(dbproc); dbresults(dbproc); numtowrite = 0; /* Send the update value in chunks. */ for (numwritten = 0; numwritten < isiz; numwritten += numtowrite) { numtowrite = (isiz - numwritten); if (numtowrite > BLOB_BLOCK_SIZE) numtowrite = BLOB_BLOCK_SIZE; dbmoretext(dbproc, (DBINT) numtowrite, blob + numwritten); } dbsqlok(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS); #endif fprintf(stdout, "select\n"); dbcmd(dbproc, "select * from #dblib0013 order by i"); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { failed = 1; fprintf(stdout, "Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) { printf("col %d is %s\n", i, dbcolname(dbproc, i)); } if (SUCCEED != dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & testint)) { failed = 1; fprintf(stderr, "Had problem with bind\n"); abort(); } if (REG_ROW != dbnextrow(dbproc)) { failed = 1; fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != 1) { failed = 1; fprintf(stderr, "Failed. Expected i to be %d, was %d\n", i, (int) testint); abort(); } dbnextrow(dbproc); /* get the image */ strcpy(sqlCmd, "SET TEXTSIZE 2147483647"); dbcmd(dbproc, sqlCmd); dbsqlexec(dbproc); dbresults(dbproc); fprintf(stdout, "select 2\n"); sprintf(sqlCmd, "SELECT PigTure FROM #dblib0013 WHERE i = 1"); dbcmd(dbproc, sqlCmd); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Error extracting blob\n"); return 6; } numread = 0; rblob = NULL; readFirstImage = FALSE; while ((result = dbreadtext(dbproc, rbuf, BLOB_BLOCK_SIZE)) != NO_MORE_ROWS) { if (result == 0) { /* this indicates end of row */ readFirstImage = TRUE; } else { rblob = (char*) realloc(rblob, result + numread); memcpy((void *) (rblob + numread), (void *) rbuf, result); numread += result; } } printf("Saving first blob data row to file: %s\n", argv[2]); if ((fp = fopen(argv[2], "wb")) == NULL) { fprintf(stderr, "Unable to open output file: %s\n", argv[2]); return 3; } result = fwrite((void *) rblob, numread, 1, fp); fclose(fp); printf("Read blob data row %d --> %s %ld byte comparison\n", (int) testint, (memcmp(blob, rblob, numread)) ? "failed" : "PASSED", numread); free(rblob); if (dbnextrow(dbproc) != NO_MORE_ROWS) { failed = 1; fprintf(stderr, "Was expecting no more rows\n"); exit(1); } dbexit(); fprintf(stdout, "dblib %s on %s\n", (failed ? "failed!" : "okay"), __FILE__); return failed ? 1 : 0; }
static int test(int argc, char **argv, int over4k) { LOGINREC *login; int i; DBINT testint; FILE *fp; long result, isiz; char *blob, *rblob; DBBINARY *textPtr = NULL, *timeStamp = NULL; char objname[256]; char rbuf[BLOB_BLOCK_SIZE]; long numread; int data_ok; int numtowrite, numwritten; set_malloc_options(); read_login_info(argc, argv); fprintf(stdout, "Starting %s\n", argv[0]); dbinit(); dberrhandle(syb_err_handler); dbmsghandle(syb_msg_handler); fprintf(stdout, "About to logon\n"); login = dblogin(); DBSETLPWD(login, PASSWORD); DBSETLUSER(login, USER); DBSETLAPP(login, "t0013"); fprintf(stdout, "About to open, PASSWORD: %s, USER: %s, SERVER: %s\n", "", "", ""); /* PASSWORD, USER, SERVER); */ dbproc = dbopen(login, SERVER); dbprocw = dbopen(login, SERVER); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); dbuse(dbprocw, DATABASE); } dbloginfree(login); fprintf(stdout, "logged in\n"); if (argc == 1) { argv = testargs; argc = 3; } if (argc < 3) { fprintf(stderr, "Usage: %s infile outfile\n", argv[0]); return 1; } if ((fp = fopen(argv[1], "rb")) == NULL) { fprintf(stderr, "Cannot open input file: %s\n", argv[1]); return 2; } fprintf(stdout, "Reading binary input file\n"); fseek(fp, 0, SEEK_END); isiz = ftell(fp); fseek(fp, 0, SEEK_SET); blob = malloc(isiz); assert(blob); result = fread((void *) blob, isiz, 1, fp); assert(result == 1); fclose(fp); drop_table(); sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); while (dbresults(dbproc) != NO_MORE_RESULTS) { /* nop */ } sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Error inserting blob\n"); return 4; } for (i=0; (result = dbnextrow(dbproc)) != NO_MORE_ROWS; i++) { assert(REG_ROW == result); printf("fetching row %d\n", i+1); strcpy(objname, TABLE_NAME ".PigTure"); textPtr = dbtxptr(dbproc, 1); timeStamp = dbtxtimestamp(dbproc, 1); break; /* can't proceed until no more rows */ } assert(REG_ROW == result || 0 < i); if (!textPtr && !timeStamp && dbtds(dbproc) >= DBTDS_7_2) { printf("Protocol 7.2+ detected, test not supported\n"); free(blob); dbclose(dbproc); dbproc = NULL; dbexit(); exit(0); } if (!textPtr) { fprintf(stderr, "Error getting textPtr\n"); exit(1); } /* * Use #ifdef if you want to test dbmoretext mode (needed for 16-bit apps) * Use #ifndef for big buffer version (32-bit) */ fprintf(stdout, "writing text ... "); if (over4k) { if (dbwritetext(dbprocw, objname, textPtr, DBTXPLEN, timeStamp, FALSE, isiz, (BYTE*) blob) != SUCCEED) return 5; fprintf(stdout, "done (in one shot)\n"); for (; (result = dbnextrow(dbproc)) != NO_MORE_ROWS; i++) { assert(REG_ROW == result); printf("fetching row %d?\n", i+1); } } else { if (dbwritetext(dbprocw, objname, textPtr, DBTXPLEN, timeStamp, FALSE, isiz, NULL) != SUCCEED) return 15; fprintf(stdout, "done\n"); fprintf(stdout, "dbsqlok\n"); dbsqlok(dbprocw); fprintf(stdout, "dbresults\n"); dbresults(dbprocw); numtowrite = 0; /* Send the update value in chunks. */ for (numwritten = 0; numwritten < isiz; numwritten += numtowrite) { fprintf(stdout, "dbmoretext %d\n", 1 + numwritten); numtowrite = (isiz - numwritten); if (numtowrite > BLOB_BLOCK_SIZE) numtowrite = BLOB_BLOCK_SIZE; dbmoretext(dbprocw, (DBINT) numtowrite, (BYTE *) (blob + numwritten)); } dbsqlok(dbprocw); while (dbresults(dbprocw) != NO_MORE_RESULTS){ printf("suprise!\n"); } } #if 0 if (SUCCEED != dbclose(dbproc)){ fprintf(stdout, "dbclose failed"); exit(1); } dbproc = dbopen(login, SERVER); assert(dbproc); if (strlen(DATABASE)) { dbuse(dbproc, DATABASE); } #endif sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { failed = 1; fprintf(stdout, "Was expecting a result set."); exit(1); } for (i = 1; i <= dbnumcols(dbproc); i++) { printf("col %d, \"%s\", is type %s\n", i, dbcolname(dbproc, i), dbprtype(dbcoltype(dbproc, i))); } if (2 != dbnumcols(dbproc)) { fprintf(stderr, "Failed. Expected 2 columns\n"); exit(1); } if (SUCCEED != dbbind(dbproc, 1, INTBIND, -1, (BYTE *) & testint)) { fprintf(stderr, "Had problem with bind\n"); exit(1); } if (REG_ROW != dbnextrow(dbproc)) { fprintf(stderr, "Failed. Expected a row\n"); exit(1); } if (testint != 1) { failed = 1; fprintf(stderr, "Failed. Expected i to be %d, was %d\n", 1, (int) testint); exit(1); } dbnextrow(dbproc); /* get the image */ sql_cmd(dbproc); dbsqlexec(dbproc); dbresults(dbproc); fprintf(stdout, "select 2\n"); sql_cmd(dbproc); dbsqlexec(dbproc); if (dbresults(dbproc) != SUCCEED) { fprintf(stderr, "Error extracting blob\n"); return 6; } numread = 0; rblob = NULL; while ((result = dbreadtext(dbproc, rbuf, BLOB_BLOCK_SIZE)) != NO_MORE_ROWS) { if (result != 0) { /* this indicates not end of row */ rblob = (char*) realloc(rblob, result + numread); memcpy((void *) (rblob + numread), (void *) rbuf, result); numread += result; } } data_ok = 1; if (memcmp(blob, rblob, numread) != 0) { printf("Saving first blob data row to file: %s\n", argv[2]); if ((fp = fopen(argv[2], "wb")) == NULL) { fprintf(stderr, "Unable to open output file: %s\n", argv[2]); return 3; } fwrite((void *) rblob, numread, 1, fp); fclose(fp); failed = 1; data_ok = 0; } printf("Read blob data row %d --> %s %ld byte comparison\n", (int) testint, data_ok ? "PASSED" : "failed", numread); free(rblob); if (dbnextrow(dbproc) != NO_MORE_ROWS) { failed = 1; fprintf(stderr, "Was expecting no more rows\n"); exit(1); } free(blob); drop_table(); dbclose(dbproc); dbproc = NULL; dbexit(); return 0; }