Re: Unable to prepare statement with underscore
Kenny Scott <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Patrik Jansson wrote: > I'm trying to run the following statement: GRANT ALL PRIVILEGES ON > user\_abcd.* TO 'user_abcd'@'192.168.2.1' IDENTIFIED BY 'password' > > This is the code: > > my $query = "GRANT ALL PRIVILEGES ON user\\_abcd.* TO > 'user_abcd'\@'192.168.2.1' IDENTIFIED BY 'password'"; > > print $query; $dbh->do($query); > > But I get the error: DO: Something wrong while try to prepare query > You have an error in your SQL syntax; check the manual that > corresponds to your MySQL server version for the right syntax to use > near '\_abcd.* TO 'user_abcd'@'192.168.2.1' IDENTIFIED BY 'password'' > at line 1 > > If I run the exact same command directly with the mysql client I get > no error at all. > > What am I doing wrong or doesn't the DBD handle underscores in > database names? Hi Patrik, Remove one of the \ characters in the $query variable: GRANT ALL PRIVILEGES ON user\_abcd.* TO...... -- Kenny -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]