--- orig-Makefile.PL Thu Apr 17 13:17:24 1997 +++ Makefile.PL Tue Oct 21 11:40:45 2003 @@ -17,23 +17,35 @@ "clean" => { FILES => 'Mysql.pm.html bench/*~' }, "dist" => { SUFFIX => "gz", DIST_DEFAULT => 'all uutardist', COMPRESS => "gzip -9f", }, ); - $headerdir= ( -d "../include-lib" ) ? "../include-lib" : - ( -d "../include" ) ? "../include" : "../../include"; - die "No $headerdir/mysql.h file found\n" unless -f "$headerdir/mysql.h"; - $libdir= ( -d "../mach-lib-opt" ) ? "../mach-lib-opt" : - (-d "../lib/") ? "../lib/" : "../../client/"; - if ( -f "$libdir/libmysqlclient.a") - { - $libs="-lmysqlclient"; - } - else - { - $libs="-lmysql -lmysys -ldbug -lstrings"; + foreach $tmp (qw(../include-lib ../include ../../include + /usr/local/mysql/include/mysql /usr/local/mysql/include + /usr/mysql/include/mysql /usr/mysql/include + /usr/include/mysql)) { + if(-d $tmp and -r "$tmp/mysql.h") { + $headerdir=$tmp; + last; + } } + die "No mysql.h file found\n" unless $headerdir; + foreach $tmp (qw(../mach-lib-opt ../lib ../../client /usr/lib + /usr/local/mysql/lib/mysql /usr/local/mysql/lib + /usr/mysql/lib/mysql /usr/mysql/lib)) { + next unless(-d $tmp); + if(-r "$tmp/libmysqlclient.a") { + $libdir=$tmp; + $libs="-lmysqlclient"; + last; + } elsif(-r "$tmp/libmysql.a") { + $libdir=$tmp; + $libs="-lmysql -lmysys -ldbug -lstrings"; + last; + } + } + die "No library file found\n" unless $libs; open MYSQL, "lib/Mysql.pm" or die "open: $!"; while (!$VERSION){ $_=; next unless /VERSION/; eval; --- orig-Mysql.xs Sat Apr 19 10:56:32 1997 +++ Mysql.xs Tue Oct 21 11:46:50 2003 @@ -1,7 +1,9 @@ /* -*-C-*- */ +#define sv_undef PL_sv_undef +#define dowarn PL_dowarn #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "mysql.h" @@ -299,11 +301,11 @@ if (result && (cur = mysql_fetch_row(result))) { int count; if ((count=mysql_num_fields(result)) > 0) { - unsigned int *lengths=mysql_fetch_lengths(result); + unsigned long *lengths=mysql_fetch_lengths(result); for (off=0 ; off < count ; off++) { EXTEND(sp,1); if (cur[off]) { @@ -332,11 +334,11 @@ if (result && (cur = mysql_fetch_row(result))) { int count; if ((count=mysql_num_fields(result)) > 0) { - unsigned int *lengths=mysql_fetch_lengths(result); + unsigned long *lengths=mysql_fetch_lengths(result); EXTEND(sp,count*2); mysql_field_seek(result,0); for (off=0 ; off < count ; off++) { @@ -608,13 +610,15 @@ dBSV; MYSQL *sock,*mysql; mysql=malloc(sizeof(*mysql)); - sock = mysql_connect(mysql,host && host[0] ? host : NULL,user,password); + /* Mysqlperl didn't handle the failure-to-allocate case before, so... */ + mysql_init(mysql); + sock = mysql_real_connect(mysql,host && host[0] ? host : NULL,user,password,db,0,NULL,0); - if (!sock || (db && (mysql_select_db(sock,db) < 0))) + if (!sock) { ERRMSG(mysql); free((char*) mysql); } else { iniHV; --- lib/Mysql/orig-Statement.pm Sat Apr 19 08:37:27 1997 +++ lib/Mysql/Statement.pm Tue Apr 20 10:43:58 2004 @@ -68,23 +68,23 @@ my($sth) = @_; my($plusline,$titline,$sprintf,$result,$s) = ('+','|','|'); if ($sth->optimize) { my(@sprintf,$l); for (0..$sth->numfields-1) { - $sprintf[$_] = length($sth->name->[$_]); + $sprintf[$_] = &length($sth->name->[$_]); } $sth->dataseek(0); my(@row); while (@row = $sth->fetchrow) { #map {defined $_ ? unctrl($_) : "NULL"}! foreach (0..$#row) { my($s) = defined $row[$_] ? unctrl($row[$_]) : "NULL"; # New in 2.0: a string is longer than it should be - if ($sth->type->[$_] == &Mysql::TEXT_TYPE && length($s) > $sth->length->[$_] + 5) { - my $l = length($row[$_]); - $sprintf[$_] = $sth->length->[$_] + 5 + length($l); # for "...()" + if ($sth->type->[$_] == &Mysql::TEXT_TYPE && &length($s) > $sth->length->[$_] + 5) { + my $l = &length($row[$_]); + $sprintf[$_] = $sth->length->[$_] + 5 + &length($l); # for "...()" } else { - $sprintf[$_] = length($s) if length($s) > $sprintf[$_]; + $sprintf[$_] = &length($s) if &length($s) > $sprintf[$_]; } } } for (0..$sth->numfields-1) { $l = $sprintf[$_]; @@ -102,13 +102,13 @@ } elsif ($sth->type->[$_] == Mysql::REAL_TYPE()){ $l = 16; } else { $l = $sth->length->[$_]; } - $l < length($sth->name->[$_]) and $l = length($sth->name->[$_]); + $l < &length($sth->name->[$_]) and $l = &length($sth->name->[$_]); $plusline .= "-" x $l . "+"; - $titline .= $sth->name->[$_] . " " x ($l - length($sth->name->[$_])) . "|"; + $titline .= $sth->name->[$_] . " " x ($l - &length($sth->name->[$_])) . "|"; $sprintf .= (($sth->type->[$_] & &Mysql::CHAR_TYPE | &Mysql::TEXT_TYPE) ? "%-$ {l}s|" : "%$ {l}s|"); } } $sprintf .= "\n"; @@ -123,13 +123,13 @@ $prow[$_] = defined $row[$_] ? unctrl($row[$_]) : "NULL"; # New in 2.0: a string is longer than it should be if ( $sth->optimize && $sth->type->[$_] == &Mysql::TEXT_TYPE && - length($prow[$_]) > $sth->length->[$_] + 5 + &length($prow[$_]) > $sth->length->[$_] + 5 ) { - my $l = length($row[$_]); + my $l = &length($row[$_]); substr($prow[$_],$sth->length->[$_])="...($l)"; } } $result .= sprintf $sprintf, @prow; }