Module: NWRFCLib
- Extended by:
- FFI::Library
- Defined in:
- lib/nwrfc/nwrfclib.rb
Overview
Library wrapper around NW RFC SDK shared library using RUBY-FFI FIXME: Make structs managed structs and deconstruct them on GC
Defined Under Namespace
Classes: DATA_CONTAINER_HANDLE, RFCConnParam, RFCConnection, RFCDataContainer, RFCError, RFCFieldDesc, RFCFuncParam, RFC_FUNCTION_DESC_HANDLE, RFC_TYPE_DESC_HANDLE
Constant Summary collapse
- Cutf8_to_utf16le =
Iconv.new("UTF-16LE", "UTF8")
- Cutf16le_to_utf8 =
Iconv.new("UTF8", "UTF-16LE")
- B_SIZE =
Multiplier for providing correct byte size for String passed to RFC library TODO: Make platform-dependent size based on RUBY_PLATFORM
2
- RFC_RC =
enum( :RFC_OK, :RFC_COMMUNICATION_FAILURE, :RFC_LOGON_FAILURE, :RFC_ABAP_RUNTIME_FAILURE, :RFC_ABAP_MESSAGE, :RFC_ABAP_EXCEPTION, :RFC_CLOSED, :RFC_CANCELED, :RFC_TIMEOUT, :RFC_MEMORY_INSUFFICIENT, :RFC_VERSION_MISMATCH, :RFC_INVALID_PROTOCOL, :RFC_SERIALIZATION_FAILURE, :RFC_INVALID_HANDLE, :RFC_RETRY, :RFC_EXTERNAL_FAILURE, :RFC_EXECUTED, :RFC_NOT_FOUND, :RFC_NOT_SUPPORTED, :RFC_ILLEGAL_STATE, :RFC_INVALID_PARAMETER, :RFC_CODEPAGE_CONVERSION_FAILURE, :RFC_CONVERSION_FAILURE, :RFC_BUFFER_TOO_SMALL, :RFC_TABLE_MOVE_BOF, :RFC_TABLE_MOVE_EOF, :RFC_UNKNOWN_ERROR )
- RFC_ERROR_GROUP =
enum( :OK, :ABAP_APPLICATION_FAILURE, :ABAP_RUNTIME_FAILURE, :LOGON_FAILURE, :COMMUNICATION_FAILURE, :EXTERNAL_RUNTIME_FAILURE, :EXTERNAL_APPLICATION_FAILURE )
- RFC_DIRECTION =
enum( :RFC_IMPORT, 1, :RFC_EXPORT, 2, :RFC_CHANGING, 3, :RFC_TABLES, 7 )
- RFCTYPE =
enum( :RFCTYPE_CHAR , 0, :RFCTYPE_DATE , 1, :RFCTYPE_BCD , 2, :RFCTYPE_TIME , 3, :RFCTYPE_BYTE , 4, :RFCTYPE_TABLE , 5, :RFCTYPE_NUM , 6, :RFCTYPE_FLOAT , 7, :RFCTYPE_INT , 8, :RFCTYPE_INT2 , 9, :RFCTYPE_INT1 , 10, :RFCTYPE_NULL , 14, :RFCTYPE_STRUCTURE , 17, :RFCTYPE_DECF16 , 23, :RFCTYPE_DECF34 , 24, :RFCTYPE_XMLDATA , 28, :RFCTYPE_STRING , 29, :RFCTYPE_XSTRING , 30 )
Class Method Summary collapse
-
.make_conn_params(params) ⇒ Object
Take Hash of connection parameters and returns FFI pointer to an array for passing to connection.
Class Method Details
.make_conn_params(params) ⇒ Object
Take Hash of connection parameters and returns FFI pointer to an array for passing to connection
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/nwrfc/nwrfclib.rb', line 432 def NWRFCLib.make_conn_params(params) #https://github.com/ffi/ffi/wiki/Structs par = FFI::MemoryPointer.new(RFCConnParam, params.length) pars = params.length.times.collect do |i| RFCConnParam.new(par + i * RFCConnParam.size) end #TODO Optimize this method tpar = params.to_a params.length.times do |n| # str = (tpar[n][0].to_s + "\0").encode("UTF-16LE") pars[n][:name] = FFI::MemoryPointer.from_string(tpar[n][0].to_s.cU) # str = (tpar[n][1].to_s + "\0").encode("UTF-16LE") # str = str.encode("UTF-16LE") pars[n][:value] = FFI::MemoryPointer.from_string(tpar[n][1].to_s.cU) end par end |