Re: Unable to prepare statement with underscore

Patrik Jansson <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
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......
>

-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.