Packages

trait Row extends AnyRef

A Row allows you to extract Value's from a MySQL row.

Column values can be accessed by the MySQL column name via the typed xyzOrNull and getXyz methods. For example, stringOrNull and getString. The get-prefixed methods return Options and use None to represent a SQL NULL. For SQL NULLs, the or-suffixed methods return null for Object-types and use a sentinel, like 0, for primitives.

Alternatively, Value's based on the column name can be accessed via the apply method.

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");
See also

PreparedStatement.select

Client.select

Client.cursor

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Row
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract val fields: IndexedSeq[Field]

    Contains a Field object for each column in the Row.

    Contains a Field object for each column in the Row. The data is 0-indexed so fields(0) contains the column metadata for the first column in the Row.

  2. abstract def indexOf(columnName: String): Option[Int]

    Retrieves the 0-indexed index of the column with the given name.

    Retrieves the 0-indexed index of the column with the given name.

    columnName

    the case sensitive name of the column.

    returns

    Some(Int) if the column exists with the given name. Otherwise, None.

  3. abstract val values: IndexedSeq[Value]

    The values for this Row.

    The values for this Row. The data is 0-indexed so values(0) contains the value for the first column in the Row.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(columnIndex: Option[Int]): Option[Value]
    Attributes
    protected
  5. def apply(columnName: String): Option[Value]

    Retrieves the Value in the column with the given name.

    Retrieves the Value in the column with the given name.

    columnName

    the case sensitive name of the column.

    returns

    Some(Value) if the column exists with the given name. Otherwise, None.

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def bigDecimalOrNull(columnName: String): BigDecimal

    Returns a BigDecimal for the given column name, or null if the SQL value is NULL.

    Returns a BigDecimal for the given column name, or null if the SQL value is NULL.

    This can be used for MySQL columns that are NewDecimal, float, or double.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getBigDecimal

  8. def bigIntOrNull(columnName: String): BigInt

    Returns a BigInt for the given column name, or null if the SQL value is NULL.

    Returns a BigInt for the given column name, or null if the SQL value is NULL.

    This can be used for MySQL columns that are tiny, short, int24, long, or longlong.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getBigInt

  9. def booleanOrFalse(columnName: String): Boolean

    Returns a Java primitive boolean for the given column name, or false if the SQL value is NULL.

    Returns a Java primitive boolean for the given column name, or false if the SQL value is NULL.

    This is used for MySQL columns that are tiny as boolean is a synonym for that type.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not that type.

    See also

    getBoolean

    https://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html

  10. def byteOrZero(columnName: String): Byte

    Returns a Java primitive byte for the given column name, or 0 if the SQL value is NULL.

    Returns a Java primitive byte for the given column name, or 0 if the SQL value is NULL.

    This is used for MySQL columns that are tiny and signed.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not that type.

    See also

    getByte

  11. def bytesOrNull(columnName: String): Array[Byte]

    Returns a Array[Byte] for the given column name, or null if the SQL value is NULL.

    Returns a Array[Byte] for the given column name, or null if the SQL value is NULL.

    This can be used for MySQL columns that are tinyblob, mediumblob, blob, binary, or varbinary.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not that type.

    See also

    getBytes

  12. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  13. def doubleOrZero(columnName: String): Double

    Returns a Java primitive double for the given column name, or 0 if the SQL value is NULL.

    Returns a Java primitive double for the given column name, or 0 if the SQL value is NULL.

    This can be used for MySQL columns that are float or double.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getDouble

  14. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  17. def floatOrZero(columnName: String): Float

    Returns a Java primitive float for the given column name, or 0 if the SQL value is NULL.

    Returns a Java primitive float for the given column name, or 0 if the SQL value is NULL.

    This is used for MySQL columns that are float.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getFloat

  18. def getBigDecimal(columnName: String): Option[BigDecimal]

    Returns Some of a BigDecimal for the given column name, or None if the SQL value is NULL.

    Returns Some of a BigDecimal for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are NewDecimal, float, or double.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    bigDecimalOrNull

  19. def getBigInt(columnName: String): Option[BigInt]

    Returns Some of a BigInt for the given column name, or None if the SQL value is NULL.

    Returns Some of a BigInt for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are tiny, short, int24, long, or longlong.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    bigIntOrNull

  20. def getBoolean(columnName: String): Option[Boolean]

    Returns Some of a boxed Java Boolean for the given column name, or None if the SQL value is NULL.

    Returns Some of a boxed Java Boolean for the given column name, or None if the SQL value is NULL.

    This is used for MySQL columns that are tiny as boolean is a synonym for that type.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not that type.

    See also

    booleanOrFalse

    https://dev.mysql.com/doc/refman/5.5/en/numeric-type-overview.html

  21. def getByte(columnName: String): Option[Byte]

    Returns Some of a boxed Java Byte for the given column name, or None if the SQL value is NULL.

    Returns Some of a boxed Java Byte for the given column name, or None if the SQL value is NULL.

    This is used for MySQL columns that are signed and tiny.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not that type.

    See also

    byteOrZero

  22. def getBytes(columnName: String): Option[Array[Byte]]

    Returns Some of an Array[Byte] for the given column name, or None if the SQL value is NULL.

    Returns Some of an Array[Byte] for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are tinyblob, mediumblob, blob, binary, or varbinary.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not that type.

    See also

    bytesOrNull

  23. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  24. def getDouble(columnName: String): Option[Double]

    Returns Some of a boxed Java Double for the given column name, or None if the SQL value is NULL.

    Returns Some of a boxed Java Double for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are float or double.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    doubleOrZero(

  25. def getFloat(columnName: String): Option[Float]

    Returns Some of a boxed Java Float for the given column name, or None if the SQL value is NULL.

    Returns Some of a boxed Java Float for the given column name, or None if the SQL value is NULL.

    This is used for MySQL columns that are float.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    floatOrZero

  26. def getInteger(columnName: String): Option[Integer]

    Returns Some of a boxed Java Integer for the given column name, or None if the SQL value is NULL.

    Returns Some of a boxed Java Integer for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are tiny, short, int24, or signed and long.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    intOrZero

  27. def getJavaSqlDate(columnName: String): Option[Date]

    Returns Some of a java.sql.Date for the given column name, or None if the SQL value is NULL.

    Returns Some of a java.sql.Date for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are date.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    javaSqlDateOrNull(

  28. def getJsonAsObject[T](columnName: String, objMapper: Serializer)(implicit m: Manifest[T]): Option[T]

    Read the value of MySQL json column as Some(T) or None if the SQL value is NULL.

    Read the value of MySQL json column as Some(T) or None if the SQL value is NULL.

    columnName

    the case sensitive name of the column.

    objMapper

    the objMapper used to parse the json column value into type T.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not MySQL json type.

    ValueSerializationException if the MySQL json column value cannot be serialized as T.

    See also

    jsonAsObjectOrNull

  29. def getLong(columnName: String): Option[Long]

    Returns Some of a boxed Java Long for the given column name, or None if the SQL value is NULL.

    Returns Some of a boxed Java Long for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are tiny, short, int24, long, or signed and longlong

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    longOrZero

  30. def getShort(columnName: String): Option[Short]

    Returns Some of a boxed Java Short for the given column name, or None if the SQL value is NULL.

    Returns Some of a boxed Java Short for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are tiny, or signed and short.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    shortOrZero

  31. def getString(columnName: String): Option[String]

    Returns Some of a String for the given column name, or None if the SQL value is NULL.

    Returns Some of a String for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are varchar, string, or varstring, Also supports tinyblob, blob, and mediumblob if the field's charset is not the binary charset.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    stringOrNull

  32. def getTimestamp(columnName: String, timeZone: TimeZone): Option[Timestamp]

    Returns Some of an java.sql.Timestamp for the given column name, or None if the SQL value is NULL.

    Returns Some of an java.sql.Timestamp for the given column name, or None if the SQL value is NULL.

    This can be used for MySQL columns that are timestamp or datetime.

    columnName

    the case sensitive name of the column.

    timeZone

    the TimeZone used to parse the data.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not that type.

    See also

    timestampOrNull

  33. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  34. def indexOfOrSentinel(columnName: String): Int

    Retrieves the 0-indexed index of the column with the given name.

    Retrieves the 0-indexed index of the column with the given name.

    columnName

    the case sensitive name of the column.

    returns

    -1 if the column does not exist, otherwise the index of the column.

    Attributes
    protected
  35. def intOrZero(columnName: String): Int

    Returns a Java primitive int for the given column name, or 0 if the SQL value is NULL.

    Returns a Java primitive int for the given column name, or 0 if the SQL value is NULL.

    This can be used for MySQL columns that are tiny, short, int24, or signed and long.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getInteger

  36. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  37. def javaSqlDateOrNull(columnName: String): Date

    Returns a java.sql.Date for the given column name, or null if the SQL value is NULL.

    Returns a java.sql.Date for the given column name, or null if the SQL value is NULL.

    This can be used for MySQL columns that are date.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getJavaSqlDate

  38. def jsonAsObjectOrNull[T >: Null](columnName: String, objMapper: Serializer)(implicit m: Manifest[T]): T

    Read the value of MySQL json column as type T or null if the SQL value is NULL.

    Read the value of MySQL json column as type T or null if the SQL value is NULL.

    columnName

    the case sensitive name of the column.

    objMapper

    the objMapper used to parse the json column value into type T.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not MySQL json type.

    ValueSerializationException if the MySQL json column value cannot be serialized as T.

    See also

    getJsonAsObject

  39. def jsonBytesOrNull(columnName: String): Array[Byte]

    Read the Array[Byte] value of MySQL json column or null if the SQL value is NULL.

    Read the Array[Byte] value of MySQL json column or null if the SQL value is NULL.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not MySQL json type.

    See also

    jsonAsObjectOrNull

  40. def longOrZero(columnName: String): Long

    Returns a Java primitive long for the given column name, or 0 if the SQL value is NULL.

    Returns a Java primitive long for the given column name, or 0 if the SQL value is NULL.

    This can be used for MySQL columns that are tiny, short, int24, long, or signed and longlong

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getLong

  41. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  42. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  43. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  44. def shortOrZero(columnName: String): Short

    Returns a Java primitive short for the given column name, or 0 if the SQL value is NULL.

    Returns a Java primitive short for the given column name, or 0 if the SQL value is NULL.

    This can be used for MySQL columns that are tiny, or signed and short.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getShort

  45. def stringOrNull(columnName: String): String

    Returns a Java String for the given column name, or null if the SQL value is NULL.

    Returns a Java String for the given column name, or null if the SQL value is NULL.

    This can be used for MySQL columns that are varchar, string, or varstring, Also supports tinyblob, blob, and mediumblob if the field's charset is not the binary charset.

    columnName

    the case sensitive name of the column.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not a supported type.

    See also

    getString

  46. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  47. def timestampOrNull(columnName: String, timeZone: TimeZone): Timestamp

    Returns a java.sql.Timestamp for the given column name, or null if the SQL value is NULL.

    Returns a java.sql.Timestamp for the given column name, or null if the SQL value is NULL.

    This can be used for MySQL columns that are timestamp or datetime.

    columnName

    the case sensitive name of the column.

    timeZone

    the TimeZone used to parse the data.

    Exceptions thrown

    ColumnNotFoundException if the column is not found in the row.

    UnsupportedTypeException if the MySQL column is not that type.

    See also

    getTimestamp

  48. def toString(): String
    Definition Classes
    Row → AnyRef → Any
  49. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  50. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  51. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped