Module: Btrieve
- Extended by:
- FFI::Library
- Includes:
- BtrCodes
- Included in:
- BtrieveRecord, BtrieveSchema, BtrieveSearchBuffer, BtrieveSession, BtrieveTable
- Defined in:
- lib/btrieve/btrieve_core.rb
Overview
Main interface with the BTR engine.
Constant Summary
Constants included from BtrCodes
BtrCodes::ABORT_TRANSACTION, BtrCodes::ACCELERATED_MODE, BtrCodes::BEGIN_TRANSACTION, BtrCodes::CLOSE, BtrCodes::DELETE, BtrCodes::END_TRANSACTION, BtrCodes::EOF, BtrCodes::EXCEPTION_MESSAGES, BtrCodes::EXCLUSIVE_MODE, BtrCodes::GET_DIRECT, BtrCodes::GET_EQUAL, BtrCodes::GET_EQUAL_KEY, BtrCodes::GET_FIRST, BtrCodes::GET_GREATER_THAN_OR_EQUAL, BtrCodes::GET_LESS_THAN_OR_EQUAL, BtrCodes::GET_NEXT, BtrCodes::GET_NEXT_EXTENDED, BtrCodes::GET_NEXT_KEY, BtrCodes::GET_POSITION, BtrCodes::GET_PREVIOUS, BtrCodes::INSERT, BtrCodes::KEY_NOT_FOUND, BtrCodes::LOCAL_ACCELERATED_MODE, BtrCodes::LOCAL_EXCLUSIVE_MODE, BtrCodes::LOCAL_NORMAL_MODE, BtrCodes::LOCAL_READ_ONLY_MODE, BtrCodes::MAX_DATATYPE, BtrCodes::NORMAL_MODE, BtrCodes::NO_CURRENCY_CHANGE, BtrCodes::NO_LOGICAL_CURRENCY_KEY, BtrCodes::NULL_BUFFER, BtrCodes::NULL_KEY, BtrCodes::OK, BtrCodes::OPEN, BtrCodes::POS_BLOCK_SIZE, BtrCodes::READ_ONLY_MODE, BtrCodes::RECORD_POSITION_SIZE, BtrCodes::REMOTE_ACCELERATED_MODE, BtrCodes::REMOTE_EXCLUSIVE_MODE, BtrCodes::REMOTE_NORMAL_MODE, BtrCodes::REMOTE_READ_ONLY_MODE, BtrCodes::RESET, BtrCodes::STEP_NEXT, BtrCodes::STEP_NEXT_EXTENDED, BtrCodes::STOP, BtrCodes::SYSTEM_LOG_KEY, BtrCodes::UPDATE, BtrCodes::VERIFY_MODE
Class Method Summary collapse
-
.create_string_buffer(size) ⇒ Object
Utility method to create a buffer of a given size.
Instance Method Summary collapse
-
#btr_op(ops, pos_buffer, data_buffer, key_buffer, key_number, valid_return_codes = [BtrCodes::OK]) ⇒ Object
Single entry point into the BTR engine.
Class Method Details
.create_string_buffer(size) ⇒ Object
Utility method to create a buffer of a given size.
34 35 36 |
# File 'lib/btrieve/btrieve_core.rb', line 34 def self.create_string_buffer(size) (0.chr*(size)).force_encoding("ASCII-8BIT") end |
Instance Method Details
#btr_op(ops, pos_buffer, data_buffer, key_buffer, key_number, valid_return_codes = [BtrCodes::OK]) ⇒ Object
Single entry point into the BTR engine.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/btrieve/btrieve_core.rb', line 22 def btr_op(ops, pos_buffer, data_buffer, key_buffer, key_number, valid_return_codes=[BtrCodes::OK]) session=BtrieveSession.get_session data_length = [data_buffer.size].pack('L') key_length = key_buffer.size result_code = BTRCALLID(ops, pos_buffer, data_buffer, data_length, key_buffer, key_length, key_number, session.client_id) unless valid_return_codes.include?(result_code) raise "PSQL Exception Code #{result_code} - #{EXCEPTION_MESSAGES[result_code]}" end result_code end |