Module: GQLite::CApi

Extended by:
FFI::Library
Defined in:
lib/gqlite.rb

Constant Summary collapse

ApiContext =
CApi.gqlite_api_context_create()

Class Method Summary collapse

Class Method Details

.call_function(fname, *args) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/gqlite.rb', line 35

def CApi.call_function(fname, *args)
  r = CApi.send fname, ApiContext, *args
  if CApi.gqlite_api_context_has_error(ApiContext)
    err = CApi.gqlite_api_context_get_message ApiContext
    CApi.gqlite_api_context_clear_error ApiContext
    raise Error.new err
  end
  return r
end

.get_lib_nameObject

Attempt to find the gqlite build that is shipped with gem



12
13
14
15
16
17
18
# File 'lib/gqlite.rb', line 12

def CApi.get_lib_name()
  path = "#{File.dirname __FILE__}/#{FFI::Platform::LIBPREFIX}gqlite.#{FFI::Platform::LIBSUFFIX}"
  return path if File.exist?(path)
  path = "#{File.dirname __FILE__}/gqlite.#{FFI::Platform::LIBSUFFIX}"
  return path if File.exist?(path)
  return "gqlite"
end