| 1 |
Index: sybase_adapter.rb |
|---|
| 2 |
=================================================================== |
|---|
| 3 |
--- sybase_adapter.rb (revision 6768) |
|---|
| 4 |
+++ sybase_adapter.rb (working copy) |
|---|
| 5 |
@@ -42,9 +42,8 @@ |
|---|
| 6 |
raise ArgumentError, "No database specified. Missing argument: database." |
|---|
| 7 |
end |
|---|
| 8 |
|
|---|
| 9 |
- ConnectionAdapters::SybaseAdapter.new( |
|---|
| 10 |
- SybSQL.new({'S' => host, 'U' => username, 'P' => password}, |
|---|
| 11 |
- ConnectionAdapters::SybaseAdapterContext), database, config, logger) |
|---|
| 12 |
+ ConnectionAdapters::SybaseAdapter.new(host, username, password, |
|---|
| 13 |
+ database, config, logger) |
|---|
| 14 |
end |
|---|
| 15 |
end # class Base |
|---|
| 16 |
|
|---|
| 17 |
@@ -116,14 +115,28 @@ |
|---|
| 18 |
end # class ColumnWithIdentity |
|---|
| 19 |
|
|---|
| 20 |
# Sybase adapter |
|---|
| 21 |
- def initialize(connection, database, config = {}, logger = nil) |
|---|
| 22 |
- super(connection, logger) |
|---|
| 23 |
- context = connection.context |
|---|
| 24 |
- context.init(logger) |
|---|
| 25 |
+ def initialize(host, username, password, |
|---|
| 26 |
+ database, config = {}, logger = nil) |
|---|
| 27 |
+ super(nil, logger) |
|---|
| 28 |
+ @host = host |
|---|
| 29 |
+ @username = username |
|---|
| 30 |
+ @password = password |
|---|
| 31 |
@config = config |
|---|
| 32 |
+ @database = database |
|---|
| 33 |
@numconvert = config.has_key?(:numconvert) ? config[:numconvert] : true |
|---|
| 34 |
@limit = @offset = 0 |
|---|
| 35 |
- unless connection.sql_norow("USE #{database}") |
|---|
| 36 |
+ connect |
|---|
| 37 |
+ end |
|---|
| 38 |
+ |
|---|
| 39 |
+ def connect |
|---|
| 40 |
+ @connection = SybSQL.new({'S' => @host, 'U' => @username, |
|---|
| 41 |
+ 'P' => @password}, |
|---|
| 42 |
+ ConnectionAdapters::SybaseAdapterContext) |
|---|
| 43 |
+ @runtime = 0 |
|---|
| 44 |
+ @last_verification = 0 |
|---|
| 45 |
+ context = @connection.context |
|---|
| 46 |
+ context.init(@logger) |
|---|
| 47 |
+ unless @connection.sql_norow("USE #{@database}") |
|---|
| 48 |
raise "Cannot USE #{database}" |
|---|
| 49 |
end |
|---|
| 50 |
end |
|---|
| 51 |
@@ -167,9 +180,8 @@ |
|---|
| 52 |
end |
|---|
| 53 |
|
|---|
| 54 |
def reconnect! |
|---|
| 55 |
- raise "Sybase Connection Adapter does not yet support reconnect!" |
|---|
| 56 |
- # disconnect! |
|---|
| 57 |
- # connect! # Not yet implemented |
|---|
| 58 |
+ disconnect! |
|---|
| 59 |
+ connect |
|---|
| 60 |
end |
|---|
| 61 |
|
|---|
| 62 |
def table_alias_length |
|---|