@@ -110,23 +110,59 @@ void* sqlite3_get_table_idr(void* db,
110110 }
111111
112112 tbl -> data_size = array_size;
113+ return tbl;
113114
114− int i, j, row, col;
115−
116− row = tbl->num_row;
117− col = tbl->num_col;
115+}
116+
117+int exec_db(void*p){
118118
119− for( i=0; i< row; i++){
120− for(j=0;j<col; j++){
121− printf("%s\n", tbl->table_data[(i+1)*col +j]);
122−
123− }
124−
119+ DBinfo* dbi =(DBinfo*) p;
120+ int rc, col, row_counter;
121+
122+ const char* col_name;
123+
124+ rc = sqlite3_step(dbi->ppStmt);
125+
126+ if( rc == SQLITE_DONE){
127+ return rc;
128+ }
129+ if(rc == SQLITE_ERROR && rc == SQLITE_MISUSE){
130+ return 1;
131+ }
132+
133+ row_counter =0;
134+
135+ while (rc == SQLITE_ROW) {
136+
137+ rc = sqlite3_step(dbi->ppStmt);
138+ row_counter++;
125139 }
126− return tbl;
140+
141+ col = sqlite3_column_count(dbi->ppStmt);
142+ dbi->row_count = row_counter;
143+ dbi->col_count = col;
144+ return rc;
127145
128146}
129147
148+int sqlite3_get_num_row_v2(void* p){
149+
150+ DBinfo* dbi =(DBinfo*) p;
151+ int row_number =dbi->row_count;
152+ return row_number;
153+
154+
155+}
156+
157+int sqlite3_get_num_col_v2(void* p){
158+
159+ DBinfo* dbi =(DBinfo*) p;
160+ int col_number =dbi-> col_count;
161+ return col_number;
162+
163+}
164+
165+
130166int sqlite3_get_num_row(void* p){
131167
132168 Table* tbl =(Table*) p;
@@ -142,6 +178,38 @@ int sqlite3_get_num_col(void* p){
142178 int col_number =tbl-> num_col;
143179 return col_number;
144180
181+}
182+int sqlite3_get_data_type_v2(void* p, int nRow, int nCol){
183+
184+ DBinfo* dbi =(DBinfo*) p;
185+ int rc, type, row_counter;
186+ const char* char_int;
187+
188+ rc = sqlite3_reset(dbi->ppStmt);
189+ rc = sqlite3_step(dbi->ppStmt);
190+ row_counter =0;
191+
192+ while (rc == SQLITE_ROW && row_counter < nRow) {
193+
194+ rc = sqlite3_step(dbi->ppStmt);
195+ row_counter++;
196+ }
197+ type =sqlite3_column_type(dbi->ppStmt, nCol);
198+ return type;
199+
200+}
201+
202+
203+int sqlite3_get_val_int_v2(void* p, int nCol){
204+
205+
206+ DBinfo* dbi =(DBinfo*) p;
207+ int val, col;
208+
209+ val =sqlite3_column_int(dbi->ppStmt, nCol);
210+ return val;
211+
212+
145213}
146214
147215int sqlite3_get_data_type(void* p,const char* tbl_name, int nRow, int nCol){
@@ -171,7 +239,6 @@ int sqlite3_get_data_type(void* p,const char* tbl_name, int nRow, int nCol){
171239 }
172240
173241 val =sqlite3_column_type(stmt, nCol);
174− printf("Type : %d\n", val );
175242
176243 rc =sqlite3_finalize(stmt);
177244 if( rc != SQLITE_OK){
@@ -210,7 +277,6 @@ int sqlite3_get_val_int(void* p,const char* tbl_name, int nRow, int nCol){
210277 }
211278
212279 val =sqlite3_column_int(stmt, nCol);
213− printf("int_val : %d\n", val );
214280 rc =sqlite3_finalize(stmt);
215281 if( rc != SQLITE_OK){
216282 printf("Couldnt finalize:\n");
@@ -220,6 +286,24 @@ int sqlite3_get_val_int(void* p,const char* tbl_name, int nRow, int nCol){
220286
221287}
222288
289+const unsigned char* sqlite3_get_val_text_v2(void* p,int nCol){
290+
291+
292+ DBinfo* dbi =(DBinfo*) p;
293+ int rc,i, val, counter;
294+ const unsigned char* text_val;
295+
296+ array =(unsigned char *) GC_malloc(1000*sizeof(char));
297+
298+ text_val =sqlite3_column_text(dbi->ppStmt, nCol);
299+ memcpy(array, text_val, strlen(text_val));
300+ int size = strlen(text_val);
301+
302+ return array;
303+
304+}
305+
306+
223307
224308const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow, int nCol){
225309
@@ -248,10 +332,11 @@ const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow,
248332
249333 }
250334
251− array =(unsigned char *) malloc(1000*sizeof(char));
335+
336+ array =(unsigned char *) GC_malloc(1000*sizeof(char));
337+
252338 text_val =sqlite3_column_text(stmt, nCol);
253339 memcpy(array, text_val, sizeof(text_val));
254− printf("text_val : %s\n", text_val );
255340 rc =sqlite3_finalize(stmt);
256341 if( rc != SQLITE_OK){
257342 printf("Couldn't finalize.\n");
@@ -261,6 +346,7 @@ const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow,
261346
262347}
263348
349+
264350float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
265351
266352 DBinfo* dbi =(DBinfo*) p;
@@ -290,7 +376,6 @@ float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
290376 }
291377 double_val =sqlite3_column_double(stmt, nCol);
292378 float float_val =(float)double_val;
293− printf("float_val %f\n", float_val);
294379 rc =sqlite3_finalize(stmt);
295380 if( rc != SQLITE_OK){
296381 printf("Couldn't finalize.\n");
@@ -299,6 +384,17 @@ float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
299384
300385}
301386
387+float sqlite3_get_float_v2(void* p, int nCol){
388+
389+ DBinfo* dbi =(DBinfo*) p;
390+ double double_val;
391+
392+ double_val =sqlite3_column_double(dbi->ppStmt, nCol);
393+ float float_val =(float)double_val;
394+ return float_val;
395+
396+}
397+
302398
303399void sqlite3_free_table_idr(void* db){
304400 Table* tbl =(Table*) db;