Skip Menu |
 

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 18616
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: Nobody in particular
Requestors: marcello.romani [...] libero.it
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Server side prepared statements + MySQL 5.0 + DECIMAL = cannot SELECT
Download (untitled) / with headers
text/plain 4.4k
When using server side prepared statements $dsn='dbi:mysql:$database;mysql_server_prepare=1'; with MySQL 5.0, selecting from a table which has a DECIMAL column causes the following error to appear: "Using unsupported buffer type: 246" An explanation is found on the mysql website, section "upgrading from mysql 4.1 to 5.0": C API Changes: Incompatible change: Because the MySQL 5.0 server has a new implementation of the DECIMAL data type, a problem may occur if the server is used by older clients that still are linked against MySQL 4.1 client libraries. If a client uses the binary client/server protocol to execute prepared statements that generate result sets containing numeric values, an error will be raised: 'Using unsupported buffer type: 246' This error occurs because the 4.1 client libraries do not support the new MYSQL_TYPE_NEWDECIMAL type value added in 5.0. There is no way to disable the new DECIMAL data type on the server side. You can avoid the problem by relinking the application with the client libraries from MySQL 5.0. If we don't use server site prepared statements $dsn='dbi:mysql:$database"; the problems does not appear. Environment details: --------- perl -V --------- Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Platform: osname=MSWin32, osvers=5.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DBUILT_BY_ACTIVESTATE -DNO_HASH_SEED -DU SE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='12.00.8804', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x86' libpth=\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uui d.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES USE_SITECUSTOMIZE PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 813 [148120] Iin_load_module moved for compatibility with build 806 PerlEx hacks for CGI::Carp Less verbose ExtUtils::Install and Pod::Find instmodsh upgraded from ExtUtils-MakeMaker-6.25 24699 ICMP_UNREACHABLE handling in Net::Ping 21540 Fix backward-compatibility issues in if.pm Built under MSWin32 Compiled at Jun 6 2005 13:36:37 @INC: C:/Perl/lib C:/Perl/site/lib . -------------- mysql status -------------- Show quoted text
mysql> status;
-------------- mysql Ver 14.12 Distrib 5.0.19, for Win32 (ia32) Connection id: 1 Current database: Current user: root@localhost SSL: Not in use Using delimiter: ; Server version: 5.0.19-nt Protocol version: 10 Connection: localhost via TCP/IP Server characterset: latin1 Db characterset: latin1 Client characterset: latin1 Conn. characterset: latin1 TCP port: 3306 Uptime: 24 min 35 sec
Download (untitled) / with headers
text/plain 899b
Fixed in latest version 3.0007 (I think was fixed in 3.0006) CREATE TABLE `foo` ( `a` int(11) default NULL, `b` decimal(10,5) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 Show quoted text
mysql> select * from foo;
+------+---------+ | a | b | +------+---------+ | 1 | 2.22000 | | 2 | 0.00020 | +------+---------+ #!/usr/bin/perl use DBI; use Data::Dumper; my $dbh= DBI->connect("DBI:mysql:test:localhost;mysql_server_prepare=1", "root", "", { PrintError => 0}) || die $DBI::errstr; my $sth= $dbh->prepare("select * from foo"); print "error: " . $DBI::errstr . "\n" if $DBI::errstr; $sth->execute(); my $ar_ref= $sth->fetchall_arrayref(); print Dumper $ar_ref; radha:~/perl patg$ ./bug18616.pl $VAR1 = [ [ 1, '2.22000' ], [ 2, '0.00020' ] ];


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.