Loading ...
Sorry, an error occurred while loading the content.

Re: about qtdatabase.cpp/h and QSQLITE driver

Expand Messages
  • pvbrowser
    ... Could you please test if this would work ? ymax = result- size(); http://qt-project.org/doc/qt-4.8/qsqlresult.html#size The qtDatabase template in pvbaddon
    Message 1 of 6 , Mar 8, 2012
    View Source
    • 0 Attachment
      > If you use Qt + QSQLITE driver you have to pay attention that
      > Sqlite doesn't have the feature of returning the size of a "select" > query.

      Could you please test if this would work ?
      ymax = result->size();
      http://qt-project.org/doc/qt-4.8/qsqlresult.html#size

      The qtDatabase template in pvbaddon is only intendet as a starting point for your own database application.
      Database programming in pvbrowser is in principle Qt database programming.
      I think this is an issue related either to Qt or sqlite.
    • a_la_wachinwei
      totally agree It s a QT issue, but like that, populatetable() doesn t work with SQLite DB. ymax = result- size(); returns always -1 because SQLite driver
      Message 2 of 6 , Mar 12, 2012
      View Source
      • 0 Attachment
        totally agree
        It's a QT issue, but like that, populatetable() doesn't work with SQLite DB.
        ymax = result->size(); returns always -1 because SQLite driver doesn't allow size commands.

        If someone here has tought using a SQLite DB with Pvbrowser should pay attention this, I think.



        --- In pvbrowser@yahoogroups.com, "pvbrowser" <pvbrowser@...> wrote:
        >
        >
        >
        > > If you use Qt + QSQLITE driver you have to pay attention that
        > > Sqlite doesn't have the feature of returning the size of a "select" > query.
        >
        > Could you please test if this would work ?
        > ymax = result->size();
        > http://qt-project.org/doc/qt-4.8/qsqlresult.html#size
        >
        > The qtDatabase template in pvbaddon is only intendet as a starting point for your own database application.
        > Database programming in pvbrowser is in principle Qt database programming.
        > I think this is an issue related either to Qt or sqlite.
        >
      • pvbrowser
        ... agree with you. I have inserted a comment in the qtdatabase.cpp template. It looks as follows (pvbaddon.tar.gz not yet uploaded). // set table dimension
        Message 3 of 6 , Mar 12, 2012
        View Source
        • 0 Attachment
          <a_la_wachinwei@...> wrote:
          >
          > totally agree
          > It's a QT issue, but like that, populatetable() doesn't work
          > with SQLite DB.

          agree with you.
          I have inserted a comment in the qtdatabase.cpp template.
          It looks as follows (pvbaddon.tar.gz not yet uploaded).

          // set table dimension
          xmax = result->record().count();
          //
          // Using SQLITE user a_la_wachinwei from our forum found an issue
          // getting ymax.
          // With SQLITE numRowsAffected() does not return the correct value.
          // Other database systems do.
          //
          if(db->driverName() == "QSQLITE")
          {
          result->last();
          ymax = result->at()+1;
          result->first();
          //printf("SQLITE ymax = %d \n",ymax);
          }
          else
          {
          ymax = result->numRowsAffected();
          //printf("no SQLITE, ymax = %d \n",ymax);
          }
          pvSetNumRows(p,id,ymax);
          pvSetNumCols(p,id,xmax);
        • a_la_wachinwei
          ... this, as the title of master is not really necessary, xddd ... a really good point this! Joa
          Message 4 of 6 , Mar 12, 2012
          View Source
          • 0 Attachment
            >   // Using SQLITE user a_la_wachinwei from our forum found an issue

            this, as the title of master is not really necessary, xddd


            >     ymax = result->at()+1;

            a really good point this!

            Joa
          • pvbrowser
            ... OK, here is the anonymous version // // Using SQLITE a user from our forum found an issue // getting ymax. // With SQLITE numRowsAffected() does not return
            Message 5 of 6 , Mar 12, 2012
            View Source
            • 0 Attachment
              > this, as the title of master is not really necessary, xddd

              OK, here is the anonymous version
              //
              // Using SQLITE a user from our forum found an issue
              // getting ymax.
              // With SQLITE numRowsAffected() does not return the correct value.
              // Other database systems do.
              //
            Your message has been successfully submitted and would be delivered to recipients shortly.