Results 1 to 20 of 22

Thread: SQLite make problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: SQLite make problems

    Quote Originally Posted by raphaelf View Post
    I have insert two new lines, is that correct, because i have same problem:
    If you have the same problem as the one discussed on qt-interest, then it means you can't have more than one query object at once.

    Try executing that loop before you create QSqlQuery and create only one instance of that class.

  2. #2
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: SQLite make problems

    Hi ..

    I am using before insert a new row like that
    Qt Code:
    1. void MainWindow::insert()
    2. {
    3. model->setTable("words_tbl");
    4. while (model->canFetchMore()){
    5. model->fetchMore();}
    6. model->setEditStrategy(QSqlTableModel::OnFieldChange);
    7. model->select();
    8.  
    9. //model->removeColumn(0); // don't show the ID
    10. model->setHeaderData(1, Qt::Horizontal, tr("Deutsch"));
    11. model->setHeaderData(2, Qt::Horizontal, tr("Portuguiesisch"));
    12.  
    13. ui.tableView->setModel(model);
    14. ui.tableView->setColumnHidden(0, true);
    15. ui.tableView->sortByColumn(1);
    16. ui.tableView->show();
    17.  
    18. if ((ui.l1_le->text() == "")||(ui.l2_le->text() == ""))
    19. {
    20. QMessageBox::information(this,"LernIT","Please fill field Deutsch and Portuguiesisch");
    21. return;}
    22.  
    23.  
    24. if (ui.switch_cb->currentIndex() == 0)
    25. {
    26. /*
    27. QSqlQuery insert;
    28. insert.prepare("insert into words_tbl (language1, language2, plural, description) values ( :lang1, :lang2, :plural, :desc );" );
    29. insert.bindValue( ":lang1", ui.l1_le->text() );
    30. insert.bindValue( ":lang2", ui.l2_le->text() );
    31. insert.bindValue( ":plural", ui.plural_le->text() );
    32. insert.bindValue( ":desc", ui.description_le->text() );
    33. if( ! insert.exec() ) {
    34.   QMessageBox::information(this,"LernIT",insert.lastError().text());
    35.   ui.l1_le->setText("");
    36.   ui.l2_le->setText("");
    37.   ui.plural_le->setText("");
    38.   ui.description_le->setText("");
    39.   ui.l1_le->setFocus();
    40.   return;}
    41.   */
    42. QSqlRecord rec = model->record();
    43. rec.setValue("language1", ui.l1_le->text());
    44. rec.setValue("language2", ui.l2_le->text());
    45. rec.setValue("plural", ui.plural_le->text());
    46. rec.setValue("description", ui.description_le->text());
    47. model->insertRecord(-1, rec);
    48. .
    49. .
    50. .
    To copy to clipboard, switch view to plain text mode 

    Should i post my .cpp file?

    Please help me
    Think DigitalGasoline

  3. #3
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: SQLite make problems

    I think many of you questions on record and database locking can be answered here:

    http://www.sqlite.org/lockingv3.html

  4. #4
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: SQLite make problems

    Hi,

    Thanks for the Link..

    Should i find the solution there?Or ii dont have a solution for my probllem?
    Think DigitalGasoline

Similar Threads

  1. QMake make install problems
    By cookiem in forum Qt Programming
    Replies: 12
    Last Post: 4th December 2008, 15:34
  2. SQLITE database problems
    By phoenix in forum Newbie
    Replies: 3
    Last Post: 30th April 2007, 21:38
  3. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43
  4. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  5. Qt4.1.4 make errors.
    By impeteperry in forum Installation and Deployment
    Replies: 11
    Last Post: 1st July 2006, 17:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.