Executes the prepared statement with the given params
.
Executes the prepared statement with the given params
.
Note: this is a lower-level API. For SELECT queries, prefer using select or read, and use modify for DML (INSERT/UPDATE/DELETE) and DDL.
For Scala users, you can use the implicit conversions to Parameter
by importing Parameter._
. For example:
import com.twitter.finagle.mysql.{Client, PreparedStatement, Result} import com.twitter.finagle.mysql.Parameter._ import com.twitter.util.Future val client: Client = ??? val preparedStatement: PreparedStatement = client.prepare("INSERT INTO a_table (column1, column2) VALUES (?, ?)") // note the implicit conversions of the String and Int to Parameters val result: Future[Result] = preparedStatement("value1", 1234)
Java users, see asJava and use PreparedStatement.AsJava.execute.
Provides a Java-friendly API for this PreparedStatement.
Executes the prepared statement DML (e.g.
Executes the prepared statement DML (e.g. INSERT/UPDATE/DELETE) or DDL
(e.g. CREATE TABLE, DROP TABLE, COMMIT, START TRANSACTION, etc) with the
given params
.
For Scala users, you can use the implicit conversions to Parameter
by importing Parameter._
. For example:
import com.twitter.finagle.mysql.{Client, OK, PreparedStatement} import com.twitter.finagle.mysql.Parameter._ import com.twitter.util.Future val client: Client = ??? val preparedStatement: PreparedStatement = client.prepare("INSERT INTO a_table (column1, column2) VALUES (?, ?)") // note the implicit conversions of the String and Int to Parameters val ok: Future[OK] = preparedStatement.modify("value1", 1234)
Java users, see asJava and use PreparedStatement.AsJava.modify.
Executes the prepared statement SELECT query with the given params
.
Executes the prepared statement SELECT query with the given params
.
For Scala users, you can use the implicit conversions to Parameter
by importing Parameter._
. For example:
import com.twitter.finagle.mysql.{Client, PreparedStatement, ResultSet} import com.twitter.finagle.mysql.Parameter._ import com.twitter.util.Future val client: Client = ??? val preparedStatement: PreparedStatement = client.prepare("SELECT column1 FROM a_table WHERE column2 = ? AND column3 = ?)") // note the implicit conversions of the String and Int to Parameters val resultSet: Future[ResultSet] = preparedStatement.read("value1", 1234)
Java users, see asJava and use PreparedStatement.AsJava.read.
Executes the prepared statement with the given params
and maps f
to the
rows of the returned ResultSet.
Executes the prepared statement with the given params
and maps f
to the
rows of the returned ResultSet. If no ResultSet is returned, the function
returns an empty Seq
.
For Scala users, you can use the implicit conversions to Parameter
by importing Parameter._
. For example:
import com.twitter.finagle.mysql.{Client, PreparedStatement, StringValue} import com.twitter.finagle.mysql.Parameter._ import com.twitter.util.Future val client: Client = ??? val preparedStatement: PreparedStatement = client.prepare("SELECT column1 FROM a_table WHERE column2 = ?") // note the implicit conversion of the Int, 1234, into a Parameter val result: Future[Seq[String] = preparedStatement.select(1234) { row => row.stringOrNull("column1") }
Java users, see asJava and use PreparedStatement.AsJava.select.
A
PreparedStatement
represents a parameterized SQL statement which may be applied concurrently with varying parameters.These are SQL statements with
?
's used for the parameters which are "filled in" per usage byread
,select
, andmodify
.CursoredStatement for a lazy stream of Rows.
Client.prepare(String)