Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: mySQL Query Problem

by gmax (Abbot)
on Feb 11, 2003 at 21:01 UTC ( #234527=note: print w/ replies, xml ) Need Help??


in reply to mySQL Query Problem

I could not replicate your problem.
I am using Perl 5.6.1, DBI 1.30 and DBD::mysql 2.1018

#!/usr/bin/perl -w use strict; use DBI; my $dbh = DBI->connect("DBI:mysql:test;host=localhost;" ."mysql_read_default_file=$ENV{HOME}/.my.cnf", undef,undef,{RaiseError => 1}); $dbh->do(qq{drop table if exists testq}); $dbh->do(qq{create table testq (i int not null, c varchar(50))}); my $sth= $dbh->prepare(qq{insert into testq values (?, ?)}); my $i = 10; my $msg = 'tengo todo por aprender ¿quien quiere enseñarme?'; $sth->execute($i, $msg); my @results = @{ $dbh->selectall_arrayref(qq{select * from testq})}; print "@$_\n" for @results; $dbh->disconnect();
This code accepts the variable, inserts it into the table and retrieves the values correctly.
Can you make a simple test case, with appropriate values, so that we can evaluate what is wrong?
Use the above code as a template.


update 12-Feb-2003 17:50 CET
Tested the above code with DBD::mysqlPP and it works as well.
Just replace the connection string with the following.
my $dbh = DBI->connect("DBI:mysqlPP:test;host=localhost;", "gmax","mysecretpwd",{RaiseError => 1});
Therefore, the placeholder mechanism is not the culprit.

update 2
The mistake is in the DBD::mysqlPP driver. Check the Changelog. Versions prior to 0.04 are affected by a quoting bug, which was corrected 20 days ago!
So, after all, the culprit was the placeholder mechanism. Just update your copy of DBD::mysqlPP
_ _ _ _ (_|| | |(_|>< _|


Comment on Re: mySQL Query Problem
Select or Download Code
Replies are listed 'Best First'.
Re: Re: mySQL Query Problem
by kidd (Curate) on Feb 12, 2003 at 15:17 UTC
    Hello...

    Im sorry I made a major mistake...the module Im using is DBD::mysqlPP, the reason Im using the module is that my client's hosting service refuses to install the DBD::mysql module...

    Anyway I wanted to say thanks for your answers and sorry for not been clear since the begining...

    I tried to look for a new version of this module but it seems that I already have the newest one..I hope someone can help me sort this out...

    Thank

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://234527]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2015-07-29 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls