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. SQL query setForwardOnly option
Forum Updated to NodeBB v4.3 + New Features

SQL query setForwardOnly option

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 332 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.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by
    #1

    i use the same QSqlQuery instance object for executing several queries, all of which are forward-only.
    is it enough to set setForwardOnly(true) before prepating/executing the first query, or i need to set it before each query?

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @user4592357 said in SQL query setForwardOnly option:

      is it enough to set setForwardOnly(true) before prepating/executing the first query

      Yes. If you're unsure try yourself and check if it is forwardOnly after you created the second query.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      U 1 Reply Last reply
      4
      • Christian EhrlicherC Christian Ehrlicher

        @user4592357 said in SQL query setForwardOnly option:

        is it enough to set setForwardOnly(true) before prepating/executing the first query

        Yes. If you're unsure try yourself and check if it is forwardOnly after you created the second query.

        U Offline
        U Offline
        user4592357
        wrote on last edited by
        #3

        @Christian-Ehrlicher
        thanks, and what about when i bind values to query and execute it and it fails, can i execute another query with same bound values without binding them again?

        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          As always - try it out. But as long as you don't call reset you should be safe. It's possible to bind only a subset of all bound values after each query so it should be the same for a failed one.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1

          • Login

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