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. [SOLVED] the qt-way for creating sqlite-databases
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] the qt-way for creating sqlite-databases

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 5.9k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    Charmaman
    wrote on last edited by
    #1

    Hello everyone,

    I started a small qt project and i am using the qt extensions only. I want to add a local database of type sqlite to my program. So far I got it working but I only know how to hack and create all tables and everything with the exec()-function.
    I have found wrappers for querys, databases-selection, select-calls of tables and so on, but no "qt-way" for creating the tables and key and so on. Is there no qt-support or functionality that helps with that instead of using plain exec-calls?

    Thanks for any help,

    Charmaman

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lycis
      wrote on last edited by
      #2

      You may execute queries to your database by using "QSqlQuery":http://qt-project.org/doc/qt-4.8/QSqlQuery.html. There is no better way that I know of. QSqlQuery provides you a very neat interface with bind parameters and everything you need.

      What do you expect to be the "qt-way" if not using queries to your database?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Charmaman
        wrote on last edited by
        #3

        I expected something like the QDOM-style, where you create qdomelements and link them as you want and in the end you once do something like save() and it creates the whole xml-file...

        I guess I'll have to do it by hand then...

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rahul Das
          wrote on last edited by
          #4

          You might want to go through the "MVP":http://qt-project.org/doc/qt-4.8/model-view-programming.html as well.


          Declaration of (Platform) independence.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jstaniek
            wrote on last edited by
            #5

            Hi,
            Have a look at Predicate lib which has SQLite3 plugin: http://community.kde.org/Predicate

            It's Qt-only, LGPL, and unlike QtSQL it 'knows' how to create database and then new tables (has a Qt/C++ API for that). No need to pass SQL at all (but it can be if you wish). I am preparing this lib as a next get backend for Kexi and similar complex apps.

            The only downside - it's not yet released and its API isn't frozen, so you'd need a copy of it.

            regards, Jarosław Staniek

            Certified Qt Specialist & Ambassador
            Kexi: http://kexi-project.org
            Calligra: http://calligra.org
            Qt for Tizen

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Charmaman
              wrote on last edited by
              #6

              [quote author="jstaniek" date="1336511641"]Hi,
              Have a look at Predicate lib which has SQLite3 plugin: http://community.kde.org/Predicate

              It's Qt-only, LGPL, and unlike QtSQL it 'knows' how to create database and then new tables (has a Qt/C++ API for that). No need to pass SQL at all (but it can be if you wish). I am preparing this lib as a next get backend for Kexi and similar complex apps.

              The only downside - it's not yet released and its API isn't frozen, so you'd need a copy of it.[/quote]
              Thanks, this sounds like exactly what I have been looking for. Unfortunatly I'd prefer to avoid any dependencies (except Qt itself) as much as possible. I just hoped that there simply is a qt-api for my case that I simply couldn't find.
              I will accept that there is no api by qt, so I will do it by hand with SQL-commands.

              [quote author="Rahul Das" date="1336509988"]You might want to go through the "MVP":http://qt-project.org/doc/qt-4.8/model-view-programming.html as well.[/quote]
              I don't know what for since it doesn't have to do with my "problem".

              1 Reply Last reply
              0

              • Login

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