Results 1 to 7 of 7

Thread: QSQLITE problem with FOREIGN KEY

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default QSQLITE problem with FOREIGN KEY

    hi everybody, i have a problem, when i compile such a code:

    query.exec("CREATE TABLE IF NOT EXISTS ProductTypeGroup(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)");
    query.exec("CREATE TABLE IF NOT EXISTS ProductType(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, low_level INTEGER )");

    everything is ok, the table called ProductType will be created

    but when i compile such a code:

    query.exec("PRAGMA foreign_keys = ON;");
    query.exec("CREATE TABLE IF NOT EXISTS ProductTypeGroup(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)");
    query.exec("CREATE TABLE IF NOT EXISTS ProductType(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, low_level INTEGER , FOREIGN KEY (group) REFERENCES ProductTypeGroup(id)");

    i don't have any errors but table called ProductType won't be created

    Do You know what can be a problem??
    Last edited by kamilus; 24th April 2011 at 22:19.

Similar Threads

  1. Problem deploying qt application using qsqlite on Windows XP/7
    By anoraxis in forum Installation and Deployment
    Replies: 4
    Last Post: 8th April 2011, 13:18
  2. Foreign key ON
    By fantom in forum Qt Programming
    Replies: 0
    Last Post: 2nd March 2011, 10:32
  3. Replies: 1
    Last Post: 7th July 2008, 20:13
  4. FOREIGN KEY + QComboBox
    By eleanor in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2007, 10:37
  5. QSqlite problem
    By dragon in forum Qt Programming
    Replies: 2
    Last Post: 11th April 2007, 02:02

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.