Method: GQLite::Connection#initialize

Defined in:
lib/gqlite.rb

#initialize(sqlite_filename: nil) ⇒ Connection

Returns a new instance of Connection.



47
48
49
50
51
52
53
54
55
56
# File 'lib/gqlite.rb', line 47

def initialize(sqlite_filename: nil)
  if sqlite_filename != nil
    @dbhandle = CApi.call_function :gqlite_connection_create_from_sqlite_file, sqlite_filename, nil
  else
    raise Error.new "No connection backend was selected."
  end
  ObjectSpace.define_finalizer @dbhandle, proc {|id|
    CApi.call_function :gqlite_connection_destroy, @dbhandle
  }
end