Yeah, there are significant locking issues in sqlite under Qt, in particular if you hold a query open (either via QSqlQuery, or QSqlTableModel et al). clear() is your friend when things start going south. Also, another gotcha to watch out for, if the query fails, check the queries lastError(), not the QSqlDatabase's lastError(). The databases QSqlError will be for any "connection errors".
HTH, Alain Bertrand wrote: > John Stanton a écrit : >> Alain Bertrand wrote: >>>> >>>>> In a Qt4 application, I have the following bit of code : >>>>> >>>>> QString s; >>>>> bool b; >>>>> QSqlQuery q; >>>>> QSqlError err; >>>>> s= "CREATE TABLE ttd_bdata (sheetId integer primary key,"; >>>>> s+="creation_date date, modif_date date,"; >>>>> s+="speciesId integer,USDA_zone integer,"; >>>>> s+="generalities text,propagation text,care text,"; >>>>> s+="esthetics text, phyto text,miscellaneous text)"; >>>>> //s="SELECT * FROM ttd_species WHERE speciesId=4"; >>>>> qWarning( s.toAscii() ); >>>>> b=q.exec( s ); >>>>> >>>>> Executing the query fails with the following information >>>>> >>>>> SQL logic error or missing database >>>>> Unable to fetch row >>>>> Err number 1. >>>>> >> > > I have found the solution in the qt4 doc : > ----------------------------------------------------- > The driver is locked for updates while a select is executed. This may > cause problems when using QSqlTableModel because Qt's item views fetch > data as needed (with QSqlQuery::fetchMore() in the case of > QSqlTableModel). > ---------------------------------------------------- > > To avoid the problem, one may use the clear() method of the QSqlQuery. > > Alain -- Bill King, Software Engineer Trolltech, Brisbane Technology Park 26 Brandl St, Eight Mile Plains, QLD, Australia, 4113 Tel + 61 7 3219 9906 (x137) Fax + 61 7 3219 9938 mobile: 0423 532 733 ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------