Hi Meir,
Remember that the process of changing the ? placeholders to actual variables
is called "binding".. and that can go wrong if for example you have 4 ?
placeholders
and provide 3 values or you have 0 ? and provide 3 values.
Because of your missing a backquote you effectively got an SQL stat
Hi Rajeev,
$baz is a variable that gets substituted for the ? in the prepare
statement, between the $dbh->prepare() and the $sth->execute.
So it's really:
$sth = $dbh->prepare("SELECT foo, bar FROM table WHERE baz=?");
... extra lines here... calculating $baz
$sth->execute( $baz );
Read a bit
Hi Damian,
> my $first_line = `grep -v '#' $filename|head -n 1`; # to get the first
> non-comment line
> the shell which is invoked inherits the SIGPIPE = 'IGNORE' state. This
> causes a
> grep: writing output: Broken pipe
> error as the grep tries to write to the head process which has exited.
> First off, I had no idea it existed until I started going through a dbi
> tutorial. The idea is you don't have to litter your code with "or
> die..." statements.
> Is it good practice to use this or is an explicit "or die..." better
> because you can "see" there is error trapping?
I think setti
/usr/bin/perl -MCPAN -e 'install "DBI"'
it downloads the new module, builds everything, and then starts running
the make test portion of the install. During this process, I get the
following output (after a bunch of other successful tests):
/usr/bin/make test -- NOT OK
Running make insta
Sometimes it's desirable to first to a SELECT to see if a row exists,
and then INSERT if it doesn't already, or UPDATE if it does.
MySQL's got a really handy 'REPLACE INTO' for just this circumstance,
some have suggested that PostgreSQL should support this in future.
Your solution looks good.
does DBD::mysql (or the MySQL API for that matter) support random
access to BLOB types ? i.e. the ability to select/insert
a BLOB via a serious of small queries, as opposed to the
memory intensive approach of selecting/inserting the total
contents of the column in one query.
It's unlikely that a
Ok now coming to the problem. Can someone explain to me that what this
script is doing. I want to know the meaning of all the lines in the
script.
$val = defined $val ? $val : "null";
$val =~ s/\'/$& x 2/eg; # double pad single
quote character
> I saw on the web that the Oracle array interface has not been implemented
> properly. I am new to DBI. Has the implementation been made more efficient?
Would you care to provide a reference (URL) to justify the assertion?
http://www.dba-oracle.com/t_dbi_perl_connecting.htm
Concluding quote