on master help sign in
added memory location for text, though needs some memory management to free it
35259d2melissam
contribs/lib/SQLite3/sqlite3api.c+7−4
@@ -13,7 +13,7 @@
13
13
14
14
15static char sql_query_buffer[2000];
15static char sql_query_buffer[2000];
16−
16+unsigned char* array;
17
17
18void* sqlite3_open_idr(const char *filename){
18void* sqlite3_open_idr(const char *filename){
19
19
@@ -242,19 +242,22 @@ const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow,
242 rc = sqlite3_step(stmt);
242 rc = sqlite3_step(stmt);
243
243
244 while (rc == SQLITE_ROW && counter < nRow){
244 while (rc == SQLITE_ROW && counter < nRow){
245−
245+
246−
247 rc = sqlite3_step(stmt);
246 rc = sqlite3_step(stmt);
248 counter++;
247 counter++;
249
248
250 }
249 }
250+
251+ array =(unsigned char *) malloc(1000*sizeof(char));
251 text_val =sqlite3_column_text(stmt, nCol);
252 text_val =sqlite3_column_text(stmt, nCol);
253+ memcpy(array, text_val, sizeof(text_val));
252 printf("text_val : %s\n", text_val );
254 printf("text_val : %s\n", text_val );
253 rc =sqlite3_finalize(stmt);
255 rc =sqlite3_finalize(stmt);
254 if( rc != SQLITE_OK){
256 if( rc != SQLITE_OK){
255 printf("Couldn't finalize.\n");
257 printf("Couldn't finalize.\n");
256 }
258 }
259+
257− return text_val;
260+ return array;
258
261
259}
262}
260
263