Author: jimw
Date: Thu Jan 4 12:21:04 2007
New Revision: 8511
Modified:
DBD-mysql/trunk/ChangeLog
DBD-mysql/trunk/dbdimp.c
DBD-mysql/trunk/dbdimp.h
DBD-mysql/trunk/t/40bindparam.t
Log:
Fix handling of signed integer values when using server-side prepared
statements (they were being forced to unsigned values).
Modified: DBD-mysql/trunk/ChangeLog
==============================================================================
--- DBD-mysql/trunk/ChangeLog (original)
+++ DBD-mysql/trunk/ChangeLog Thu Jan 4 12:21:04 2007
@@ -1,4 +1,6 @@
<unreleased> Jim Winstead <jimw@stripped> (4.001)
+* Fix handling of signed integer values when using server-side prepared
+ statements (they were being forced to unsigned values).
* Do not tell Perl that the contents of binary fields are UTF-8.
[rt.cpan.org #22123], original patch by Joost Diepenmaat
* Fix double-free of bound parameters when freeing statements. (Bug #20559)
Modified: DBD-mysql/trunk/dbdimp.c
==============================================================================
--- DBD-mysql/trunk/dbdimp.c (original)
+++ DBD-mysql/trunk/dbdimp.c Thu Jan 4 12:21:04 2007
@@ -3337,6 +3337,7 @@
buffer->buffer_length= fields[i].length;
buffer->length= &(fbh->length);
buffer->is_null= &(fbh->is_null);
+ buffer->is_unsigned= fbh->is_unsigned;
Newz(908, fbh->data, fields[i].length, char);
switch (buffer->buffer_type) {
@@ -3536,8 +3537,12 @@
case MYSQL_TYPE_LONG:
if (dbis->debug > 2)
- PerlIO_printf(DBILOGFP, "\t\tst_fetch int data %d\n", fbh->ldata);
- sv_setuv(sv, fbh->ldata);
+ PerlIO_printf(DBILOGFP, "\t\tst_fetch int data %d, unsigned? %d\n",
+ fbh->ldata, fbh->is_unsigned);
+ if (fbh->is_unsigned)
+ sv_setuv(sv, fbh->ldata);
+ else
+ sv_setiv(sv, fbh->ldata);
break;
case MYSQL_TYPE_STRING:
Modified: DBD-mysql/trunk/dbdimp.h
==============================================================================
--- DBD-mysql/trunk/dbdimp.h (original)
+++ DBD-mysql/trunk/dbdimp.h Thu Jan 4 12:21:04 2007
@@ -186,10 +186,11 @@
typedef struct imp_sth_fbh_st {
unsigned long length;
bool is_null;
+ bool is_unsigned;
char *data;
- int charsetnr;
- double ddata;
- long ldata;
+ int charsetnr;
+ double ddata;
+ long ldata;
} imp_sth_fbh_t;
Modified: DBD-mysql/trunk/t/40bindparam.t
==============================================================================
--- DBD-mysql/trunk/t/40bindparam.t (original)
+++ DBD-mysql/trunk/t/40bindparam.t Thu Jan 4 12:21:04 2007
@@ -64,8 +64,6 @@
Test($state or $dbh = DBI->connect($test_dsn, $test_user, $test_password))
or ServerError();
- #sleep 60;
- Test($state or !$dbh->trace(2, "/tmp/trace.log"));
#
# Find a possible new table name
#
| Thread |
|---|
| • [svn:DBD-mysql] r8511 - in DBD-mysql/trunk: . t | jimw | 4 Jan |