class SQLite3::Database::FunctionProxy
with the create methods mentioned above.
This class will almost always be instantiated indirectly, by working
the function object.
provides more convenient access to the API functions that operate on
opaque function object that represents the current invocation. It also
#create_aggregate, and #create_aggregate_handler). It encapsulates the
A helper class for dealing with custom functions (see #create_function,
def [](key)
Returns the value with the given key from the context. This is only
def [](key) ensure_aggregate! @context[key] end
def []=(key, value)
Sets the value with the given key in the context. This is only
def []=(key, value) ensure_aggregate! @context[key] = value end
def count
that the aggregate has processed so far. This will include the current
(Only available to aggregate functions.) Returns the number of rows
def count ensure_aggregate! @driver.aggregate_count(@func) end
def ensure_aggregate!
being invoked is an aggregate function. This is implied by the
A function for performing a sanity check, to ensure that the function
def ensure_aggregate! unless @context raise MisuseException, "function is not an aggregate" end end
def initialize(driver, func, context = nil)
it is non-nil, it must quack like a Hash. If it is nil, then none of
If context is non-nil, the functions context will be set to that. If
Create a new FunctionProxy that encapsulates the given +func+ object.
def initialize(driver, func, context = nil) @driver = driver @func = func @context = context end
def result=(result)
def result=(result) set_result(result) end
def set_error(error)
Set the result of the function to the given error message.
def set_error(error) @driver.result_error(@func, error.to_s, -1) end
def set_result(result, utf16 = false)
Set the result of the function to the given value. The function will
def set_result(result, utf16 = false) @driver.result_text(@func, result, utf16) end