Class: SQLite3::Database::FunctionProxy

Class | SQLite3::Database::FunctionProxy
In: | lib/sqlite3/database.rb
Parent: | Object

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.

### Methods

[] []= count new result= set_error set_result

### Public Class methods

new( driver, func, context=nil )

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.

### Public Instance methods

[]( key )

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

[]=( key, value )

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

count()

(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.

result=( result )

Calls set_result to set the result of this function.

set_error( error )

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

set_result( result, utf16=false )

Set the result of the function to the given value. The function will then return this value.

[Validate]