on master help sign in
added memory location for text, though needs some memory management to free it
commit35259d208c599d8d8327f0bfe79b43400273a565 authormelissam <mfm6@st-andrews.ac.uk> dateTue 17 Jul 2012, 17:40 (14 years ago) parent6349317
1 file changed+7−4
contribs/lib/SQLite3/sqlite3api.c+7−4
contribs/lib/SQLite3/sqlite3api.c+7−4
@@ -13,7 +13,7 @@
1313
1414
1515static char sql_query_buffer[2000];
16−
16+unsigned char* array;
1717
1818void* sqlite3_open_idr(const char *filename){
1919
@@ -242,19 +242,22 @@ const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow,
242242 rc = sqlite3_step(stmt);
243243
244244 while (rc == SQLITE_ROW && counter < nRow){
245−
246−
245+
247246 rc = sqlite3_step(stmt);
248247 counter++;
249248
250249 }
250+
251+ array =(unsigned char *) malloc(1000*sizeof(char));
251252 text_val =sqlite3_column_text(stmt, nCol);
253+ memcpy(array, text_val, sizeof(text_val));
252254 printf("text_val : %s\n", text_val );
253255 rc =sqlite3_finalize(stmt);
254256 if( rc != SQLITE_OK){
255257 printf("Couldn't finalize.\n");
256258 }
257− return text_val;
259+
260+ return array;
258261
259262}
260263