Class: SQLite3::Database::FunctionProxy

### Home Classes Methods

### In Files

- lib/sqlite3/database.rb

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #count
- #set_error

### Files

- API_CHANGES.rdoc
- Manifest.txt
- README.rdoc

### Class/Module Index

Quicksearch

- SQLite3
- SQLite3::AbortException
- SQLite3::AuthorizationException
- SQLite3::Backup
- SQLite3::Blob
- SQLite3::BusyException
- SQLite3::CantOpenException
- SQLite3::Constants
- SQLite3::Constants::ColumnType
- SQLite3::Constants::ErrorCode
- SQLite3::Constants::TextRep
- SQLite3::ConstraintException
- SQLite3::CorruptException
- SQLite3::Database
- SQLite3::Database::FunctionProxy
- SQLite3::EmptyException
- SQLite3::Exception
- SQLite3::FormatException
- SQLite3::FullException
- SQLite3::IOException
- SQLite3::InternalException
- SQLite3::InterruptException
- SQLite3::LockedException
- SQLite3::MemoryException
- SQLite3::MismatchException
- SQLite3::MisuseException
- SQLite3::NotADatabaseException
- SQLite3::NotFoundException
- SQLite3::PermissionException
- SQLite3::Pragmas
- SQLite3::ProtocolException
- SQLite3::RangeException
- SQLite3::ReadOnlyException
- SQLite3::ResultSet
- SQLite3::SQLException
- SQLite3::SchemaChangedException
- SQLite3::Statement
- SQLite3::TooBigException
- SQLite3::Translator
- SQLite3::UnsupportedException
- SQLite3::Value
- SQLite3::VersionProxy
- String

No matching classes.

# SQLite3::Database::FunctionProxy

A helper class for dealing with custom functions (see create_function, create_aggregate, and create_aggregate_handler). It encapsulates the opaque function object that represents the current invocation. It also provides more convenient access to the API functions that operate on the function object.

This class will almost always be instantiated indirectly, by working with the create methods mentioned above.

### Attributes

result[RW]

### Public Class Methods

new() click to toggle source

Create a new FunctionProxy that encapsulates the given `func` object. If context is non-nil, the functions context will be set to that. If it is non-nil, it must quack like a Hash. If it is nil, then none of the context functions will be available.

    # File lib/sqlite3/database.rb, line 551
    def initialize
      @result   = nil
      @context  = {}
    end

### Public Instance Methods

[]( key ) click to toggle source

Returns the value with the given key from the context. This is only available to aggregate functions.

    # File lib/sqlite3/database.rb, line 571
    def []( key )
      @context[ key ]
    end

[]=( key, value ) click to toggle source

Sets the value with the given key in the context. This is only available to aggregate functions.

    # File lib/sqlite3/database.rb, line 577
    def []=( key, value )
      @context[ key ] = value
    end

count() click to toggle source

(Only available to aggregate functions.) Returns the number of rows that the aggregate has processed so far. This will include the current row, and so will always return at least 1.

    # File lib/sqlite3/database.rb, line 565
    def count
      @driver.aggregate_count( @func )
    end

set_error( error ) click to toggle source

Set the result of the function to the given error message. The function will then return that error.

    # File lib/sqlite3/database.rb, line 558
    def set_error( error )
      @driver.result_error( @func, error.to_s, -1 )
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.