@@ -110,23 +110,59 @@ void* sqlite3_get_table_idr(void* db,
112 tbl -> data_size = array_size;
112 tbl -> data_size = array_size;
114− int i, j, row, col;
115+}
116− row = tbl->num_row;
117+int exec_db(void*p){
119− for( i=0; i< row; i++){
119+ DBinfo* dbi =(DBinfo*) p;
120− for(j=0;j<col; j++){
120+ int rc, col, row_counter;
121− printf("%s\n", tbl->table_data[(i+1)*col +j]);
121+
122−
122+ const char* col_name;
124−
124+ rc = sqlite3_step(dbi->ppStmt);
126+ if( rc == SQLITE_DONE){
129+ if(rc == SQLITE_ERROR && rc == SQLITE_MISUSE){
135+ while (rc == SQLITE_ROW) {
137+ rc = sqlite3_step(dbi->ppStmt);
141+ col = sqlite3_column_count(dbi->ppStmt);
142+ dbi->row_count = row_counter;
143+ dbi->col_count = col;
126− return tbl;
144+ return rc;
148+int sqlite3_get_num_row_v2(void* p){
150+ DBinfo* dbi =(DBinfo*) p;
151+ int row_number =dbi->row_count;
157+int sqlite3_get_num_col_v2(void* p){
159+ DBinfo* dbi =(DBinfo*) p;
160+ int col_number =dbi-> col_count;
130int sqlite3_get_num_row(void* p){
166int sqlite3_get_num_row(void* p){
132 Table* tbl =(Table*) p;
168 Table* tbl =(Table*) p;
@@ -142,6 +178,38 @@ int sqlite3_get_num_col(void* p){
142 int col_number =tbl-> num_col;
178 int col_number =tbl-> num_col;
143 return col_number;
179 return col_number;
182+int sqlite3_get_data_type_v2(void* p, int nRow, int nCol){
184+ DBinfo* dbi =(DBinfo*) p;
185+ int rc, type, row_counter;
186+ const char* char_int;
188+ rc = sqlite3_reset(dbi->ppStmt);
189+ rc = sqlite3_step(dbi->ppStmt);
192+ while (rc == SQLITE_ROW && row_counter < nRow) {
194+ rc = sqlite3_step(dbi->ppStmt);
197+ type =sqlite3_column_type(dbi->ppStmt, nCol);
203+int sqlite3_get_val_int_v2(void* p, int nCol){
206+ DBinfo* dbi =(DBinfo*) p;
209+ val =sqlite3_column_int(dbi->ppStmt, nCol);
147int sqlite3_get_data_type(void* p,const char* tbl_name, int nRow, int nCol){
215int 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){
173 val =sqlite3_column_type(stmt, nCol);
241 val =sqlite3_column_type(stmt, nCol);
174− printf("Type : %d\n", val );
176 rc =sqlite3_finalize(stmt);
243 rc =sqlite3_finalize(stmt);
177 if( rc != SQLITE_OK){
244 if( rc != SQLITE_OK){
@@ -210,7 +277,6 @@ int sqlite3_get_val_int(void* p,const char* tbl_name, int nRow, int nCol){
212 val =sqlite3_column_int(stmt, nCol);
279 val =sqlite3_column_int(stmt, nCol);
213− printf("int_val : %d\n", val );
214 rc =sqlite3_finalize(stmt);
280 rc =sqlite3_finalize(stmt);
215 if( rc != SQLITE_OK){
281 if( rc != SQLITE_OK){
216 printf("Couldnt finalize:\n");
282 printf("Couldnt finalize:\n");
@@ -220,6 +286,24 @@ int sqlite3_get_val_int(void* p,const char* tbl_name, int nRow, int nCol){
289+const unsigned char* sqlite3_get_val_text_v2(void* p,int nCol){
292+ DBinfo* dbi =(DBinfo*) p;
293+ int rc,i, val, counter;
294+ const unsigned char* text_val;
296+ array =(unsigned char *) GC_malloc(1000*sizeof(char));
298+ text_val =sqlite3_column_text(dbi->ppStmt, nCol);
299+ memcpy(array, text_val, strlen(text_val));
300+ int size = strlen(text_val);
224const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow, int nCol){
308const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow, int nCol){
@@ -248,10 +332,11 @@ const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow,
251− array =(unsigned char *) malloc(1000*sizeof(char));
336+ array =(unsigned char *) GC_malloc(1000*sizeof(char));
252 text_val =sqlite3_column_text(stmt, nCol);
338 text_val =sqlite3_column_text(stmt, nCol);
253 memcpy(array, text_val, sizeof(text_val));
339 memcpy(array, text_val, sizeof(text_val));
254− printf("text_val : %s\n", text_val );
255 rc =sqlite3_finalize(stmt);
340 rc =sqlite3_finalize(stmt);
256 if( rc != SQLITE_OK){
341 if( rc != SQLITE_OK){
257 printf("Couldn't finalize.\n");
342 printf("Couldn't finalize.\n");
@@ -261,6 +346,7 @@ const unsigned char* sqlite3_get_val_text(void* p,const char* tbl_name,int nRow,
264float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
350float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
266 DBinfo* dbi =(DBinfo*) p;
352 DBinfo* dbi =(DBinfo*) p;
@@ -290,7 +376,6 @@ float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
291 double_val =sqlite3_column_double(stmt, nCol);
377 double_val =sqlite3_column_double(stmt, nCol);
292 float float_val =(float)double_val;
378 float float_val =(float)double_val;
293− printf("float_val %f\n", float_val);
294 rc =sqlite3_finalize(stmt);
379 rc =sqlite3_finalize(stmt);
295 if( rc != SQLITE_OK){
380 if( rc != SQLITE_OK){
296 printf("Couldn't finalize.\n");
381 printf("Couldn't finalize.\n");
@@ -299,6 +384,17 @@ float sqlite3_get_float(void* p,const char* tbl_name, int nRow, int nCol){
387+float sqlite3_get_float_v2(void* p, int nCol){
389+ DBinfo* dbi =(DBinfo*) p;
392+ double_val =sqlite3_column_double(dbi->ppStmt, nCol);
393+ float float_val =(float)double_val;
303void sqlite3_free_table_idr(void* db){
399void sqlite3_free_table_idr(void* db){
304 Table* tbl =(Table*) db;
400 Table* tbl =(Table*) db;