Results 1 to 9 of 9

Thread: QMYSQL3: Unable to bind outvalues

  1. #1
    Join Date
    May 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy QMYSQL3: Unable to bind outvalues

    XP Pro SP3
    QT 4.5.1
    MySQL 5.1.31
    Using MinGW (NOT MS Visual Studio)

    compiled MySQL plugin as described in
    http://www.jiggerjuice.net/software/qt-sql-drivers.html

    Everything works fine EXCEPT cannot get any query results. Always get...

    Using unsupported buffer type: 3 (parameter: 3) QMYSQL3: Unable to bind outvalues

    When I run the QT sqlbrowser demo it reports exactly the same problem. It does show the list of tables but any access to them, either by double-clicking on a table name or executing a query in the query window produces the above error.

    This has been tried on TWO different machines, both of which are CLEAN (e.g. install and patch XP, install Apache 2.2.11, MySQL 5.1.31, PHP 5.2.8, QT 4.5.1, make plugins as per page above and copy qsqlmysqld4.dll, libqsqlmysqld4.a to c:\qt\plugins\sqldrivers)

    I have searched and searched and have pretty much drawn a blank. Similar problems seem to have been fixed by changing mysql dll
    e.g.
    unsupported buffer type
    mysql library problem
    MySQL Strange behaviour

    I have PCTools firewall installed. I have disabled this. No difference.
    I have tried localhost and 127.0.0.1. No difference.
    Using mysql command line client works perfectly.
    Accessing database using PHP works perfectly

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    2. db.setHostName("localhost");
    3. db.setDatabaseName(<valid database>);
    4. db.setUserName(<valid username>);
    5. db.setPassword(<valid password>);
    6. bool ok = db.open();
    7. if (ok)
    8. {
    9. // QSqlQuery query("select Event_Title from events where Event_ID=79");
    10. QSqlQuery query("select event_title,s.series_id,series_title from events,series s where event_id=79 and events.series_id=s.series_id");
    11. if (!query.isValid())
    12. {
    13. QMessageBox::information(this,"Last Error",query.lastError().text());
    14. // The more simple query gives no error but also produces no results
    15. // however QSqlError.errorNumber = -1
    16. }
    17.  
    18. while( query.next() )
    19. {
    20. // NEVER EVER get here!!!!
    21. // That is the problem in a nutshell!!!
    22. QString event_title = query.value(0).toString();
    23. QMessageBox::information(this,"event_title",event_title);
    24. }
    25. db.close();
    26. }
    To copy to clipboard, switch view to plain text mode 

    I have tried just about every combination, property, and method of QSqlDatabase, QSqlQuery, QSqlQueryModel, QSqlRecord, QSqlError, etc... all to no avail.

    The instance of the QSqlDatabase object seems to be connected ok. I can get a list of tables, etc. But that is all. And exactly the observed behaviour of the sqlbrowser demo as well.

    I have tried a large number of SQL queries, and checked each query in phpMyAdmin (OK) and in the cmd line mysql client (OK).

    I am a newbie to QT and think QT is awesome. But this is causing me some serious headache and heartache. Any suggestions or help gratefully received.

    Thanks
    Last edited by sirguyon; 9th May 2009 at 03:02.

  2. #2
    Join Date
    May 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL3: Unable to bind outvalues

    Someone must be able to help. I accept that I've done something silly or missed an obvious step - I just can't believe that it would normally be so hard... all I want to do is talk to a MySQL database...

    Could it be one of the many libmysql.dll files on my system? Is it doing something with the one in the PHP dir?

    Is it something to do with my environment? My system path perhaps?

    C:\Program Files\PHP\;%SystemRoot%\system32;%SystemRoot%;%Sys temRoot%\System32\Wbem;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\Program Files\TortoiseSVN\bin

    I am so confused now about what is what and so much advice around the re-generation of the MySQL import library seems contradictory at best, and confusing at worst.

    Am I making a mistake trying to use MinGW? Should I revert to VC6?

    Please help.

  3. #3
    Join Date
    May 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL3: Unable to bind outvalues [fixed?]

    OK, I took my own advice and started moving dlls around and changing paths...

    I think the thing that did it was moving C:\Program Files\PHP\; to the end of the path.

    %SystemRoot%\system32;%SystemRoot%;%Sys temRoot%\System32\Wbem;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\PHP\;

    If anyone can explain exactly why this matters (I assume that it has something to do with the libmysql.dll in the PHP directory) then I would really like to know.

    I am not a makefile, compiler, or systems guru. I struggle enough writing little pieces of application code. But I still like to know WHY....

    If something so simple was the problem then I can't believe that others haven't had similar issues.

    Like I say, I'm not sure exactly what I've done to fix the problem and it leaves me feeling that things are a little fragile.

    In this case a little knowledge would be a very welcome thing.

    Thanks again

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QMYSQL3: Unable to bind outvalues

    Quote Originally Posted by sirguyon View Post
    Qt Code:
    1. QSqlQuery query("select event_title,s.series_id,series_title from events,series s where event_id=79 and events.series_id=s.series_id");
    To copy to clipboard, switch view to plain text mode 
    Guess event_id is your primary key, so the result is only one row.
    After executing query points to the first result.
    Qt Code:
    1. while( query.next() )
    2. {
    3. // NEVER EVER get here!!!!
    To copy to clipboard, switch view to plain text mode 
    this is because there is no second row...

  5. #5
    Join Date
    May 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL3: Unable to bind outvalues

    Lykurg said:
    Guess event_id is your primary key, so the result is only one row.
    After executing query points to the first result.
    Sorry, don't think so. Yes, only one row is returned but this was just one out of many, many sql statements that were used while testing and experimenting.

    From the QT Manual (QSqlQuery entry)
    Successfully executed SQL statements set the query's state to active so that isActive() returns true. Otherwise the query's state is set to inactive. In either case, when executing a new SQL statement, the query is positioned on an invalid record. An active query must be navigated to a valid record (so that isValid() returns true) before values can be retrieved.
    and

    Navigating records is performed with the following functions:

    * next()
    * previous()
    * first()
    * last()
    * seek()
    So, even with just ONE record, using next is quite a good idea.

    Anyway, great to get a response.

    Does anyone else use MinGW & MySQL 5.1 with QT?

    I suspect that if I hadn't had Apache & PHP installed I would have had no problem so far.

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QMYSQL3: Unable to bind outvalues

    Quote Originally Posted by sirguyon View Post
    Sorry, don't think so.
    Yes, yes, always gets puzzled that Qt does not.

    But then your code is correct and works for me. So it has to do with your dll. What does QSqlDatabase::drivers() say?

  7. #7
    Join Date
    May 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL3: Unable to bind outvalues

    The FIX was to move "c:\Program Files\PHP" to the END of the system path, after "MySQL\Bin"

    The PHP dir had an older copy of libmysql.dll (installed by PHP)
    (I suspect that this was the problem....)

    I should know more but I don't. I'm embarrassed to ask... but what is the mechanism by which things link together? It all seems like magic to me...

    And after using tools that I am not familiar with (reimp, dlltool, qmake, ming32-make) to create .a files (of which I only seem to have the debug(?) versions....) and moving things around... I am just a little confused... and I suspect a few other newbies could get into a similar situation... and have no idea how to get out of it.

    To get into trouble... all you have to do is install PHP 5.2.8 and MySQL 5.1.31, and then install QT 4.5.1.

    The answer is that.... you don't just have to have mysql\bin in the path... it has to be before the \php directory...

    I would just like some confirmation that my analysis is correct. I would also like the next newbie who has such a problem to be able to find a relatively clear description\discussion of what the problem (and at least one possible solution) may be.

    What do you think?

  8. #8
    Join Date
    May 2009
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL3: Unable to bind outvalues

    And it is never easy.... maybe my solution was wrong... because my PHP scripts now don't run... probably because they are now finding the wrong DLL....

    I tried to find a PHP 5.2.8 / MySQL 5.1.31 version of php_mysqli.dll but couldn't find one.

    In the end I downloaded the zip file of php-5.2.9-2-Win32.zip... and it still wouldn't work...

    ...so I replaced the downloaded php\ext files with PHP-5.2.9+_MySQL-5.1.30+.zip files....

    And copied the libmysql.dll from the Mysql\Bin dir to the PHP dir...

    ...and then had to REBOOT.... and now everything works... and I suspect that the path order (see a previous post) would no longer matter...

    Problem is, despite now having everything working, I am still not sure if I've just been chasing my tail.... did I miss the obvious and easy fix?

  9. #9
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Just a reference

    Since we solved an analog problem, I want to put it here the thread as reference, maybe someone else is passing here through trying to find a solution for this frustrating problem.

    This is the thread: http://www.qtcentre.org/forum/f-newb...tml#post123213

    HTH
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

Similar Threads

  1. How to Compile VTKDesigner2 with Qt?
    By alfredoaal in forum Newbie
    Replies: 0
    Last Post: 5th September 2008, 06:34

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.