Re: Unable to prepare statement with underscore
Kenny Scott <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Patrik Jansson wrote: > Hi Kenny > Thanks for the answer, > > Code: > my $query = "GRANT ALL PRIVILEGES ON user\_abcd.* TO > 'user_abcd'\@'192.168.2.1' IDENTIFIED BY 'password'; > Printing the string gives: > GRANT ALL PRIVILEGES ON user_abcd.* TO 'user_abcd'@'192.168.2.1' > IDENTIFIED BY 'password' > And the result: > DO: Something wrong while try to prepare query This command is not > supported in the prepared statement protocol yet > Hi Patrik, It works for me using MySQL 5.0.24, libdbd 3.0007. What versions are you using? -- Kenny > -Patrik > > Kenny Scott skrev: >> 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...... >> -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]