Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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
_ _ _ _ (_|| | |(_|>< _|

In reply to Re: mySQL Query Problem by gmax
in thread mySQL Query Problem by kidd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-03-28 20:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found