mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 18:02:31 +08:00
Python and Ruby bindings displayed an unhelpful error if trying to load an old incompatible fdb_c with a new binding.
This commit is contained in:
parent
627b785a24
commit
401f8a6774
@ -81,6 +81,8 @@ def api_version(ver):
|
|||||||
elif err != 0:
|
elif err != 0:
|
||||||
raise RuntimeError('FoundationDB API error')
|
raise RuntimeError('FoundationDB API error')
|
||||||
|
|
||||||
|
fdb.impl.init_c_api()
|
||||||
|
|
||||||
list = (
|
list = (
|
||||||
'FDBError',
|
'FDBError',
|
||||||
'predicates',
|
'predicates',
|
||||||
|
@ -1285,6 +1285,7 @@ def optionalParamToBytes(v):
|
|||||||
|
|
||||||
_FDBBase.capi = _capi
|
_FDBBase.capi = _capi
|
||||||
|
|
||||||
|
def init_c_api():
|
||||||
_capi.fdb_select_api_version_impl.argtypes = [ctypes.c_int, ctypes.c_int]
|
_capi.fdb_select_api_version_impl.argtypes = [ctypes.c_int, ctypes.c_int]
|
||||||
_capi.fdb_select_api_version_impl.restype = ctypes.c_int
|
_capi.fdb_select_api_version_impl.restype = ctypes.c_int
|
||||||
|
|
||||||
|
@ -70,6 +70,8 @@ module FDB
|
|||||||
raise "FoundationDB API version error"
|
raise "FoundationDB API version error"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
FDBC.init_c_api()
|
||||||
|
|
||||||
require_relative 'fdbtuple'
|
require_relative 'fdbtuple'
|
||||||
require_relative 'fdbdirectory'
|
require_relative 'fdbdirectory'
|
||||||
|
|
||||||
|
@ -64,6 +64,10 @@ module FDB
|
|||||||
typedef :int, :fdb_error
|
typedef :int, :fdb_error
|
||||||
typedef :int, :fdb_bool
|
typedef :int, :fdb_bool
|
||||||
|
|
||||||
|
attach_function :fdb_select_api_version_impl, [ :int, :int ], :fdb_error
|
||||||
|
attach_function :fdb_get_max_api_version, [ ], :int
|
||||||
|
|
||||||
|
def self.init_c_api
|
||||||
attach_function :fdb_get_error, [ :fdb_error ], :string
|
attach_function :fdb_get_error, [ :fdb_error ], :string
|
||||||
|
|
||||||
attach_function :fdb_network_set_option, [ :int, :pointer, :int ], :fdb_error
|
attach_function :fdb_network_set_option, [ :int, :pointer, :int ], :fdb_error
|
||||||
@ -113,9 +117,7 @@ module FDB
|
|||||||
attach_function :fdb_transaction_get_versionstamp, [ :pointer ], :pointer
|
attach_function :fdb_transaction_get_versionstamp, [ :pointer ], :pointer
|
||||||
attach_function :fdb_transaction_on_error, [ :pointer, :fdb_error ], :pointer
|
attach_function :fdb_transaction_on_error, [ :pointer, :fdb_error ], :pointer
|
||||||
attach_function :fdb_transaction_reset, [ :pointer ], :void
|
attach_function :fdb_transaction_reset, [ :pointer ], :void
|
||||||
|
end
|
||||||
attach_function :fdb_select_api_version_impl, [ :int, :int ], :fdb_error
|
|
||||||
attach_function :fdb_get_max_api_version, [ ], :int
|
|
||||||
|
|
||||||
class KeyValueStruct < FFI::Struct
|
class KeyValueStruct < FFI::Struct
|
||||||
pack 4
|
pack 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user