Bug in db_get_table when making more than one query
Status: Inactive
Brought to you by:
nonun
Bellow is db_get_table patched that makes it work as before, the diference is the way the return value is managed, as of version 0.5 it was stored in the db structure, and in 0.5.0.1 it's not and that cause the second and folowwing queries to fail with my application that uses a lib_sqlited.
As well I could see that not all changes I proposed when porting it to win32 are included in 0.5.0.1, mainly copy elements from old buffer to new one when realloc memory to expand it.
anyway I'm doing new modifications to win32 port and adding the possibility for it to work as a service.
I'll post the new port here soon.
int db_get_table( struct db_t db, char sql )
{
//int res;
if ( db == NULL )
return SQLITE_ERROR;
db->work_id = ++db_work_id;
if ( db->lock != NULL )
pthread_mutex_lock( &db->lock->lock );
db->table_res = sqlite3_get_table( db->db, sql, &db->table, &db->table_nrow, &db->table_ncol, &db->errmsg );
if ( db->lock != NULL )
pthread_mutex_unlock( &db->lock->lock );
return db->table_res;
}