{
rc = sqlite3_exec(db, "SELECT * FROM tbl", callback, NULL, &zErrMsg);
}
int callback(void *data, int argc, char **argv, char **azColName){
int i;
std::stringstream ss;
ss<<"INSERT INTO Fields VALUES("
for(i=0; i<argc; i++){
ss<<argv[i] ? argv[i] : 0
if(i+1<argc)
ss<<","
}
ss<<")"
rc = sqlite3_exec(db, ss.str(), NULL, NULL, &zErr);
if(rc){
wxMessageBox("Error opening database: " << sqlite3_errmsg(db),"Error",wxOK);
sqlite3_close(db);
return 1;
}
return 0;
}
I'm trying to copy data from one table to another, I thought about this code, is this code fine? can it be done better? Thanks.
Aucun commentaire:
Enregistrer un commentaire