An entry on a StatementRow

Introduced properties

init defaultinit(statement: Statement, index: Int)

sqlite3 :: StatementEntry :: defaultinit

fun name: String

sqlite3 :: StatementEntry :: name

Name of the column
protected fun name=(name: String)

sqlite3 :: StatementEntry :: name=

Name of the column
fun statement: Statement

sqlite3 :: StatementEntry :: statement

Statement linked to self
protected fun statement=(statement: Statement)

sqlite3 :: StatementEntry :: statement=

Statement linked to self
fun to_blob: Blob

sqlite3 :: StatementEntry :: to_blob

Get this entry as Blob
fun to_f: Float

sqlite3 :: StatementEntry :: to_f

Get this entry as Float
fun to_i: Int

sqlite3 :: StatementEntry :: to_i

Get this entry as Int
fun value: nullable Sqlite3Data

sqlite3 :: StatementEntry :: value

Get the value of this entry according to its Sqlite type

Redefined properties

redef type SELF: StatementEntry

sqlite3 $ StatementEntry :: SELF

Type of this instance, automatically specialized in every class
redef fun to_s: String

sqlite3 $ StatementEntry :: to_s

Get this entry as String

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
init defaultinit(statement: Statement, index: Int)

sqlite3 :: StatementEntry :: defaultinit

fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun name: String

sqlite3 :: StatementEntry :: name

Name of the column
protected fun name=(name: String)

sqlite3 :: StatementEntry :: name=

Name of the column
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun statement: Statement

sqlite3 :: StatementEntry :: statement

Statement linked to self
protected fun statement=(statement: Statement)

sqlite3 :: StatementEntry :: statement=

Statement linked to self
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun to_blob: Blob

sqlite3 :: StatementEntry :: to_blob

Get this entry as Blob
fun to_f: Float

sqlite3 :: StatementEntry :: to_f

Get this entry as Float
fun to_i: Int

sqlite3 :: StatementEntry :: to_i

Get this entry as Int
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun value: nullable Sqlite3Data

sqlite3 :: StatementEntry :: value

Get the value of this entry according to its Sqlite type
package_diagram sqlite3::StatementEntry StatementEntry core::Object Object sqlite3::StatementEntry->core::Object

Parents

interface Object

core :: Object

The root of the class hierarchy.

Class definitions

sqlite3 $ StatementEntry
# An entry on a `StatementRow`
class StatementEntry
	# Statement linked to `self`
	var statement: Statement

	private var index: Int

	# Name of the column
	#
	# require: `self.statement.is_open`
	var name: String is lazy do
		assert statement_closed: statement.is_open

		var cname = statement.native_statement.column_name(index)
		assert not cname.address_is_null
		return cname.to_s
	end

	# Get the value of this entry according to its Sqlite type
	#
	# require: `self.statement.is_open`
	fun value: nullable Sqlite3Data
	do
		assert statement_closed: statement.is_open

		var data_type = statement.native_statement.column_type(index)
		if data_type.is_integer then return to_i
		if data_type.is_float then return to_f
		if data_type.is_blob then return to_blob
		if data_type.is_null then return null
		if data_type.is_text then return to_s
		abort
	end

	# Get this entry as `Int`
	#
	# If the Sqlite type of this entry is not an integer, it will be `CAST` to
	# integer. If `null`, returns 0.
	#
	# require: `self.statement.is_open`
	fun to_i: Int
	do
		assert statement_closed: statement.is_open

		return statement.native_statement.column_int(index)
	end

	# Get this entry as `Float`
	#
	# If the Sqlite type of this entry is not a floating point, it will be `CAST`
	# to float. If `null`, returns 0.0.
	#
	# require: `self.statement.is_open`
	fun to_f: Float
	do
		assert statement_closed: statement.is_open

		return statement.native_statement.column_double(index)
	end

	# Get this entry as `String`
	#
	# If the Sqlite type of this entry is not text, it will be `CAST` to text.
	# If null, returns an empty string.
	#
	# require: `self.statement.is_open`
	redef fun to_s
	do
		assert statement_closed: statement.is_open

		var c_string = statement.native_statement.column_text(index)
		if c_string.address_is_null then return ""
		return c_string.to_s
	end

	# Get this entry as `Blob`
	#
	# If the Sqlite type of this entry is not a blob, it will be `CAST` to text.
	# If null, returns a NULL pointer.
	#
	# require: `self.statement.is_open`
	fun to_blob: Blob
	do
		assert statement_closed: statement.is_open

		# By spec, we must get the pointer before the byte count
		var pointer = statement.native_statement.column_blob(index)
		var length = statement.native_statement.column_bytes(index)

		return new Blob(pointer, length)
	end
end
lib/sqlite3/sqlite3.nit:183,1--274,3