Class: DB2::Connection
- Inherits:
-
Object
show all
- Includes:
- DB2Util
- Defined in:
- lib/active_record/vendor/db2.rb
Instance Method Summary
collapse
Methods included from DB2Util
#check_rc, #free, #handle
Constructor Details
#initialize(environment) ⇒ Connection
Returns a new instance of Connection.
61
62
63
64
65
66
|
# File 'lib/active_record/vendor/db2.rb', line 61
def initialize(environment)
@env = environment
@handle_type = SQL_HANDLE_DBC
rc, @handle = SQLAllocHandle(@handle_type, @env.handle)
check_rc(rc)
end
|
Instance Method Details
#commit ⇒ Object
93
94
95
|
# File 'lib/active_record/vendor/db2.rb', line 93
def commit
check_rc(SQLEndTran(@handle_type, @handle, SQL_COMMIT))
end
|
#connect(server_name, user_name = '', auth = '') ⇒ Object
68
69
70
|
# File 'lib/active_record/vendor/db2.rb', line 68
def connect(server_name, user_name = '', auth = '')
check_rc(SQLConnect(@handle, server_name, user_name.to_s, auth.to_s))
end
|
#disconnect ⇒ Object
85
86
87
|
# File 'lib/active_record/vendor/db2.rb', line 85
def disconnect
check_rc(SQLDisconnect(@handle))
end
|
#rollback ⇒ Object
89
90
91
|
# File 'lib/active_record/vendor/db2.rb', line 89
def rollback
check_rc(SQLEndTran(@handle_type, @handle, SQL_ROLLBACK))
end
|
#set_auto_commit_off ⇒ Object
81
82
83
|
# File 'lib/active_record/vendor/db2.rb', line 81
def set_auto_commit_off
set_connect_attr(SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF)
end
|
#set_auto_commit_on ⇒ Object
77
78
79
|
# File 'lib/active_record/vendor/db2.rb', line 77
def set_auto_commit_on
set_connect_attr(SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_ON)
end
|
#set_connect_attr(attr, value) ⇒ Object
72
73
74
75
|
# File 'lib/active_record/vendor/db2.rb', line 72
def set_connect_attr(attr, value)
value += "\0" if value.class == String
check_rc(SQLSetConnectAttr(@handle, attr, value))
end
|