class SQLite3::Value - sqlite3-1.3.10 Documentation

# class SQLite3::Value

### Attributes

handle[R]

### Public Class Methods

new( db, handle ) click to toggle source

    # File lib/sqlite3/value.rb, line 8
    def initialize( db, handle )
      @driver = db.driver
      @handle = handle
    end

### Public Instance Methods

length( utf16=false ) click to toggle source

    # File lib/sqlite3/value.rb, line 21
    def length( utf16=false )
      if utf16
        @driver.value_bytes16( @handle )
      else
        @driver.value_bytes( @handle )
      end
    end

null?() click to toggle source

    # File lib/sqlite3/value.rb, line 13
    def null?
      type == :null
    end

to_blob() click to toggle source

    # File lib/sqlite3/value.rb, line 17
    def to_blob
      @driver.value_blob( @handle )
    end

to_f() click to toggle source

    # File lib/sqlite3/value.rb, line 29
    def to_f
      @driver.value_double( @handle )
    end

to_i() click to toggle source

    # File lib/sqlite3/value.rb, line 33
    def to_i
      @driver.value_int( @handle )
    end

to_int64() click to toggle source

    # File lib/sqlite3/value.rb, line 37
    def to_int64
      @driver.value_int64( @handle )
    end

to_s( utf16=false ) click to toggle source

    # File lib/sqlite3/value.rb, line 41
    def to_s( utf16=false )
      @driver.value_text( @handle, utf16 )
    end

type() click to toggle source

    # File lib/sqlite3/value.rb, line 45
    def type
      case @driver.value_type( @handle )
        when Constants::ColumnType::INTEGER then :int
        when Constants::ColumnType::FLOAT   then :float
        when Constants::ColumnType::TEXT    then :text
        when Constants::ColumnType::BLOB    then :blob
        when Constants::ColumnType::NULL    then :null
      end
    end