# File lib/sqlite3/driver/native/driver.rb, line 101
    def create_function( db, name, args, text, cookie, func, step, final )
      if func || ( step && final )
        cb = API::CallbackData.new
        cb.proc = cb.proc2 = nil
        cb.data = cookie
      end

      if func
        cb.proc = func

        func = API::Sqlite3_ruby_function_step
        step = final = nil
      elsif step && final
        cb.proc = step
        cb.proc2 = final

        func = nil
        step = API::Sqlite3_ruby_function_step
        final = API::Sqlite3_ruby_function_final
      end

      result = API.sqlite3_create_function( db, name, args, text, cb, func, step, final )

      # see comments in busy_handler
      if cb
        @callback_data[ name ] = cb
      else
        @callback_data.delete( name )
      end

      return result
    end