# File lib/sqlite3/database.rb, line 349
    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