Cannot bind datetime
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 243
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 37
Description
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
Contributor guide
Research direction
Start with the linked reproduction gist and trace the bind_index and bind_param paths for CDB2_DATETIME. Reproduce the SELECT @val AS value query and follow the Bad argument for field:val type:9 error. Done means the datetime value binds and the query executes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100