Class: Sybase::Command
- Inherits:
-
Object
- Object
- Sybase::Command
- Defined in:
- lib/sybase/command.rb
Instance Method Summary collapse
- #execute ⇒ Object
- #finish ⇒ Object
-
#initialize(connection, str) ⇒ Command
constructor
A new instance of Command.
- #to_ptr ⇒ Object
Constructor Details
#initialize(connection, str) ⇒ Command
Returns a new instance of Command.
4 5 6 7 8 9 10 11 |
# File 'lib/sybase/command.rb', line 4 def initialize(connection, str) FFI::MemoryPointer.new(:pointer) do |ptr| Lib.check Lib.ct_cmd_alloc(connection, ptr), "ct_cmd_alloc" @ptr = FFI::AutoPointer.new(ptr.read_pointer, Lib.method(:ct_cmd_drop)) end @str = str.to_s end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/sybase/command.rb', line 13 def execute set_command send results ensure finish end |
#finish ⇒ Object
21 22 23 24 |
# File 'lib/sybase/command.rb', line 21 def finish to_ptr.free @ptr = nil end |
#to_ptr ⇒ Object
26 27 28 |
# File 'lib/sybase/command.rb', line 26 def to_ptr @ptr or raise "command #{self} already ran or was not initialized" end |