Re: Fw: Syntax error when inserting strings into a table

[email protected] ("Greg Sabino Mullane")
Newsgroups perl.dbd.pg
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> my $stmt_resultset = $this->{db_handler}->prepare_cached("insert into
> resultset(session_id, query_
> +id, uri, domain, rank) values(?,?,?,?,?)");
...
> $success &&= $stmt_resultset->execute($session_id,$query_id,
> $this->{db_handler}->quote($result),$this->{db_handler}->quote($param4),$i+1
...
> Has anyone an idea what the cause of this error might be - how to fix it?

If you are using placeholders (the '?' signs), then you do not need to use
the quote() method - it is done for you. You need to pick one or the other.
Generally, placeholders are better to use. The line above should simply
read:

$stmt_rsultset->execute($session_id,$query_id,$result,$param4,$i+1);

- --
Greg Sabino Mullane [email protected]
PGP Key: 0x14964AC8 200611130110
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFFWAxnvJuQZxSWSsgRAvNcAKC6/B9CmFwoEBh5kTH3HP+wceAygACgyiAx
YbhJePFb8BhSUbgpOQ6g7Oc=
=n4yz
-----END PGP SIGNATURE-----
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.