16 messages in com.mysql.lists.perlRe: Unable to prepare statement with ...| From | Sent On | Attachments |
|---|---|---|
| Patrik Jansson | 14 Nov 2006 04:15 | |
| Kenny Scott | 14 Nov 2006 04:23 | |
| Patrik Jansson | 14 Nov 2006 04:36 | |
| Kenny Scott | 14 Nov 2006 04:38 | |
| Patrik Jansson | 14 Nov 2006 04:47 | |
| Kenny Scott | 14 Nov 2006 04:59 | |
| Patrik Jansson | 14 Nov 2006 05:08 | |
| Kenny Scott | 14 Nov 2006 05:12 | |
| Patrik Jansson | 14 Nov 2006 05:25 | .pl |
| Kenny Scott | 14 Nov 2006 05:45 | |
| Patrik Jansson | 14 Nov 2006 05:55 | |
| Mikael Fridh | 14 Nov 2006 05:59 | |
| Patrik Jansson | 14 Nov 2006 06:17 | |
| Simon Rees | 14 Nov 2006 08:37 | |
| Harald Fuchs | 14 Nov 2006 08:38 | |
| Patrik Jansson | 14 Nov 2006 23:56 |
| Subject: | Re: Unable to prepare statement with underscore![]() |
|---|---|
| From: | Patrik Jansson (fb...@aleborg.se) |
| Date: | 11/14/2006 04:36:12 AM |
| List: | com.mysql.lists.perl |
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
-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......





.pl