r60187 - in /branches/upstream/libdbd-mysql-perl/current: ChangeLog MANIFEST META.yml dbdimp.c dbdimp.h lib/DBD/mysql.pm t/40blobs.t t/52comment.t t/53comment.t t/mysql.mtest
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Sat Jul 10 12:25:46 UTC 2010
Author: ansgar-guest
Date: Sat Jul 10 12:25:38 2010
New Revision: 60187
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=60187
Log:
[svn-upgrade] new version libdbd-mysql-perl (4.015)
Added:
branches/upstream/libdbd-mysql-perl/current/t/53comment.t (with props)
Modified:
branches/upstream/libdbd-mysql-perl/current/ChangeLog
branches/upstream/libdbd-mysql-perl/current/MANIFEST
branches/upstream/libdbd-mysql-perl/current/META.yml
branches/upstream/libdbd-mysql-perl/current/dbdimp.c
branches/upstream/libdbd-mysql-perl/current/dbdimp.h
branches/upstream/libdbd-mysql-perl/current/lib/DBD/mysql.pm
branches/upstream/libdbd-mysql-perl/current/t/40blobs.t
branches/upstream/libdbd-mysql-perl/current/t/52comment.t
branches/upstream/libdbd-mysql-perl/current/t/mysql.mtest
Modified: branches/upstream/libdbd-mysql-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/ChangeLog?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/ChangeLog (original)
+++ branches/upstream/libdbd-mysql-perl/current/ChangeLog Sat Jul 10 12:25:38 2010
@@ -1,11 +1,19 @@
+2010-07-09 Patrick Galbraith <patg at patg.net> (4.015)
+* BUG #56664 fixed t/40blobs.t skip_all logic (W. Phillip Moore)
+* BUG #57253 Fixed iteration past end of string (crash). (Chris Butler)
+* Added a new parameter for old behavior- mysql_bind_comment_placeholders which
+ will make it possible to have placeholders bound for those who really
+ want that behavior.
+* Fixed bind_type_guessing - always on now
+
2010-04-14 Patrick Galbraith <patg at patg.net> (4.014)
-* BUG 30033 Fixed handling of comments to allow comments that contain characters
+* BUG #30033 Fixed handling of comments to allow comments that contain characters
that might otherwise cause placeholder detection to not work properly
-* BUG 53844, Fix for memory leak in stats. (Gregory Burmistrov)
-* BUG 49719, Fix for handling of NULLs in prepared statements (Gert Pache)
-* BUG 55627, Fix for testing failure due to strict mode (Yves)
-* BUG 51784, Fix for mysqladmin on Windows in Makefile (Zeeshan Muhammad)
-* BUG 41630, Typo in Makefile
+* BUG #53844, Fix for memory leak in stats. (Gregory Burmistrov)
+* BUG #49719, Fix for handling of NULLs in prepared statements (Gert Pache)
+* BUG #55627, Fix for testing failure due to strict mode (Yves)
+* BUG #51784, Fix for mysqladmin on Windows in Makefile (Zeeshan Muhammad)
+* BUG #41630, Typo in Makefile
* Had to define true and false in dbdimp.h. Didn't work out of the box on Linux
2009-09-16 Patrick Galbraith <patg at patg.net> (4.013)
Modified: branches/upstream/libdbd-mysql-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/MANIFEST?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/MANIFEST (original)
+++ branches/upstream/libdbd-mysql-perl/current/MANIFEST Sat Jul 10 12:25:38 2010
@@ -44,6 +44,7 @@
t/50commit.t
t/51bind_type_guessing.t
t/52comment.t
+t/53comment.t
t/55utf8.t
t/60leaks.t
t/65types.t
Modified: branches/upstream/libdbd-mysql-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/META.yml?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/META.yml (original)
+++ branches/upstream/libdbd-mysql-perl/current/META.yml Sat Jul 10 12:25:38 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: DBD-mysql
-version: 4.014
+version: 4.015
abstract: A MySQL driver for the Perl5 Database Interface (DBI)
author:
- Rudy Lippan <rlippan at remotelinux.com>
Modified: branches/upstream/libdbd-mysql-perl/current/dbdimp.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/dbdimp.c?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/dbdimp.c (original)
+++ branches/upstream/libdbd-mysql-perl/current/dbdimp.c Sat Jul 10 12:25:38 2010
@@ -61,7 +61,7 @@
*/
static int
-count_params(char *statement)
+count_params(char *statement, bool bind_comment_placeholders)
{
bool comment_end= false;
char* ptr= statement;
@@ -78,87 +78,98 @@
/* so, this is a -- comment, so let's burn up characters */
case '-':
{
- comment_length= 1;
- /* let's see if the next one is a dash */
- c = *ptr++;
-
- if (c == '-') {
- /* if two dashes, ignore everything until newline */
- while (c = *ptr)
+ if (bind_comment_placeholders)
{
- if (dbis->debug >= 2)
- PerlIO_printf(DBILOGFP, "%c\n", c);
- ptr++;
- comment_length++;
- if (c == '\n')
- {
- comment_end= true;
+ c = *ptr++;
break;
- }
}
- /*
- so, if there was an end to the comment, increment by one more
- to go past the new line
-
- if not comment_end, the comment never ended and we need to iterate
- back to the beginning of where we started and let the database
- handle whatever is in the statement
- */
- if (comment_end)
- ptr++;
else
- ptr-= comment_length;
- }
- /* otherwise, only one dash/hyphen, backtrack by one */
- else
- ptr--;
- break;
+ {
+ comment_length= 1;
+ /* let's see if the next one is a dash */
+ c = *ptr++;
+
+ if (c == '-') {
+ /* if two dashes, ignore everything until newline */
+ while (c = *ptr)
+ {
+ if (dbis->debug >= 2)
+ PerlIO_printf(DBILOGFP, "%c\n", c);
+ ptr++;
+ comment_length++;
+ if (c == '\n')
+ {
+ comment_end= true;
+ break;
+ }
+ }
+ /*
+ if not comment_end, the comment never ended and we need to iterate
+ back to the beginning of where we started and let the database
+ handle whatever is in the statement
+ */
+ if (! comment_end)
+ ptr-= comment_length;
+ }
+ /* otherwise, only one dash/hyphen, backtrack by one */
+ else
+ ptr--;
+ break;
+ }
}
/* c-type comments */
case '/':
{
- c = *ptr++;
- /* let's check if the next one is an asterisk */
- if (c == '*')
- {
- comment_length= 0;
- comment_end= false;
- /* ignore everything until closing comment */
- while (c= *ptr)
+ if (bind_comment_placeholders)
{
- ptr++;
- comment_length++;
-
- if (c == '*')
- {
c = *ptr++;
- /* alas, end of comment */
- if (c == '/')
+ break;
+ }
+ else
+ {
+ c = *ptr++;
+ /* let's check if the next one is an asterisk */
+ if (c == '*')
{
- ptr++;
- comment_end= true;
- break;
+ comment_length= 0;
+ comment_end= false;
+ /* ignore everything until closing comment */
+ while (c= *ptr)
+ {
+ ptr++;
+ comment_length++;
+
+ if (c == '*')
+ {
+ c = *ptr++;
+ /* alas, end of comment */
+ if (c == '/')
+ {
+ comment_end= true;
+ break;
+ }
+ /*
+ nope, just an asterisk, not so fast, not
+ end of comment, go back one
+ */
+ else
+ ptr--;
+ }
+ }
+ /*
+ if the end of the comment was never found, we have
+ to backtrack to whereever we first started skipping
+ over the possible comment.
+ This means we will pass the statement to the database
+ to see its own fate and issue the error
+ */
+ if (!comment_end)
+ ptr -= comment_length;
}
- /*
- nope, just an asterisk, not so fast, not end of comment, go
- back one
- */
else
- ptr--;
- }
+ ptr--;
+ break;
}
- /*
- if the end of the comment was never found, we have to backtrack
- to whereever we first started skipping over the possible comment.
- This means we will pass the statement to the database to see its own
- fate and issue the error
- */
- if (!comment_end)
- ptr -= comment_length;
- }
- else
- ptr--;
- break;
}
case '`':
case '"':
@@ -488,7 +499,7 @@
}
#endif
-/*
+/*
constructs an SQL statement previously prepared with
actual values replacing placeholders
*/
@@ -498,7 +509,8 @@
STRLEN *slen_ptr,
imp_sth_ph_t* params,
int num_params,
- bool bind_type_guessing)
+ bool bind_type_guessing,
+ bool bind_comment_placeholders)
{
bool comment_end= false;
char *salloc, *statement_ptr;
@@ -590,69 +602,75 @@
/* comment detection. Anything goes in a comment */
case '-':
{
- comment_length= 1;
- comment_end= false;
- *ptr++ = *statement_ptr++;
- if (*statement_ptr == '-')
- {
- /* ignore everything until newline */
- while (*statement_ptr)
+ if (bind_comment_placeholders)
{
- comment_length++;
- *ptr++ = *statement_ptr++;
- if (*statement_ptr == '\n')
- {
- comment_end= true;
+ *ptr++= *statement_ptr++;
break;
- }
}
- /* if comment end found, iterate past the \n */
- if (comment_end)
- {
- *ptr++ = *statement_ptr++;
- }
- /* otherwise, go back to where we started, no end found */
else
{
- statement_ptr -= comment_length;
- ptr -= comment_length;
+ comment_length= 1;
+ comment_end= false;
+ *ptr++ = *statement_ptr++;
+ if (*statement_ptr == '-')
+ {
+ /* ignore everything until newline or end of string */
+ while (*statement_ptr)
+ {
+ comment_length++;
+ *ptr++ = *statement_ptr++;
+ if (!*statement_ptr || *statement_ptr == '\n')
+ {
+ comment_end= true;
+ break;
+ }
+ }
+ /* if not end of comment, go back to where we started, no end found */
+ if (! comment_end)
+ {
+ statement_ptr -= comment_length;
+ ptr -= comment_length;
+ }
+ }
+ break;
}
- }
- break;
}
/* c-type comments */
case '/':
{
- comment_length= 1;
- comment_end= false;
- *ptr++ = *statement_ptr++;
- if (*statement_ptr == '*')
- {
- /* use up characters everything until newline */
- while (*statement_ptr)
+ if (bind_comment_placeholders)
{
- *ptr++ = *statement_ptr++;
- comment_length++;
- if (!strncmp(statement_ptr, "*/", 2))
- {
- comment_length += 2;
- comment_end= true;
+ *ptr++= *statement_ptr++;
break;
- }
- }
- /* iterate past the comment end */
- if (comment_end)
- {
- *ptr++ = *statement_ptr++;
- *ptr++ = *statement_ptr++;
}
else
{
- statement_ptr -= comment_length;
- ptr -= comment_length;
+ comment_length= 1;
+ comment_end= false;
+ *ptr++ = *statement_ptr++;
+ if (*statement_ptr == '*')
+ {
+ /* use up characters everything until newline */
+ while (*statement_ptr)
+ {
+ *ptr++ = *statement_ptr++;
+ comment_length++;
+ if (!strncmp(statement_ptr, "*/", 2))
+ {
+ comment_length += 2;
+ comment_end= true;
+ break;
+ }
+ }
+ /* Go back to where started if comment end not found */
+ if (! comment_end)
+ {
+ statement_ptr -= comment_length;
+ ptr -= comment_length;
+ }
+ }
+ break;
}
- }
- break;
}
case '`':
case '\'':
@@ -716,7 +734,7 @@
}
/* (note this sets *end, which we use if is_num) */
- if( parse_number(valbuf, vallen, &end) != 0 && is_num)
+ if ( parse_number(valbuf, vallen, &end) != 0 && is_num)
{
if (bind_type_guessing) {
/* .. not a number, so apparerently we guessed wrong */
@@ -1705,13 +1723,21 @@
"imp_dbh->use_mysql_use_result: %d\n",
imp_dbh->use_mysql_use_result);
}
- if ((svp = hv_fetch(hv, "mysql_bind_type_guessing", 24, FALSE)) && *svp)
+ if ((svp = hv_fetch(hv, "mysql_bind_type_guessing", 24, TRUE)) && *svp)
{
imp_dbh->bind_type_guessing= SvTRUE(*svp);
if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
PerlIO_printf(DBILOGFP,
"imp_dbh->bind_type_guessing: %d\n",
imp_dbh->bind_type_guessing);
+ }
+ if ((svp = hv_fetch(hv, "mysql_bind_comment_placeholders", 31, FALSE)) && *svp)
+ {
+ imp_dbh->bind_comment_placeholders = SvTRUE(*svp);
+ if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
+ PerlIO_printf(DBILOGFP,
+ "imp_dbh->bind_comment_placeholders: %d\n",
+ imp_dbh->bind_comment_placeholders);
}
if ((svp = hv_fetch(hv, "mysql_no_autocommit_cmd", 23, FALSE)) && *svp)
{
@@ -1991,7 +2017,8 @@
imp_dbh->stats.auto_reconnects_ok= 0;
imp_dbh->stats.auto_reconnects_failed= 0;
- imp_dbh->bind_type_guessing= FALSE;
+ imp_dbh->bind_type_guessing= TRUE;
+ imp_dbh->bind_comment_placeholders= FALSE;
imp_dbh->has_transactions= TRUE;
/* Safer we flip this to TRUE perl side if we detect a mod_perl env. */
imp_dbh->auto_reconnect = FALSE;
@@ -2322,6 +2349,8 @@
imp_dbh->no_autocommit_cmd= SvTRUE(valuesv);
else if (kl == 24 && strEQ(key,"mysql_bind_type_guessing"))
imp_dbh->bind_type_guessing = SvTRUE(valuesv);
+ else if (kl == 31 && strEQ(key,"mysql_bind_comment_placeholders"))
+ imp_dbh->bind_type_guessing = SvTRUE(valuesv);
#if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION
else if (kl == 17 && strEQ(key, "mysql_enable_utf8"))
imp_dbh->enable_utf8 = bool_value;
@@ -2401,7 +2430,14 @@
case 'b':
if (kl == strlen("bind_type_guessing") &&
strEQ(key, "bind_type_guessing"))
+ {
result = sv_2mortal(newSViv(imp_dbh->bind_type_guessing));
+ }
+ else if (kl == strlen("bind_comment_placeholders") &&
+ strEQ(key, "bind_comment_placeholders"))
+ {
+ result = sv_2mortal(newSViv(imp_dbh->bind_comment_placeholders));
+ }
break;
case 'e':
if (strEQ(key, "errno"))
@@ -2758,9 +2794,11 @@
#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION
/* Count the number of parameters (driver, vs server-side) */
if (imp_sth->use_server_side_prepare == 0)
- DBIc_NUM_PARAMS(imp_sth) = count_params(statement);
-#else
- DBIc_NUM_PARAMS(imp_sth) = count_params(statement);
+ DBIc_NUM_PARAMS(imp_sth) = count_params(statement,
+ imp_dbh->bind_comment_placeholders);
+#else
+ DBIc_NUM_PARAMS(imp_sth) = count_params(statement,
+ imp_dbh->bind_comment_placeholders);
#endif
/* Allocate memory for parameters */
@@ -3012,7 +3050,8 @@
int use_mysql_use_result
)
{
- bool bind_type_guessing= 0;
+ bool bind_type_guessing= TRUE;
+ bool bind_comment_placeholders= TRUE;
STRLEN slen;
char *sbuf = SvPV(statement, slen);
char *table;
@@ -3033,14 +3072,15 @@
if/else (when compiled, it fails for imp_dbh not being defined).
*/
/* h is a dbh */
- if (htype==DBIt_DB)
+ if (htype == DBIt_DB)
{
D_imp_dbh(h);
/* if imp_dbh is not available, it causes segfault (proper) on OpenBSD */
if (imp_dbh && imp_dbh->bind_type_guessing)
+ {
bind_type_guessing= imp_dbh->bind_type_guessing;
- else
- bind_type_guessing= 0;
+ bind_comment_placeholders= bind_comment_placeholders;
+ }
}
/* h is a sth */
else
@@ -3049,9 +3089,10 @@
D_imp_dbh_from_sth;
/* if imp_dbh is not available, it causes segfault (proper) on OpenBSD */
if (imp_dbh)
+ {
bind_type_guessing= imp_dbh->bind_type_guessing;
- else
- bind_type_guessing=0;
+ bind_comment_placeholders= imp_dbh->bind_comment_placeholders;
+ }
}
if (DBIc_TRACE_LEVEL(imp_xxh) >= 2)
@@ -3063,7 +3104,8 @@
&slen,
params,
num_params,
- bind_type_guessing);
+ bind_type_guessing,
+ bind_comment_placeholders);
if (salloc)
{
@@ -4912,7 +4954,8 @@
}
else if (!isdigit(*cp))
{
- seen_digit= 1;
+ /* Not sure why this was changed */
+ /* seen_digit= 1; */
break;
}
}
@@ -4920,7 +4963,9 @@
*end= cp;
/* length 0 -> not a number */
- if (len == 0 || cp - string < (int) len || seen_digit == 0) {
+ /* Need to revisit this */
+ /*if (len == 0 || cp - string < (int) len || seen_digit == 0) {*/
+ if (len == 0 || cp - string < (int) len) {
return -1;
}
Modified: branches/upstream/libdbd-mysql-perl/current/dbdimp.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/dbdimp.h?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/dbdimp.h (original)
+++ branches/upstream/libdbd-mysql-perl/current/dbdimp.h Sat Jul 10 12:25:38 2010
@@ -154,6 +154,7 @@
unsigned int auto_reconnects_failed;
} stats;
unsigned short int bind_type_guessing;
+ bool bind_comment_placeholders;
unsigned short int no_autocommit_cmd;
int use_mysql_use_result; /* TRUE if execute should use
* mysql_use_result rather than
Modified: branches/upstream/libdbd-mysql-perl/current/lib/DBD/mysql.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/lib/DBD/mysql.pm?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/lib/DBD/mysql.pm (original)
+++ branches/upstream/libdbd-mysql-perl/current/lib/DBD/mysql.pm Sat Jul 10 12:25:38 2010
@@ -9,7 +9,7 @@
use Carp ();
@ISA = qw(DynaLoader);
-$VERSION = '4.014';
+$VERSION = '4.015';
bootstrap DBD::mysql $VERSION;
@@ -1296,6 +1296,16 @@
See bug: https://rt.cpan.org/Ticket/Display.html?id=43822
+=item mysql_bind_comment_placeholders
+
+This attribute causes the driver (emulated prepare statements)
+will cause any placeholders in comments to be bound. This is
+not correct prepared statement behavior, but some developers
+have come to depend on this behavior, so I have made it available
+in 4.015
+
+See bug: https://rt.cpan.org/Ticket/Display.html?id=
+
C<mysql_bind_type_guessing> can be turned on via
- through DSN
Modified: branches/upstream/libdbd-mysql-perl/current/t/40blobs.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/t/40blobs.t?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/t/40blobs.t (original)
+++ branches/upstream/libdbd-mysql-perl/current/t/40blobs.t Sat Jul 10 12:25:38 2010
@@ -34,14 +34,16 @@
eval {$dbh = DBI->connect($test_dsn, $test_user, $test_password,
{ RaiseError => 1, AutoCommit => 1}) or ServerError() ;};
+if ($@) {
+ plan skip_all => "ERROR: $DBI::errstr. Can't continue test";
+}
+else {
+ plan tests => 14;
+}
+
if ($dbh->get_info($GetInfoType{SQL_DBMS_VER}) lt "4.1") {
$charset= '';
}
-
-if ($@) {
- plan skip_all => "ERROR: $DBI::errstr. Can't continue test";
-}
-plan tests => 14;
my $size= 128;
Modified: branches/upstream/libdbd-mysql-perl/current/t/52comment.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/t/52comment.t?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/t/52comment.t (original)
+++ branches/upstream/libdbd-mysql-perl/current/t/52comment.t Sat Jul 10 12:25:38 2010
@@ -12,13 +12,17 @@
use vars qw($test_dsn $test_user $test_password $table);
my $dbh;
-eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
- { RaiseError => 1, PrintError => 1, AutoCommit => 0 });};
+eval { $dbh= DBI->connect($test_dsn, $test_user, $test_password,
+ { RaiseError => 1,
+ PrintError => 1,
+ AutoCommit => 0, }
+ );
+ };
if ($@) {
plan skip_all =>
"ERROR: $DBI::errstr. Can't continue test";
}
-plan tests => 9;
+plan tests => 30;
ok $dbh->do("DROP TABLE IF EXISTS $table"), "drop table if exists $table";
@@ -56,6 +60,26 @@
$retrow= $dbh->selectrow_arrayref($statement, {}, 1);
cmp_ok $retrow->[0], '==', 1;
+$statement= "SELECT id FROM $table WHERE id = ? /* it's a bug? */";
+
+$retrow= $dbh->selectrow_arrayref($statement, {}, 1);
+cmp_ok $retrow->[0], '==', 1;
+
+$statement= "SELECT id FROM $table WHERE id = ? ";
+my $comment = "/* it's/a_directory/does\ this\ work/bug? */";
+
+for (0 .. 9) {
+ $retrow= $dbh->selectrow_arrayref($statement . $comment, {}, 1);
+ cmp_ok $retrow->[0], '==', 1;
+}
+
+$comment = "/* $0 */";
+
+for (0 .. 9) {
+ $retrow= $dbh->selectrow_arrayref($statement . $comment, {}, 1);
+ cmp_ok $retrow->[0], '==', 1;
+}
+
ok $dbh->do("DROP TABLE IF EXISTS $table"), "drop table if exists $table";
ok $dbh->disconnect;
Added: branches/upstream/libdbd-mysql-perl/current/t/53comment.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/t/53comment.t?rev=60187&op=file
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/t/53comment.t (added)
+++ branches/upstream/libdbd-mysql-perl/current/t/53comment.t Sat Jul 10 12:25:38 2010
@@ -1,0 +1,82 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use DBI;
+use DBI::Const::GetInfoType;
+use Test::More;
+use lib 't', '.';
+require 'lib.pl';
+
+use vars qw($test_dsn $test_user $test_password $table);
+
+my $dbh;
+eval { $dbh= DBI->connect($test_dsn, $test_user, $test_password,
+ { RaiseError => 1,
+ PrintError => 1,
+ AutoCommit => 0,
+ mysql_bind_comment_placeholders => 1,}
+ );
+ };
+if ($@) {
+ plan skip_all =>
+ "ERROR: $DBI::errstr, $@. Can't continue test";
+}
+plan tests => 29;
+
+ok $dbh->do("DROP TABLE IF EXISTS $table"), "drop table if exists $table";
+
+my $create= <<"EOTABLE";
+create table $table (
+ id bigint unsigned not null default 0
+ )
+EOTABLE
+
+
+ok $dbh->do($create), "creating table";
+
+my $statement= "insert into $table (id) values (?)";
+
+my $sth;
+ok $sth= $dbh->prepare($statement);
+
+my $rows;
+ok $rows= $sth->execute('1');
+cmp_ok $rows, '==', 1;
+$sth->finish();
+
+$statement= <<EOSTMT;
+SELECT id
+FROM $table
+-- this comment has ? in the text
+WHERE id = ?
+EOSTMT
+
+my $retrow= $dbh->selectrow_arrayref($statement, {}, 'hey', 1);
+cmp_ok $retrow->[0], '==', 1;
+
+$statement= "SELECT id FROM $table /* Some value here ? */ WHERE id = ?";
+
+$retrow= $dbh->selectrow_arrayref($statement, {}, "hello", 1);
+cmp_ok $retrow->[0], '==', 1;
+
+$statement= "SELECT id FROM $table WHERE id = ? ";
+my $comment = "/* it's/a_directory/does\ this\ work/bug? */";
+$statement= $statement . $comment;
+
+for (0 .. 9) {
+ $retrow= $dbh->selectrow_arrayref($statement, {}, 1);
+ cmp_ok $retrow->[0], '==', 1;
+}
+
+$comment = "/* $0 */";
+
+for (0 .. 9) {
+ $retrow= $dbh->selectrow_arrayref($statement . $comment, {}, 1);
+ cmp_ok $retrow->[0], '==', 1;
+}
+
+ok $dbh->do("DROP TABLE IF EXISTS $table"), "drop table if exists $table";
+
+ok $dbh->disconnect;
Propchange: branches/upstream/libdbd-mysql-perl/current/t/53comment.t
------------------------------------------------------------------------------
svn:executable = *
Modified: branches/upstream/libdbd-mysql-perl/current/t/mysql.mtest
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdbd-mysql-perl/current/t/mysql.mtest?rev=60187&op=diff
==============================================================================
--- branches/upstream/libdbd-mysql-perl/current/t/mysql.mtest (original)
+++ branches/upstream/libdbd-mysql-perl/current/t/mysql.mtest Sat Jul 10 12:25:38 2010
@@ -7,9 +7,9 @@
'testhost' => '',
'nofoundrows' => 0,
'testdb' => 'test',
- 'cflags' => '-I/usr/local/maria/include/mysql -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL',
- 'testuser' => 'root',
- 'testpassword' => '',
+ 'cflags' => '-I/usr/local/maria/include/mysql -g -g -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL',
+ 'testuser' => 'patg',
+ 'testpassword' => 'patg',
'testsocket' => ''
};
$::test_host = $opt->{'testhost'};
More information about the Pkg-perl-cvs-commits
mailing list