Escape characters handled differently between mysql and DBD:mysql ???

Escape characters handled differently between mysql and DBD:mysql ???

am 12.01.2005 22:01:26 von David Jacopille

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'm sure this is literally what's stored in the database and the mysql
application is applying a filter to deal with the escape characters that the
Perl DBI is not.

Of course I could build a regular expression to fix this regular expression
- but does anyone know how to just get the Perl DBI to handle the escape
characters with a bit more savvy?

Thanks,
David Jacopille


"MFS Relay Service" made the following
annotations on 01/12/2005 04:07:50 PM
------------------------------------------------------------ ------------------
This email communication and any attachments may contain proprietary, confidential, or privileged information. If you are not the intended recipient, you are hereby notified that you have received this email in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited. The sender does not waive confidentiality or any privilege by mistransmission. If you have received this email in error, please notify the sender immediately, delete this email, and destroy all copies and any attachments.
============================================================ ==================


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Escape characters handled differently between mysql and DBD: mysql ???

am 13.01.2005 14:11:53 von Garry Williams

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->se lectrow_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/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org