Hi all ,
I am trying to insert about 500 records to a table.
I have tested my code and it works fine (All 500 recoreds are put in the table 
in about 250 miliseconds) but from time time I get SQLITE_CONSTRAINT error code 
after the sqlite3_step (1 out of 7 times).
Any idea on how to prevent this ?
That's my code:
 
 
query = sqlite3_mprintf("Insert into Inventory (Tag) values (?)");
rc=sqlite3_prepare_v2(DB,query ,-1,&Statement,NULL);
if (rc!=SQLITE_OK)
    error_print();
sqlite3_exec(db,"BEGIN;",NULL,NULL,&err);
for (i=1;500;i ++)
{
    rc=sqlite3_bind_text(Statement,1,list[i],-1,NULL);
    if (rc!=SQLITE_OK)
        error_print();
    rc=sqlite3_step(Statement);
    if (rc!=SQLITE_DONE)
        error_print();
    sqlite3_reset(Statement) ;
}
sqlite3_finalize(Statement) ;
 
sqlite3_exec(db,"END;",NULL,NULL,&err) ;
 
Thanks in advance ,
Vincent.
 
 



Never miss a thing. Make Yahoo your homepage. 


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to