package mysql
- Alphabetic
- By Inheritance
- mysql
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- class BigIntTooLongException extends Exception
- case class BigIntValue(bi: BigInt) extends Value with Product with Serializable
- case class ByteValue(b: Byte) extends Value with Product with Serializable
- trait CanBeParameter[-A] extends AnyRef
- case class Capability(mask: Int) extends Product with Serializable
-
trait
Client extends Closable
A MySQL client that is not
Service-based like com.twitter.finagle.Mysql.Client is, making it easier to use for most cases.A MySQL client that is not
Service-based like com.twitter.finagle.Mysql.Client is, making it easier to use for most cases.Creation:
import com.twitter.finagle.Mysql import com.twitter.finagle.mysql.Client val client: Client = Mysql.client .withCredentials("username", "password") .withDatabase("database") .newRichClient("host:port")
Example: -
case class
CloseRequest(stmtId: Int) extends CommandRequest with Product with Serializable
A CloseRequest deallocates a prepared statement on the server.
A CloseRequest deallocates a prepared statement on the server. No response is sent back to the client. https://dev.mysql.com/doc/internals/en/com-stmt-close.html
-
class
ColumnNotFoundException extends SQLNonTransientException with FailureFlags[ColumnNotFoundException]
Indicates the requested column name was not found.
-
abstract
class
CommandRequest extends Request
A command request is a request initiated by the client and has a cmd byte associated with it.
-
trait
CursorResult[T] extends Closable
A closable async stream of projected rows from a CursoredStatement.
-
trait
CursoredStatement extends AnyRef
A
CursoredStatementrepresents a parameterized SQL statement applied concurrently with varying parameters and yields a lazy stream of rows.A
CursoredStatementrepresents a parameterized SQL statement applied concurrently with varying parameters and yields a lazy stream of rows.These are SQL statements with
?'s used for the parameters which are "filled in" per usage byapply.- See also
Client.cursor(String
PreparedStatement for eager processing of Rows.
-
trait
Decoder[T <: Result] extends (Packet) ⇒ Try[T]
A decoder for Results contained in a single packet.
- case class DoubleValue(d: Double) extends Value with Product with Serializable
- case class EOF(warnings: Short, serverStatus: ServerStatus) extends Result with Product with Serializable
- case class Error(code: Short, sqlState: String, message: String) extends Result with Product with Serializable
-
class
ExecuteRequest extends CommandRequest
Uses the binary protocol to build an execute request for a prepared statement.
Uses the binary protocol to build an execute request for a prepared statement. https://dev.mysql.com/doc/internals/en/com-stmt-execute.html
- class FetchRequest extends CommandRequest
- case class FetchResult(rowPackets: Seq[Packet], containsLastRow: Boolean) extends Result with Product with Serializable
- case class Field(catalog: String, db: String, table: String, origTable: String, name: String, origName: String, charset: Short, displayLength: Int, fieldType: Short, flags: Short, decimals: Byte) extends Result with Product with Serializable
- case class FloatValue(f: Float) extends Value with Product with Serializable
- case class HandshakeInit(protocol: Byte, version: String, threadId: Int, salt: Array[Byte], serverCapabilities: Capability, charset: Short, status: Short) extends Result with Product with Serializable
-
class
IncompatibleServerError extends Exception
A base class for exceptions related to client incompatibility with an upstream MySQL server.
- case class IntValue(i: Int) extends Value with Product with Serializable
- sealed trait IsolationLevel extends AnyRef
- case class LongValue(l: Long) extends Value with Product with Serializable
-
final
case class
LostSyncException(underlying: Throwable) extends RuntimeException with Product with Serializable
A LostSyncException indicates that this finagle-mysql client and the MySQL server are no longer able to properly communicate, as there has been a failure to decode a message from the server or data has become corrupted in transmission.
A LostSyncException indicates that this finagle-mysql client and the MySQL server are no longer able to properly communicate, as there has been a failure to decode a message from the server or data has become corrupted in transmission. It is a fatal error and the communication with the server must be closed, then reopened, and renegotiated.
-
case class
OK(affectedRows: Long, insertId: Long, serverStatus: Int, warningCount: Int, message: String) extends Result with Product with Serializable
Represents the OK Packet received from the server.
Represents the OK Packet received from the server. It is sent to indicate that a command (e.g. PreparedStatement.modify) has completed successfully.
- affectedRows
how many records were changed by the command.
- insertId
the first automatically generated value successfully inserted for an AUTO_INCREMENT column for an INSERT statement.
- serverStatus
server status bit mask.
- warningCount
how many warnings were generated.
- message
the status message, which will be an empty String if none is present.
-
sealed
trait
Parameter extends AnyRef
A value of type
Acan implicitly convert to aParameterif an evidenceCanBeParameter[A]is available in scope via the Parameter.wrap or Parameter.wrapOption implicits.A value of type
Acan implicitly convert to aParameterif an evidenceCanBeParameter[A]is available in scope via the Parameter.wrap or Parameter.wrapOption implicits. Explicit conversions are available via Parameter.of and Parameters.of.A Scala example with implicits:
import com.twitter.finagle.mysql.Parameter import com.twitter.finagle.mysql.Parameter._ val p: Parameter = "this will get implicitly converted to a Parameter"
A Scala example without implicits:
import com.twitter.finagle.mysql.Parameter val p: Parameter = Parameter.of("explicitly converted to a Parameter")
A Java example:
import com.twitter.finagle.mysql.Parameter; import com.twitter.finagle.mysql.Parameters; Parameter p = Parameters.of("explicitly converted to a Parameter");
- case class PrepareOK(id: Int, numOfCols: Int, numOfParams: Int, warningCount: Int, columns: Seq[Field] = Nil, params: Seq[Field] = Nil) extends Result with Product with Serializable
-
case class
PrepareRequest(sqlStatement: String) extends SimpleCommandRequest with WithSql with Product with Serializable
Allocates a prepared statement on the server from the passed in query string.
Allocates a prepared statement on the server from the passed in query string. https://dev.mysql.com/doc/internals/en/com-stmt-prepare.html
-
trait
PreparedStatement extends AnyRef
A
PreparedStatementrepresents a parameterized SQL statement which may be applied concurrently with varying parameters.A
PreparedStatementrepresents 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.- See also
Client.prepare(String)
CursoredStatement for a lazy stream of Rows.
-
case class
QueryRequest(sqlStatement: String) extends SimpleCommandRequest with WithSql with Product with Serializable
A QueryRequest is used to send the server a text-based query that is executed immediately.
A QueryRequest is used to send the server a text-based query that is executed immediately. https://dev.mysql.com/doc/internals/en/com-query.html
-
case class
RawValue(typ: Short, charset: Short, isBinary: Boolean, bytes: Array[Byte]) extends Value with Product with Serializable
A RawValue contains the raw bytes that represent a value and enough meta data to decode the bytes.
-
sealed
trait
Request extends ProtocolMessage
A
Requestis an outgoing message sent by the client as part of the MySQL protocol.A
Requestis an outgoing message sent by the client as part of the MySQL protocol. It is packet-based and based around a MySQL command. - sealed trait Result extends AnyRef
- case class ResultSet(fields: Seq[Field], rows: Seq[Row]) extends Result with Product with Serializable
-
final
class
RollbackFactory extends ServiceFactoryProxy[Request, Result]
A
ServiceFactorythat ensures a ROLLBACK statement is issued when a service is put back into the connection pool.A
ServiceFactorythat ensures a ROLLBACK statement is issued when a service is put back into the connection pool.- See also
https://dev.mysql.com/doc/en/implicit-commit.html
-
trait
Row extends AnyRef
A
Rowallows you to extract Value's from a MySQL row.A
Rowallows you to extract Value's from a MySQL row.Column values can be accessed by the MySQL column name via the typed
xyzOrNullandgetXyzmethods. For example,stringOrNullandgetString. Theget-prefixed methods returnOptionsand useNoneto represent a SQL NULL. For SQL NULLs, theor-suffixed methods returnnullfor Object-types and use a sentinel, like 0, for primitives.Alternatively, Value's based on the column name can be accessed via the
applymethod.For example, given the query,
SELECT 'text' AS str_col, 123 AS int_col, you could extract the columns as such.First, in Scala:
import com.twitter.finagle.mysql.Row val row: Row = ??? // if the column is not null: val strCol: String = row.stringOrNull("str_col") val intCol: Int = row.intOrZero("int_col") // if the column is nullable: val strCol: Option[String] = row.getString("str_col") val intCol: Option[java.lang.Integer] = row.getInteger("int_col")
Then, the same in Java:
import com.twitter.finagle.mysql.Row; import scala.Option; Row row = ... // if the column is not null: String strCol = row.stringOrNull("str_col"); int intCol = row.intOrZero("int_col"); // if the column is nullable: Option<String> strCol = row.getString("str_col"); Option<Integer> intCol = row.getInteger("int_col");
-
case class
ServerError(code: Short, sqlState: String, message: String) extends Exception with Product with Serializable
A catch-all exception class for errors returned from the upstream MySQL server.
-
case class
ServerStatus(mask: Int) extends Product with Serializable
Represents the ServerStatus as represented in EOF packets
Represents the ServerStatus as represented in EOF packets
- mask
the raw bit mask in the EOF packet
-
trait
Session extends AnyRef
Explicitly manage the lifecycle of a MySQL session.
Explicitly manage the lifecycle of a MySQL session.
- See also
Client#session()
- case class ShortValue(s: Short) extends Value with Product with Serializable
-
class
SimpleCommandRequest extends CommandRequest
Defines a request that encodes the command byte and associated data into a packet.
- case class StringValue(s: String) extends Value with Product with Serializable
-
class
TimestampValue extends Injectable[Timestamp] with Extractable[Timestamp]
An injector/extractor of java.sql.Timestamp values.
- trait Transactions extends AnyRef
-
class
UnsupportedTypeException extends SQLNonTransientException with FailureFlags[UnsupportedTypeException]
Indicates the requested column was for an unsupported type.
Indicates the requested column was for an unsupported type. For example, asking for a string when the column is a tinyint.
-
case class
UseRequest(dbName: String) extends SimpleCommandRequest with Product with Serializable
A UseRequest is used to change the default schema of the connection.
A UseRequest is used to change the default schema of the connection. https://dev.mysql.com/doc/internals/en/com-init-db.html
-
sealed
trait
Value extends AnyRef
Defines a Value ADT that represents the domain of values received from a mysql server.
-
class
ValueSerializationException extends SQLNonTransientException with FailureFlags[ValueSerializationException]
Thrown if unable to serialize a value of the column.
-
sealed
trait
WithSql extends AnyRef
Contains the SQL for a Request.
Value Members
- object BigDecimalValue extends Injectable[BigDecimal] with Extractable[BigDecimal]
-
object
CanBeParameter
When a new implicit CanBeParameter is added here, it should also be explicitly added to Parameter.unsafeWrap.
- object Capability extends Serializable
- object Client
-
object
CloseStatementOK extends OK
Used internally to synthesize a response from the server when sending a prepared statement CloseRequest
- object Command
-
object
ConnectionInitSql
A stack module that executes a request when create a connection.
A stack module that executes a request when create a connection.
- Note
that this needs to be added at the bottom of the stack near the
prepConnRole.
- object CursoredStatement
- object DateValue extends Injectable[Date] with Extractable[Date]
-
object
EOF extends Decoder[EOF] with Serializable
Represents and EOF result received from the server which contains any warnings and the server status.
Represents and EOF result received from the server which contains any warnings and the server status. https://dev.mysql.com/doc/internals/en/generic-response-packets.html#packet-EOF_Packet
- object EmptyValue extends Value with Product with Serializable
-
object
Error extends Decoder[Error] with Serializable
Represents the Error Packet received from the server and the data sent along with it.
Represents the Error Packet received from the server and the data sent along with it. https://dev.mysql.com/doc/internals/en/generic-response-packets.html#packet-ERR_Packet
- object ExecuteRequest
- object FetchResult extends Serializable
-
object
Field extends Decoder[Field] with Serializable
Represents the column meta-data associated with a query.
Represents the column meta-data associated with a query. Sent during ResultSet transmission and as part of the meta-data associated with a Row. https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnDefinition41
-
object
FieldAttributes
These bit masks are to understand whether corresponding attribute is set for the field.
These bit masks are to understand whether corresponding attribute is set for the field. Link to source code from mysql is below. https://github.com/mysql/mysql-server/blob/5.7/include/mysql_com.h
-
object
HandshakeInit extends Decoder[HandshakeInit] with Serializable
First result received from the server as part of the connection phase.
First result received from the server as part of the connection phase. https://dev.mysql.com/doc/internals/en/connection-phase-packets.html
-
object
IncompatibleCharset extends IncompatibleServerError with Product with Serializable
Indicates that the server to which the client is connected is configured to use a charset that the client is incompatible with.
-
object
IncompatibleVersion extends IncompatibleServerError with Product with Serializable
Indicates that the server to which the client is connected is running a version of MySQL that the client is incompatible with.
-
object
IsolationLevel
MySQL Isolation Levels.
MySQL Isolation Levels. Used to override the SESSION or GLOBAL isolation level when executing transactions.
- object JsonValue
- object LostSyncException extends Serializable
- object MysqlCharset
- object NullValue extends Value with Product with Serializable
- object OK extends Decoder[OK] with Serializable
-
object
Parameter
For Scala users, the typical usage is by importing the implicit conversions and then letting the compiler do the conversions for you.
For Scala users, the typical usage is by importing the implicit conversions and then letting the compiler do the conversions for you. Explicit runtime conversions are also available via Parameter.of.
Java users should generally be using Parameters.of to do explicit conversions.
A Scala example with implicits:
import com.twitter.finagle.mysql.Parameter import com.twitter.finagle.mysql.Parameter._ val p: Parameter = "this will get implicitly converted to a Parameter"
A Scala example without implicits:
import com.twitter.finagle.mysql.Parameter val p: Parameter = Parameter.of("explicitly converted to a Parameter")
A Java example:
import com.twitter.finagle.mysql.Parameter; import com.twitter.finagle.mysql.Parameters; Parameter p = Parameters.of("explicitly converted to a Parameter");
- See also
Parameters for a Java-friendly API.
-
object
Parameters
A Java adaptation of the com.twitter.finagle.mysql.Parameter companion object.
-
object
PingRequest extends SimpleCommandRequest with Product with Serializable
A request to check if the server is alive.
A request to check if the server is alive. https://dev.mysql.com/doc/internals/en/com-ping.html
-
object
PrepareOK extends Decoder[PrepareOK] with Serializable
Meta data returned from the server in response to a prepared statement initialization request COM_STMT_PREPARE.
Meta data returned from the server in response to a prepared statement initialization request COM_STMT_PREPARE. https://dev.mysql.com/doc/internals/en/com-stmt-prepare-response.html#packet-COM_STMT_PREPARE_OK
- object PreparedStatement
-
object
QuitRequest extends SimpleCommandRequest with Product with Serializable
Tells the server that the client wants to close the connection.
Tells the server that the client wants to close the connection. https://dev.mysql.com/doc/internals/en/com-quit.html
- object RollbackFactory
- object ServerStatus extends Serializable
-
object
TimestampValue extends TimestampValue
Extracts a value in UTC.
Extracts a value in UTC. To use a different time zone, create an instance of com.twitter.finagle.mysql.TimestampValue.
- object Type