Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. foreign key
    Log in to post
    • All categories
    • J

      Solved PyQt: Basic foreign key misbehaving?
      General and Desktop • pyqt sqlite foreign key • • judethedude

      2
      0
      Votes
      2
      Posts
      76
      Views

      J

      Solved, sorry to bother everyone.
      I needed to designate my patient_id as UNIQUE

    • J

      Unsolved Reference to non-existing key in QSqlRelationalTableModel
      General and Desktop • sql foreign key • • Jendker

      6
      0
      Votes
      6
      Posts
      1008
      Views

      JonB

      @Jendker

      A NULL value in a field that is a foreign key can be considered a design flaw of the database.

      When I started to answer your question, that was my initial position (except I wouldn't say "flaw"). When I have used FKs I was never allowed NULL, and I thought that was actually required. However I Googled and plenty said many databases support it (e.g. MySQL) and it was regarded as "acceptable".

      I never did think QSqlRelationalTableModel offered much over QSqlTableModel. It's really just a glorified combobox (model being the FK table) interface in the view. Exactly as 2009 says, a custom delegate could do the job. Just a shame that Qt's doesn't offer NULL handling option for what you want.

    • G

      Unsolved How to synch models on relational database where tables are linked by a foreign key
      General and Desktop • foreign key relational table model syncronization • • grm65

      1
      0
      Votes
      1
      Posts
      971
      Views

      No one has replied