Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot bind datetime #908

Open
librehat opened this issue May 30, 2018 · 6 comments
Open

Cannot bind datetime #908

librehat opened this issue May 30, 2018 · 6 comments
Labels

Comments

@librehat
Copy link

I alwasy get this error in both bind_index and bind_param attempts:

cdb2_socket_pool_get(comdb2/testdb/local/newsql/random_room,1): fd=-1
cdb2_socket_pool_get(comdb2/testdb/local/newsql/random_room,1): fd=-1
td 167903872 parse_dbresponse:2818
td 167903872 parse_dbresponse:2848, 0) host=localhost.localdomain(19000)*
0x7f280a020280> cdb2_open(dbname: "testdb", type: "local", flags: 14) = 0 => 0x13f7ad0
Current time=Wed May 30 16:43:42 2018

Converted into CDB2 value=2018-5-30T16:43:42 (UTC)
0x7f280a020280> cdb2_bind_param(0x13f7ad0, "val", CDB2_DATETIME, 0x7ffda32a35a0, 76) = 0
cdb2_socket_pool_get(comdb2/testdb/local/newsql/random_room,1): fd=-1
td 0x7f280a020280 cdb2_send_query line 2223
0x7f280a020280> cdb2_run_statement(0x13f7ad0, "SELECT @val AS value") = -3
0x7f280a020280> cdb2_errstr(0x13f7ad0) = "Bad argument for field:val type:9
"
Failed to execute statement "SELECT @val AS value": Bad argument for field:val type:9

Reproducible gist: https://gist.github.com/librehat/89f4f7068fc3b824ffceb8aaecfaf2b6

@mponomar mponomar added the bug label May 31, 2018
@mponomar
Copy link
Contributor

Thanks for the report. This breaks in a release build, and works in a debug build.

@mponomar
Copy link
Contributor

It also works with cmake and older gcc releases..

@mponomar
Copy link
Contributor

Err, clang, not cmake.

@librehat
Copy link
Author

Interesting, if it helps, I used GCC 8. Could it be an "optimisation" done by newer GCC?

@mponomar
Copy link
Contributor

It is - it's passing our test suite because we build with an earlier gcc. Still looking.

@librehat
Copy link
Author

librehat commented Jun 1, 2018

As a workaround for now, I re-compiled it with GCC-6 and it works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants