Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved SQL query setForwardOnly option

    General and Desktop
    2
    4
    90
    Loading More Posts
    • 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
      user4592357 last edited by

      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 Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion last edited by

        @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 has to stay free or it will die.

        U 1 Reply Last reply Reply Quote 4
        • U
          user4592357 @Christian Ehrlicher last edited by

          @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 Reply Quote 0
          • Christian Ehrlicher
            Christian Ehrlicher Lifetime Qt Champion last edited by

            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 has to stay free or it will die.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post