@@ -110,23 +110,59 @@ void* sqlite3_get_table_idr(void* db,
110110 }
111111
112112 tbl -> data_size = array_size;
113+ return tbl;
114+
115+}
116+
117+int exec_db(void*p){
118+
119+ DBinfo* dbi =(DBinfo*) p;
120+ int rc, col, type, row_counter,i;
121+
122+ const char* col_name;
113123
114− int i, j, row, col;
124+ rc = sqlite3_step(dbi->ppStmt);
125+
126+ if(rc != SQLITE_ROW && rc != SQLITE_DONE){
127+ return 21;
128+ }
129+ col = sqlite3_column_count(dbi->ppStmt);
130+
131+ row_counter =0;
132+
133+ while (rc == SQLITE_ROW) {
115134
116− row = tbl->num_row;
117− col = tbl->num_col;
118−
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−//
125−// }
126− return tbl;
135+ rc = sqlite3_step(dbi->ppStmt);
136+ row_counter++;
137+ }
138+
139+ dbi->row_count = row_counter;
140+
141+ dbi->col_count = col;
142+
143+
144+ return type;
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){
@@ -219,6 +286,22 @@ int sqlite3_get_val_int(void* p,const char* tbl_name, int nRow, int nCol){
219286
220287}
221288
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, sizeof(text_val));
300+ return array;
301+
302+}
303+
304+
222305
223306const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow, int nCol){
224307
@@ -291,7 +374,6 @@ float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
291374 }
292375 double_val =sqlite3_column_double(stmt, nCol);
293376 float float_val =(float)double_val;
294− //printf("float_val %f\n", float_val);
295377 rc =sqlite3_finalize(stmt);
296378 if( rc != SQLITE_OK){
297379 printf("Couldn't finalize.\n");
@@ -300,6 +382,17 @@ float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
300382
301383}
302384
385+float sqlite3_get_float_v2(void* p, int nCol){
386+
387+ DBinfo* dbi =(DBinfo*) p;
388+ double double_val;
389+
390+ double_val =sqlite3_column_double(dbi->ppStmt, nCol);
391+ float float_val =(float)double_val;
392+ return float_val;
393+
394+}
395+
303396
304397void sqlite3_free_table_idr(void* db){
305398 Table* tbl =(Table*) db;