Subject: | sqlite3_bind_param length error |
Date: | Mon, 18 Apr 2016 22:11:07 +0800 |
To: | bug-PAB3-DB-Driver-Sqlite3 [...] rt.cpan.org |
From: | 游子德 <tedyu002 [...] gmail.com> |
Version: PAB3-DB-Driver-Sqlite3 1.0.7
Perl Version 5.10.1
OS: CentOS 6.7 Linux 2.6.32.573.22.1.e16.x86_64 #1 SMP Wed Mar 23 03:35:39
UTC 2016 x86_64 x86_64 GNU/Linux
When using sqlite3_prepare($linkid, $idx, $str, 's'), to insert value.
I found that the value can't be selected with '=' in SQL.
After I dump the row with SELECT hex(ID) from TABLE_NAME,
I found that there are trailing zeros.
I checked the my_sqlite3.c, it used the length of SvLEN as bind length.
According to the comment, it's the length of buffer.
It seems that SvCUR(length as C String) should be used.