Re: Escape characters handled differently between mysql and DBD: mysql ???
Garry Williams <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Organization | Zvolve Systems, Inc., Atlanta, Georgia |
| Message-ID | <[email protected]> |
On Wed, Jan 12, 2005 at 16:01:26 -0500, David Jacopille wrote:
> I've used INSERT to load the following string exactly as shown with the
> double backslashes:
>
> (.+)\\.[0-9A-Z]+(\\.pdf)$
>
> When issuing a SELECT statement directly in mysql from a terminal window I
> get exactly the regular expression I want and would expect:
>
> (.+)\.[0-9A-Z]+(\.pdf)$
>
> When issuing the same select statement in a Perl script using DBI and
> DBD::mysql I get the double backslash plus an extra bonus escape character
> for the $.
>
> (.+)\\.[0-9A-Z]+(\\.pdf)\$
I cannot reproduce this:
mysql> create table foo (string varchar(255));
Query OK, 0 rows affected (0.03 sec)
mysql> insert into foo (string) values('(.+)\\.[0-9A-Z]+(\\.pdf)$');
Query OK, 1 row affected (0.00 sec)
mysql> select * from foo;
+-------------------------+
| string |
+-------------------------+
| (.+)\.[0-9A-Z]+(\.pdf)$ |
+-------------------------+
1 row in set (0.03 sec)
mysql> Bye
$ perl -MDBI -wle '$dbh=DBI->connect("dbi:mysql:test:localhost");($s)=$dbh->selectrow_array("select * from foo");print $s'
(.+)\.[0-9A-Z]+(\.pdf)$
$ mysql --version
mysql Ver 12.22 Distrib 4.0.20, for mandrake-linux-gnu (i586)
$ mysqld --version
mysqld Ver 4.0.20 for mandrake-linux-gnu on i586 (Source distribution)
$ perl -MDBI -le 'print $DBI::VERSION'
1.43
$ perl -MDBD::mysql -le 'print $DBD::mysql::VERSION'
2.0419
$
--
Garry Williams, Zvolve Systems, Inc., +1 770 813-4934
Cell: +1 404 353-2983
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/[email protected]