prepare
() with execute
()x::sql::statement stmt= conn->execute("INSERT INTO books(name, price) VALUES(?, ?)", "Around the world in 80 days", 9.99);
A connection handle's
execute
() method combines
prepare
() with an
execute
() on the resulting statement handle.
If desired, the connection handle's
execute
() also returns the resulting
statement handle, already execute
()d.
The first parameter to a connection handle's
execute
() method is an SQL statement
that gets forwarded to prepare
(), the remaining
parameters, if any are forwarded to the statement handle's
execute
(), as is.
This also applies when the SQL statement is a SELECT
.
try { auto stmt=conn->execute_vector("insert into videos(titles, prices) values(?, ?)", status, titles, prices); } catch (...) { // ... } if (!(status[0] & 1) || !(status[1] & 1))
Calling a connection handle's execute_vector
()
is equivalent to calling
prepare
(),
then passing the remaining argument to
the new statement handle's
execute_vector
().