Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSqlRelationalTableModel - problem with non-existent rows
QtWS25 Last Chance

QSqlRelationalTableModel - problem with non-existent rows

Scheduled Pinned Locked Moved General and Desktop
mysqlqsqlrelationaltqsqldatabase
1 Posts 1 Posters 677 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stravinsky
    wrote on 3 Jul 2015, 14:22 last edited by
    #1

    Hello.

    I have very big problem with my database application. If the main table contains foreign key which is set to NULL, the entire row is not displayed.

    My solution to the problem was to create a row in the relation's table called "None". When the user doesn't selects the link to relation's table (foreign key is not set) value is automaticlly set to default "NONE". Thanks to this the main table displays all available rows.

    For example: I have 3 tables:
    1.People
    2.Place
    3.Machine

    The place where the machine is set to "NONE"
    The place where the people is set to "NONE"

    The problem is in displaying a database VIEW which contains this 3 tables (also another): people, place and machine, becouse it looks like people have relations with machine. But it's not true. It looks like this becouse of the same place.

    Is possible to sublass QSqlRelationalTableModel for displaying rows of main_table which contains foreign key set to NULL???

    1 Reply Last reply
    0

    1/1

    3 Jul 2015, 14:22

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved