Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

How to obtain libraries mysqlclient and mysqlclient_r on UBUNTU 16.04? #23

Closed
lgong30 opened this issue Mar 8, 2017 · 8 comments
Closed

Comments

@lgong30
Copy link

lgong30 commented Mar 8, 2017

While building sqlpp11-connector-mysql, I found the libraries mysqlclient and mysqlclient_r were missing on my ubuntu 16.04.
I am wondering which package should I install to obtain these two libraries.

Why do not use mariadb client instead of mysqlclient (just as what you did under MSVC)?

@rbock
Copy link
Owner

rbock commented Mar 19, 2017

Hi,

You could just use mariadb. On the systems that I know that use mariadb, there are libmysql* symbolic links. If those are not present on your system, maybe you could extend the FindMySql.cmake file and create a pull request? That would be great!

As for the Windows part: For quite some time I could not get libmysql to link with anything I built on appveyor. I was experimenting with mariadb and had compilation problems. I reported a few bugs and gave up. Some of this seems to be fixed now as the appveyor builds complete successfully but it is certainly not in a very good state.

@lgong30
Copy link
Author

lgong30 commented Mar 21, 2017

I have tried, everything went well except for the second test, i.e., SampleTest. The
second test failed while reallocating buffer, the following gives the detail:

2: MySQL debug: Preparing: 'SELECT tab_sample.alpha,tab_sample.beta,tab_sample.gamma FROM tab_sample WHERE (((tab_sample.alpha<>?) AND (tab_sample.beta<>?)) AND (tab_sample.gamma<>?))'
2: MySQL debug: Constructing prepared_statement, using handle at 0x20628d0
2: MySQL debug: binding integral parameter 7 at index: 0, being not null
2: MySQL debug: binding text parameter wurzelbrunft at index: 1, being not null
2: MySQL debug: binding boolean parameter true at index: 2, being not null
2: MySQL debug: Executing prepared_statement
2: MySQL debug: Constructing bind result, using handle at 0x20628d0
2: MySQL debug: binding integral result 0 at index: 0
2: MySQL debug: binding text result at index: 1
2: MySQL debug: binding boolean result
2: at index: 2
2: MySQL debug: Binding results for handle at 0x20628d0
2: MySQL debug: Accessing next row of handle at 0x20628d0
2: MySQL debug: Need to reallocate buffer at index 1 for handle at 0x20628d0
2: Exception: MySQL: Fetch column after reallocate failed:
2/6 Test #2: SampleTest .......................***Failed 0.23 sec

It seems that this exception is thrown by bool bind_result_t::next_impl() in bind_result.cpp.

Do you have any hint for me to solve it?

Thanks!
-- Long

@rbock
Copy link
Owner

rbock commented Mar 21, 2017

Hmm, that looks strange.

Can you try to dig deeper into the problem by printing r.bound_len, param.buffer_length and the actual return value of mysql_stmt_fetch_column?

Thanks,

Roland

@lgong30
Copy link
Author

lgong30 commented Mar 21, 2017

After a deeper dig, I got the following mysql error code:

Error: 2051 (CR_NO_DATA)
Message: Attempt to read column without prior row fetch

Original exception output is:

Exception: MySQL: Fetch column after reallocate failed: 2051

To get the above output, I changed mysql_stmt_error to mysql_stmt_errno in bind_result.cpp, since
I got nothing (empty string) from mysql_stmt_error.

Thanks!

  • Long

rbock added a commit that referenced this issue Mar 22, 2017
@rbock
Copy link
Owner

rbock commented Mar 22, 2017

Please try again with the new version on develop. It does not change anything functionally but prints a few more messages.

Which library are you using? mysql or mariadb, which version?

@lgong30
Copy link
Author

lgong30 commented Mar 22, 2017

My mysql server version is: mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using EditLine wrapper
For the connector, I used mariadb client (3.0.2) instead of mysqlclient.

The following is exception thrown when running ctest on the new version on develop.

2: Exception: MySQL: Fetch column after reallocate failed: error-code: 1, stmt-error: , stmt-errno: 2051

@rbock
Copy link
Owner

rbock commented Mar 23, 2017

Thanks. I'll need some time to setup mariadb.

@rbock
Copy link
Owner

rbock commented Sep 25, 2018

See #39 (it is a maria db client bug it seems).

Closing this one.

@rbock rbock closed this as completed Sep 25, 2018
fjkfwz pushed a commit to fjkfwz/sqlpp11-connector-mysql that referenced this issue Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants