You could also do this Query = sqlite3_mprintf("select name from foo where id = ?"); rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL); char str[20][5] = {"32","2","66","3","88"} ; for (i=1;str[i]; i ++) { sqlite3_reset(&Statement) ; sqlite3_bind_text(Statement,1,str[i],-1,NULL); do { rc = sqlite3_step(Statement); if(rc == SQLITE_ROW) { [DO YOUR WORK] } } while(rc == SQLITE_ROW) ; }
Israel Figueroa <[EMAIL PROTECTED]> wrote: I'm not quite sure if what i'm doing is correct. i have a table with id's and names.. table foo{ id INTEGER PRIMARY KEY, name varchar } then, i have to get all the names of a group (variable length) of elements in foo(i have the id's in ONE string) so i did this. Query = sqlite3_mprintf("select name from foo where id in (?)"); rc = sqlite3_prepare_v2(DB,Query ,-1,&Statement,NULL); fine so far... for (i=1;i [...] sqlite3_bind_text(Statement,1,str,-1,NULL); //where str is something like "33,2,66,3,88"; where all the id's are valid.. [...] rc = sqlite3_step(Statement); //here i get an rc = 101 == SQLITE_DONE when i was expecting SQLITE_ROW [...] } the thing is that when i do the query manualy.. it works perfecttly ( select name from foo where id in (33,2,66,3,88) ) but in the code... it doesn't. maybe the sqlite3_bind_text doesn't do what i suposed... i'm working with sqlite 3.4.0 amalgamation, BC++ 5.0... it works perfectly with everything else (i removed all the const's in sqlite.h that made the compiler freak). BTW, the doc didn't say if the string returned by const unsigned char *sqlite3_column_text should be freed.. so i don't. it's that ok? ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------