ruby-win32/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1-x86-mswin32/lib/sqlite3/database.rb
def create_function( name, arity, text_rep=Constants::TextRep::ANY,
      &block ) # :yields: func, *args
    # begin
      callback = proc do |func,*args|
        begin
          block.call( FunctionProxy.new( @driver, func ),
            *args.map{|v| Value.new(self,v)} )
        rescue StandardError, Exception => e
          @driver.result_error( func,
            "#{e.message} (#{e.class})", -1 )
        end
      end

      result = @driver.create_function( @handle, name, arity, text_rep, nil,
        callback, nil, nil )
      Error.check( result, self )

      self
    end
# Creates a new function for use in SQL statements. It will be added as
# +name+, with the given +arity+. (For variable arity functions, use
# -1 for the arity.)
#
# The block should accept at least one parameter--the FunctionProxy
# instance that wraps this function invocation--and any other
# arguments it needs (up to its arity).
#
# The block does not return a value directly. Instead, it will invoke
# the FunctionProxy#set_result method on the +func+ parameter and
# indicate the return value that way.
#
# Example:
#
#   db.create_function( "maim", 1 ) do |func, value|
#     if value.nil?
#       func.result = nil
#     else
#       func.result = value.split(//).sort.join
#     end
#   end
#
#   puts db.get_first_value( "select maim(name) from table" )
Creates a new function for use in SQL statements. It will be added as
+name+, with the given +arity+. (For variable arity functions, use
1 for the arity.)

The block should accept at least one parameter--the FunctionProxy
instance that wraps this function invocation--and any other
arguments it needs (up to its arity).

The block does not return a value directly. Instead, it will invoke
the FunctionProxy#set_result method on the +func+ parameter and
indicate the return value that way.






Creates a new function for use in SQL statements . It will be added as + name + with the given + arity + . ( For variable arity functions use 1 for the arity . ) The block should accept at least one parameter -- the FunctionProxy instance that wraps this function invocation -- and any other arguments it needs ( up to its arity ) . The block does not return a value directly . Instead it will invoke the FunctionProxy#set_result method on the + func + parameter and indicate the return value that way .
def create_function( name, arity, text_rep=Constants::TextRep::ANY,
      &block ) 
      callback = proc do |func,*args|
        begin
          block.call( FunctionProxy.new( @driver, func ),
            *args.map{|v| Value.new(self,v)} )
        rescue StandardError, Exception => e
          @driver.result_error( func,
            "#{e.message} (#{e.class})", -1 )
        end
      end
      result = @driver.create_function( @handle, name, arity, text_rep, nil,
        callback, nil, nil )
      Error.check( result, self )
      self
    end
def create_function ( name , arity , text_rep = Constants :: TextRep :: ANY , & block ) callback = proc do | func , * args | begin block . call ( FunctionProxy . new ( @driver , func ) , * args . map { | v | Value . new ( self , v ) } ) rescue StandardError , Exception => e @driver . result_error ( func , "#{e.message} (#{e.class})" , - 1 ) end end result = @driver . create_function ( @handle , name , arity , text_rep , nil , callback , nil , nil ) Error . check ( result , self ) self end
Creates a new function for use in SQL statements.
Creates a new function for use in SQL statements .
# :yields: func, *args # begin
name
arity
text_rep
block