Top "Prepared-statement" questions

A Prepared Statement (or parameterized statement) is a precompiled SQL statement that serves to improve performance and mitigate SQL injection attacks.

Why affected_rows always returns -1?

I seem to have problem getting affected_rows when I INSERT and SELECT, it just returns -1 for some reason? …

php mysqli prepared-statement rows-affected
stored procedures as queries: CallableStatement vs. PreparedStatement

PostgreSQL documentation recommends using a CallableStatement to call stored procedures. In the case of a stored procedure that returns a …

postgresql stored-procedures jdbc prepared-statement callable-statement
multiple sql statements in QSqlQuery using the sqlite3 driver

I have a file containing several SQL statements that I'd like to use to initialize a new sqlite3 database file. …

qt sqlite qt4 prepared-statement qtsql
When *not* to use prepared statements?

I'm re-engineering a PHP-driven web site which uses a minimal database. The original version used "pseudo-prepared-statements" (PHP functions which did …

php mysql pdo prepared-statement
Why does SQLite give a "database is locked" for a second query in a transaction when using Perl's DBD::SQLite?

Is there a known problem with SQLite giving a "database is locked" error for a second query in a single …

perl sqlite prepared-statement dbi dbd
SqlCommand.Prepare method requires all parameters to have an explicitly set type

I have the following snippet of code in my WCF web service that builds a set of where conditions according …

c# tsql prepared-statement sqlcommand
Can PreparedStatement's 'setObject' method be used for any datatype?

Can the PreparedStatement's .setObject method be used for any data type (String, Integer, Double, Date, DateTime, Byte Array, etc.) supported …

java mysql jdbc prepared-statement
Prepared Statement syntax for ON DUPLICATE KEY UPDATE (number of params error)

Here is what I am trying to do. I want to insert into this table or update the record if …

java mysql sql-update prepared-statement on-duplicate-key
Dynamically bind mysqli_stmt parameters and then bind result (PHP)

I'm trying to dynamically bind mysql_stmt parameters and get the result in an associative array. I've found this post …

php dynamic prepared-statement sqlbindparameter
In JDBC, why do parameter indexes for prepared statements begin at 1 instead of 0?

Everywhere else in Java, anything with an index starts at 0. Is there a reason for the change here or is …

java jdbc indexing prepared-statement