odbc-rails 1.4 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +30 -0
- data/NEWS +6 -0
- data/README +16 -64
- data/lib/active_record/connection_adapters/odbc_adapter.rb +70 -13
- data/lib/active_record/vendor/odbcext_sqlanywhere.rb +115 -0
- data/lib/active_record/vendor/odbcext_sqlanywhere_col.rb +49 -0
- data/test/connections/native_odbc/connection.rb +24 -1
- data/test/fixtures/db_definitions/postgresql.drop.sql +0 -0
- data/test/fixtures/db_definitions/postgresql.sql +0 -0
- data/test/fixtures/db_definitions/postgresql2.drop.sql +0 -0
- data/test/fixtures/db_definitions/postgresql2.sql +0 -0
- metadata +107 -93
data/ChangeLog
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
2008-04-23 15:11 source
|
2
|
+
|
3
|
+
* Updated version to 1.5 for final release
|
4
|
+
|
5
|
+
2008-04-23 15:10 source
|
6
|
+
|
7
|
+
* Final documentation fixes
|
8
|
+
|
9
|
+
2008-04-22 16:52 source
|
10
|
+
|
11
|
+
* Updated documentation
|
12
|
+
|
13
|
+
2008-04-22 16:52 source
|
14
|
+
|
15
|
+
* Added support for dsnless connections
|
16
|
+
|
17
|
+
2008-04-22 16:52 source
|
18
|
+
|
19
|
+
* Added initial support for SQL Anywhere
|
20
|
+
|
21
|
+
2008-04-14 11:02 source
|
22
|
+
|
23
|
+
* Updated version number to 1.4.9
|
24
|
+
|
25
|
+
2008-04-13 22:40 source
|
26
|
+
|
27
|
+
* Created maintenance branch for compatibility with Rails 1.2.5/
|
28
|
+
ActiveRecord 1.15.6.
|
29
|
+
* Removed plugin support for Rails 1.2.x.
|
30
|
+
|
1
31
|
2007-02-27 15:28 source
|
2
32
|
|
3
33
|
* Set version 1.4 for final release
|
data/NEWS
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
April 23, 2008, V1.5:
|
2
|
+
* Amended configuration instructions for Rails 1.2.6 / ActiveRecord 1.15.6.
|
3
|
+
* Removed plugin support for Rails 1.2.x.
|
4
|
+
* Added support for DSN-less connections
|
5
|
+
* Added support for SQLAnywhere
|
6
|
+
|
1
7
|
February 27, 2007, V1.4:
|
2
8
|
* Changes for Rails 1.2.x / ActiveRecord 1.15.x
|
3
9
|
* Added support for :decimal type
|
data/README
CHANGED
@@ -5,6 +5,16 @@
|
|
5
5
|
|
6
6
|
== Status
|
7
7
|
|
8
|
+
23-Apr-2008
|
9
|
+
|
10
|
+
odbc-rails 1.5:
|
11
|
+
* Amended configuration instructions for Rails 1.2.6 / ActiveRecord 1.15.6.
|
12
|
+
* Removed plugin support for Rails 1.2.x.
|
13
|
+
* Added support for DSN-less connections (thanks to Ralf Vitasek).
|
14
|
+
* Added support for SQLAnywhere (thanks to Bryan Lahartinger).
|
15
|
+
|
16
|
+
For Rails 2.x / ActiveRecord 2.x, use odbc-rails 2.0.
|
17
|
+
|
8
18
|
23-Feb-2007
|
9
19
|
|
10
20
|
The adapter has been updated to support Rails 1.2.x / ActiveRecord 1.15.x.
|
@@ -99,10 +109,8 @@ be found in support/lib and support/test.
|
|
99
109
|
|
100
110
|
== Installation
|
101
111
|
|
102
|
-
There are
|
103
|
-
(recommended)
|
104
|
-
one of the following, depending on whether you want the adapter to be
|
105
|
-
available system-wide or just within a particular Rails project.
|
112
|
+
There are 2 ways to install the ODBC Adapter package: either as a gem
|
113
|
+
(recommended) or by running the custom installation script.
|
106
114
|
|
107
115
|
=== Installation as a Gem
|
108
116
|
|
@@ -110,58 +118,6 @@ Install the odbc-rails gem by running:
|
|
110
118
|
|
111
119
|
# gem install -r odbc-rails --include-dependencies
|
112
120
|
|
113
|
-
Enable loading of the adapter by editing your Rails project's
|
114
|
-
config/environment.rb script:
|
115
|
-
|
116
|
-
* Add a +require+ to your config/environment.rb immediately after the line
|
117
|
-
|
118
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
119
|
-
|
120
|
-
i.e.
|
121
|
-
|
122
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
123
|
-
require 'odbc_adapter'
|
124
|
-
|
125
|
-
|
126
|
-
=== Installation as a Plugin
|
127
|
-
|
128
|
-
Installing the OpenLink ODBC Data Adapter as a plugin makes it available to
|
129
|
-
a particular Rails application only.
|
130
|
-
|
131
|
-
==== Automatic Plugin installation
|
132
|
-
|
133
|
-
The adapter can be automatically installed as a plugin by navigating to the
|
134
|
-
root of your Rails application and typing either:
|
135
|
-
|
136
|
-
script/plugin install odbc-rails
|
137
|
-
or
|
138
|
-
script/plugin install http://odbc-rails.rubyforge.org/plugins/odbc-rails
|
139
|
-
|
140
|
-
On Windows, replace <tt>script/plugin</tt> by <tt>ruby script/plugin</tt>.
|
141
|
-
e.g. <tt>ruby script/plugin install odbc-rails</tt>
|
142
|
-
|
143
|
-
|
144
|
-
==== Manual Plugin Installation
|
145
|
-
|
146
|
-
You can also install the plugin manually by unpacking the sources into the
|
147
|
-
vendor/plugins directory of your Rails application. If you use this method,
|
148
|
-
you must run install.rb immediately afterwards. This need only be done once.
|
149
|
-
|
150
|
-
install.rb modifies your application's config/environment.rb file, adding a
|
151
|
-
line to ensure that the database adapter plugin is initialized before
|
152
|
-
ActiveRecord. i.e.
|
153
|
-
|
154
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
155
|
-
|
156
|
-
# Added by OpenLink ODBC Adapter (odbc-rails) plugin
|
157
|
-
Rails::Initializer.run(:load_plugins)
|
158
|
-
|
159
|
-
Rails::Initializer.run do |config|
|
160
|
-
|
161
|
-
Without this change, Rails attempts to initialize ActiveRecord before it loads
|
162
|
-
any plugins, causing an AdapterNotFound error. install.rb saves a copy of
|
163
|
-
environment.rb before making any changes.
|
164
|
-
|
165
121
|
=== Custom installation script
|
166
122
|
|
167
123
|
When using <tt>rake install</tt> or running the install_odbc.rb script by
|
@@ -229,8 +185,7 @@ steps yourself.
|
|
229
185
|
|
230
186
|
This step is only necessary if the adapter was installed either as a gem or
|
231
187
|
by copying files into your Rails core manually. It is not required if the
|
232
|
-
adapter was installed
|
233
|
-
install_odbc.rb.
|
188
|
+
adapter was installed using <tt>rake install</tt> or using install_odbc.rb.
|
234
189
|
|
235
190
|
There are two ways to enable loading of the adapter:
|
236
191
|
|
@@ -247,19 +202,16 @@ There are two ways to enable loading of the adapter:
|
|
247
202
|
|
248
203
|
*or*
|
249
204
|
|
250
|
-
2. Modify your Rails application's configuration
|
251
|
-
adapter:
|
252
|
-
|
205
|
+
2. Modify your Rails application's configuration:
|
253
206
|
|
254
|
-
*
|
255
|
-
the line
|
207
|
+
* Define RAILS_CONNECTION_ADAPTERS in your config/environment.rb immediately after the line
|
256
208
|
|
257
209
|
require File.join(File.dirname(__FILE__), 'boot')
|
258
210
|
|
259
211
|
i.e.
|
260
212
|
|
261
213
|
require File.join(File.dirname(__FILE__), 'boot')
|
262
|
-
|
214
|
+
RAILS_CONNECTION_ADAPTERS = %w( odbc )
|
263
215
|
|
264
216
|
== Configuring the Adapter
|
265
217
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id: odbc_adapter.rb,v 1.5
|
2
|
+
# $Id: odbc_adapter.rb,v 1.5.2.2 2008/04/23 15:10:47 source Exp $
|
3
3
|
#
|
4
4
|
# OpenLink ODBC Adapter for Ruby on Rails
|
5
5
|
# Copyright (C) 2006 OpenLink Software
|
@@ -36,21 +36,48 @@ begin
|
|
36
36
|
config = config.symbolize_keys
|
37
37
|
if config.has_key?(:dsn)
|
38
38
|
dsn = config[:dsn]
|
39
|
+
username = config[:username] ? config[:username].to_s : nil
|
40
|
+
password = config[:password] ? config[:password].to_s : nil
|
41
|
+
elsif config.has_key?(:conn_str)
|
42
|
+
connstr = config[:conn_str]
|
39
43
|
else
|
40
|
-
raise ActiveRecordError, "No data source name (
|
44
|
+
raise ActiveRecordError, "No data source name (:dsn) or connection string (:conn_str) specified."
|
41
45
|
end
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
emulate_bools = config[:emulate_booleans].nil? ? false : config[:emulate_booleans]
|
46
|
+
|
47
|
+
trace = config[:trace] || false
|
48
|
+
conv_num_lits = config[:convert_numeric_literals] || false
|
49
|
+
emulate_bools = config[:emulate_booleans] || false
|
47
50
|
|
48
|
-
|
51
|
+
if config.has_key?(:dsn)
|
52
|
+
# Connect using dsn, username, password
|
53
|
+
conn = ODBC::connect(dsn, username, password)
|
54
|
+
conn_opts = {
|
55
|
+
:dsn => dsn, :username => username, :password => password,
|
56
|
+
:trace => trace, :conv_num_lits => conv_num_lits,
|
57
|
+
:emulate_booleans => emulate_bools
|
58
|
+
}
|
59
|
+
else
|
60
|
+
# Connect using ODBC connection string
|
61
|
+
# - supports DSN-based or DSN-less connections
|
62
|
+
# e.g. "DSN=virt5;UID=rails;PWD=rails"
|
63
|
+
# "DRIVER={OpenLink Virtuoso};HOST=carlmbp;UID=rails;PWD=rails"
|
64
|
+
connstr_keyval_pairs = connstr.split(';')
|
65
|
+
driver = ODBC::Driver.new
|
66
|
+
driver.name = 'odbc'
|
67
|
+
driver.attrs = {}
|
68
|
+
connstr_keyval_pairs.each do |pair|
|
69
|
+
attr = pair.split('=')
|
70
|
+
driver.attrs[attr[0]] = attr[1] if attr.length.eql?(2)
|
71
|
+
end
|
72
|
+
conn = ODBC::Database.new.drvconnect(driver)
|
73
|
+
conn_opts = {
|
74
|
+
:conn_str => config[:conn_str], :driver => driver,
|
75
|
+
:trace => trace, :conv_num_lits => conv_num_lits,
|
76
|
+
:emulate_booleans => emulate_bools
|
77
|
+
}
|
78
|
+
end
|
49
79
|
conn.autocommit = true
|
50
|
-
|
51
|
-
ConnectionAdapters::ODBCAdapter.new(conn, {:dsn => dsn, :username => username,
|
52
|
-
:password => password, :trace => trace, :conv_num_lits => conv_num_lits,
|
53
|
-
:emulate_booleans => emulate_bools}, logger)
|
80
|
+
ConnectionAdapters::ODBCAdapter.new(conn, conn_opts, logger)
|
54
81
|
end
|
55
82
|
end # class Base
|
56
83
|
|
@@ -63,6 +90,11 @@ begin
|
|
63
90
|
#
|
64
91
|
# == Status
|
65
92
|
#
|
93
|
+
# === 23-Apr-2008
|
94
|
+
#
|
95
|
+
# Added support for DSN-less connections (thanks to Ralf Vitasek).
|
96
|
+
# Added support for SQLAnywhere (thanks to Bryan Lahartinger).
|
97
|
+
#
|
66
98
|
# === 27-Feb-2007
|
67
99
|
#
|
68
100
|
# Adapter updated to support Rails 1.2.x / ActiveRecord 1.15.x.
|
@@ -112,6 +144,14 @@ begin
|
|
112
144
|
# Specifies the database user.
|
113
145
|
# <tt>:password</tt>::
|
114
146
|
# Specifies the database password.
|
147
|
+
# <tt>:conn_str</tt>::
|
148
|
+
# Specifies an ODBC-style connection string.
|
149
|
+
# e.g.
|
150
|
+
# "DSN=virt5;UID=rails;PWD=rails" or
|
151
|
+
# "DRIVER={OpenLink Virtuoso};HOST=carlmbp;UID=rails;PWD=rails"
|
152
|
+
# Use either a) :dsn, :username and :password or b) :conn_str
|
153
|
+
# The :conn_str option in combination with the DRIVER keyword
|
154
|
+
# supports DSN-less connections.
|
115
155
|
# <tt>:trace</tt>::
|
116
156
|
# If set to <tt>true</tt>, turns on simple call tracing to the log file
|
117
157
|
# referenced by ActiveRecord::Base.logger. If omitted, <tt>:trace</tt>
|
@@ -334,6 +374,15 @@ begin
|
|
334
374
|
:boolean_col_surrogate => nil
|
335
375
|
}
|
336
376
|
},
|
377
|
+
:sqlanywhere => {
|
378
|
+
:any_version => {
|
379
|
+
:primary_key => "INTEGER PRIMARY KEY DEFAULT AUTOINCREMENT",
|
380
|
+
:has_autoincrement_col => true,
|
381
|
+
:supports_migrations => true,
|
382
|
+
:supports_schema_names => true,
|
383
|
+
:supports_count_distinct => true,
|
384
|
+
:boolean_col_surrogate => "TINYINT" }
|
385
|
+
},
|
337
386
|
:virtuoso => {
|
338
387
|
:any_version => {
|
339
388
|
:primary_key => "INT NOT NULL IDENTITY PRIMARY KEY",
|
@@ -527,7 +576,13 @@ begin
|
|
527
576
|
def reconnect!
|
528
577
|
@logger.unknown("ODBCAdapter#reconnect!>") if @@trace
|
529
578
|
@connection.disconnect if @connection.connected?
|
530
|
-
@
|
579
|
+
if @connection_options.has_key?(:dsn)
|
580
|
+
@connection = ODBC::connect(@connection_options[:dsn],
|
581
|
+
@connection_options[:username],
|
582
|
+
@connection_options[:password])
|
583
|
+
else
|
584
|
+
@connection = ODBC::Database.new.drvconnect(@connection_options[:driver])
|
585
|
+
end
|
531
586
|
# There's no need to refresh the data source info in @dsInfo because
|
532
587
|
# we're reconnecting to the same data source.
|
533
588
|
rescue Exception => e
|
@@ -1483,6 +1538,8 @@ begin
|
|
1483
1538
|
symbl = :sybase
|
1484
1539
|
elsif dbmsName =~ /virtuoso/i
|
1485
1540
|
symbl = :virtuoso
|
1541
|
+
elsif dbmsName =~ /SQLAnywhere/i
|
1542
|
+
symbl = :sqlanywhere
|
1486
1543
|
else
|
1487
1544
|
raise ActiveRecord::ActiveRecordError, "ODBCAdapter: Unsupported database (#{dbmsName})"
|
1488
1545
|
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
#
|
2
|
+
# $Id: odbcext_sqlanywhere.rb,v 1.1.2.1 2008/04/22 16:52:04 source Exp $
|
3
|
+
#
|
4
|
+
# OpenLink ODBC Adapter for Ruby on Rails
|
5
|
+
# Copyright (C) 2006 OpenLink Software
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
# a copy of this software and associated documentation files (the
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject
|
13
|
+
# to the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be
|
16
|
+
# included in all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
21
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
22
|
+
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
23
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
#
|
26
|
+
|
27
|
+
module ODBCExt
|
28
|
+
|
29
|
+
# ------------------------------------------------------------------------
|
30
|
+
# Mandatory methods
|
31
|
+
#
|
32
|
+
|
33
|
+
# #last_insert_id must be implemented for any database which returns
|
34
|
+
# false from #prefetch_primary_key?
|
35
|
+
def last_insert_id(table, sequence_name, stmt = nil)
|
36
|
+
@logger.unknown("ODBCAdapter#last_insert_id>") if @trace
|
37
|
+
select_value("select @@IDENTITY", 'last_insert_id')
|
38
|
+
end
|
39
|
+
|
40
|
+
# ------------------------------------------------------------------------
|
41
|
+
# Optional methods
|
42
|
+
#
|
43
|
+
# These are supplied for a DBMS only if necessary.
|
44
|
+
# ODBCAdapter tests for optional methods using Object#respond_to?
|
45
|
+
|
46
|
+
# Pre action for ODBCAdapter#insert
|
47
|
+
def pre_insert(sql, name, pk, id_value, sequence_name)
|
48
|
+
@iiTable = get_table_name(sql)
|
49
|
+
@iiCol = get_autounique_column(@iiTable)
|
50
|
+
@iiEnabled = false
|
51
|
+
|
52
|
+
if @iiCol != nil
|
53
|
+
if query_contains_autounique_col(sql, @iiCol)
|
54
|
+
begin
|
55
|
+
@connection.do(enable_identity_insert(@iiTable, true))
|
56
|
+
@iiEnabled = true
|
57
|
+
rescue Exception => e
|
58
|
+
raise ActiveRecordError, "IDENTITY_INSERT could not be turned on"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Post action for ODBCAdapter#insert
|
65
|
+
def post_insert(sql, name, pk, id_value, sequence_name)
|
66
|
+
if @iiEnabled
|
67
|
+
begin
|
68
|
+
@connection.do(enable_identity_insert(@iiTable, false))
|
69
|
+
rescue Exception => e
|
70
|
+
raise ActiveRecordError, "IDENTITY_INSERT could not be turned off"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# ------------------------------------------------------------------------
|
76
|
+
# Method redefinitions
|
77
|
+
#
|
78
|
+
# DBMS specific methods which override the default implementation
|
79
|
+
# provided by the ODBCAdapter core.
|
80
|
+
|
81
|
+
def get_table_name(sql)
|
82
|
+
if sql =~ /^\s*insert\s+into\s+([^\(\s]+)\s*|^\s*update\s+([^\(\s]+)\s*/i
|
83
|
+
$1
|
84
|
+
elsif sql =~ /from\s+([^\(\s]+)\s*/i
|
85
|
+
$1
|
86
|
+
else
|
87
|
+
nil
|
88
|
+
end end
|
89
|
+
|
90
|
+
def get_autounique_column(table_name)
|
91
|
+
@table_columns = {} unless @table_columns
|
92
|
+
@table_columns[table_name] = columns(table_name) if @table_columns[table_name] == nil
|
93
|
+
@table_columns[table_name].each do |col|
|
94
|
+
return col.name if col.auto_unique?
|
95
|
+
end
|
96
|
+
|
97
|
+
return nil
|
98
|
+
end
|
99
|
+
|
100
|
+
def query_contains_autounique_col(sql, col)
|
101
|
+
sql =~ /(\[#{col}\])|("#{col}")/
|
102
|
+
end
|
103
|
+
|
104
|
+
def enable_identity_insert(table_name, enable = true)
|
105
|
+
if has_autounique_column(table_name)
|
106
|
+
"SET IDENTITY_INSERT #{table_name} #{enable ? 'ON' : 'OFF'}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def has_autounique_column(table_name)
|
111
|
+
!get_autounique_column(table_name).nil?
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
end # module
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# $Id: odbcext_sqlanywhere_col.rb,v 1.1.2.1 2008/04/22 16:52:04 source Exp $
|
3
|
+
#
|
4
|
+
# OpenLink ODBC Adapter for Ruby on Rails
|
5
|
+
# Copyright (C) 2006 OpenLink Software
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
# a copy of this software and associated documentation files (the
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject
|
13
|
+
# to the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be
|
16
|
+
# included in all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
21
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
22
|
+
# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
23
|
+
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
#
|
26
|
+
|
27
|
+
module ODBCColumnExt
|
28
|
+
|
29
|
+
# Is the column a numeric autoincrementing column?
|
30
|
+
def auto_unique?
|
31
|
+
@autounique
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def autoUnique?
|
37
|
+
@nativeType =~ /\bidentity\b/i
|
38
|
+
end
|
39
|
+
|
40
|
+
#private
|
41
|
+
|
42
|
+
def default_preprocess(nativeType, default)
|
43
|
+
return default if default.nil?
|
44
|
+
default.replace($2.strip) if default =~ /(DEFAULT +)(.*)/i
|
45
|
+
default.replace($1) if default =~ /^'(.*)'$/
|
46
|
+
default
|
47
|
+
end
|
48
|
+
|
49
|
+
end # module
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id: connection.rb,v 1.5
|
2
|
+
# $Id: connection.rb,v 1.5.2.1 2008/04/22 16:52:36 source Exp $
|
3
3
|
#
|
4
4
|
# OpenLink ODBC Adapter for Ruby on Rails
|
5
5
|
# Copyright (C) 2006 OpenLink Software
|
@@ -56,6 +56,29 @@ ActiveRecord::Base.configurations = {
|
|
56
56
|
ActiveRecord::Base.establish_connection 'arunit'
|
57
57
|
Course.establish_connection 'arunit2'
|
58
58
|
|
59
|
+
###########################################
|
60
|
+
# Using DSN-less connection
|
61
|
+
|
62
|
+
=begin
|
63
|
+
ActiveRecord::Base.configurations = {
|
64
|
+
'arunit' => {
|
65
|
+
:adapter => "odbc",
|
66
|
+
:conn_str => "Driver={OpenLink Lite for MySQL [6.0]};Database=rails_testdb1;Port=3306;UID=myuid;PWD=mypwd;"
|
67
|
+
:emulate_booleans => true,
|
68
|
+
:trace => false
|
69
|
+
},
|
70
|
+
'arunit2' => {
|
71
|
+
:adapter => "odbc",
|
72
|
+
:conn_str => "Driver={OpenLink Lite for MySQL [6.0]};Database=rails_testdb2;Port=3306;UID=myuid;PWD=mypwd;"
|
73
|
+
:emulate_booleans => true,
|
74
|
+
:trace => false
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
ActiveRecord::Base.establish_connection 'arunit'
|
79
|
+
Course.establish_connection 'arunit2'
|
80
|
+
=end
|
81
|
+
|
59
82
|
###########################################
|
60
83
|
# Using DB2
|
61
84
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,121 +1,131 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0
|
3
|
-
specification_version: 1
|
4
2
|
name: odbc-rails
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "1.
|
7
|
-
date: 2007-02-27 00:00:00 +01:00
|
8
|
-
summary: ODBC Data Adapter for ActiveRecord.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: cblakeley@openlinksw.co.uk
|
12
|
-
homepage: http://odbc-rails.rubyforge.org
|
13
|
-
rubyforge_project:
|
14
|
-
description:
|
15
|
-
autorequire: odbc_adapter
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: "1.5"
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Carl Blakeley
|
8
|
+
autorequire: odbc_adapter
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-04-23 00:00:00 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activerecord
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.15.6
|
23
|
+
- - <
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: "2.0"
|
26
|
+
version:
|
27
|
+
description:
|
28
|
+
email: cblakeley@openlinksw.co.uk
|
29
|
+
executables: []
|
30
|
+
|
31
|
+
extensions: []
|
32
|
+
|
33
|
+
extra_rdoc_files:
|
34
|
+
- README
|
35
|
+
- COPYING
|
31
36
|
files:
|
37
|
+
- lib/connection_adapters
|
32
38
|
- lib/active_record
|
33
|
-
- lib/odbc_adapter.rb
|
34
39
|
- lib/active_record/connection_adapters
|
35
|
-
- lib/active_record/vendor
|
36
40
|
- lib/active_record/connection_adapters/odbc_adapter.rb
|
37
|
-
- lib/active_record/vendor
|
41
|
+
- lib/active_record/vendor
|
42
|
+
- lib/active_record/vendor/odbcext_oracle.rb
|
38
43
|
- lib/active_record/vendor/odbcext_informix.rb
|
39
|
-
- lib/active_record/vendor/
|
40
|
-
- lib/active_record/vendor/odbcext_ingres.rb
|
41
|
-
- lib/active_record/vendor/odbcext_microsoftsqlserver.rb
|
44
|
+
- lib/active_record/vendor/odbcext_progress89.rb
|
42
45
|
- lib/active_record/vendor/odbcext_microsoftsqlserver_col.rb
|
43
|
-
- lib/active_record/vendor/
|
44
|
-
- lib/active_record/vendor/
|
46
|
+
- lib/active_record/vendor/odbcext_informix_col.rb
|
47
|
+
- lib/active_record/vendor/odbcext_sqlanywhere.rb
|
45
48
|
- lib/active_record/vendor/odbcext_postgresql.rb
|
46
|
-
- lib/active_record/vendor/odbcext_progress.rb
|
47
|
-
- lib/active_record/vendor/odbcext_progress89.rb
|
48
|
-
- lib/active_record/vendor/odbcext_sybase.rb
|
49
49
|
- lib/active_record/vendor/odbcext_sybase_col.rb
|
50
|
+
- lib/active_record/vendor/odbcext_mysql.rb
|
51
|
+
- lib/active_record/vendor/odbcext_db2.rb
|
52
|
+
- lib/active_record/vendor/odbcext_progress.rb
|
53
|
+
- lib/active_record/vendor/odbcext_microsoftsqlserver.rb
|
54
|
+
- lib/active_record/vendor/odbcext_ingres.rb
|
55
|
+
- lib/active_record/vendor/odbcext_sqlanywhere_col.rb
|
50
56
|
- lib/active_record/vendor/odbcext_virtuoso.rb
|
57
|
+
- lib/active_record/vendor/odbcext_sybase.rb
|
58
|
+
- lib/vendor
|
59
|
+
- lib/odbc_adapter.rb
|
51
60
|
- test/connections
|
52
|
-
- test/fixtures
|
53
61
|
- test/connections/native_odbc
|
54
62
|
- test/connections/native_odbc/connection.rb
|
63
|
+
- test/fixtures
|
55
64
|
- test/fixtures/db_definitions
|
56
|
-
- test/fixtures/db_definitions/db2.drop.sql
|
57
|
-
- test/fixtures/db_definitions/db2.sql
|
58
65
|
- test/fixtures/db_definitions/db22.drop.sql
|
59
|
-
- test/fixtures/db_definitions/
|
60
|
-
- test/fixtures/db_definitions/informix.drop.sql
|
61
|
-
- test/fixtures/db_definitions/informix.sql
|
62
|
-
- test/fixtures/db_definitions/informix2.drop.sql
|
63
|
-
- test/fixtures/db_definitions/informix2.sql
|
64
|
-
- test/fixtures/db_definitions/ingres.drop.sql
|
65
|
-
- test/fixtures/db_definitions/ingres.sql
|
66
|
-
- test/fixtures/db_definitions/ingres2.drop.sql
|
66
|
+
- test/fixtures/db_definitions/progress2.drop.sql
|
67
67
|
- test/fixtures/db_definitions/ingres2.sql
|
68
|
-
- test/fixtures/db_definitions/mysql.drop.sql
|
69
|
-
- test/fixtures/db_definitions/mysql.sql
|
70
|
-
- test/fixtures/db_definitions/mysql2.drop.sql
|
71
|
-
- test/fixtures/db_definitions/mysql2.sql
|
72
68
|
- test/fixtures/db_definitions/oracle_odbc.drop.sql
|
73
|
-
- test/fixtures/db_definitions/
|
74
|
-
- test/fixtures/db_definitions/
|
75
|
-
- test/fixtures/db_definitions/
|
76
|
-
- test/fixtures/db_definitions/postgresql.drop.sql
|
77
|
-
- test/fixtures/db_definitions/postgresql.sql
|
78
|
-
- test/fixtures/db_definitions/postgresql2.drop.sql
|
69
|
+
- test/fixtures/db_definitions/mysql2.sql
|
70
|
+
- test/fixtures/db_definitions/virtuoso.sql
|
71
|
+
- test/fixtures/db_definitions/virtuoso2.drop.sql
|
79
72
|
- test/fixtures/db_definitions/postgresql2.sql
|
80
|
-
- test/fixtures/db_definitions/
|
81
|
-
- test/fixtures/db_definitions/
|
82
|
-
- test/fixtures/db_definitions/
|
73
|
+
- test/fixtures/db_definitions/db2.drop.sql
|
74
|
+
- test/fixtures/db_definitions/informix2.sql
|
75
|
+
- test/fixtures/db_definitions/postgresql2.drop.sql
|
83
76
|
- test/fixtures/db_definitions/progress2.sql
|
77
|
+
- test/fixtures/db_definitions/mysql.drop.sql
|
78
|
+
- test/fixtures/db_definitions/sybase2.sql
|
79
|
+
- test/fixtures/db_definitions/sybase.sql
|
80
|
+
- test/fixtures/db_definitions/mysql.sql
|
81
|
+
- test/fixtures/db_definitions/sqlserver2.sql
|
82
|
+
- test/fixtures/db_definitions/oracle_odbc2.drop.sql
|
84
83
|
- test/fixtures/db_definitions/sqlserver.drop.sql
|
84
|
+
- test/fixtures/db_definitions/virtuoso2.sql
|
85
|
+
- test/fixtures/db_definitions/db2.sql
|
86
|
+
- test/fixtures/db_definitions/ingres.sql
|
87
|
+
- test/fixtures/db_definitions/oracle_odbc.sql
|
88
|
+
- test/fixtures/db_definitions/progress.drop.sql
|
85
89
|
- test/fixtures/db_definitions/sqlserver.sql
|
86
|
-
- test/fixtures/db_definitions/sqlserver2.drop.sql
|
87
|
-
- test/fixtures/db_definitions/sqlserver2.sql
|
88
90
|
- test/fixtures/db_definitions/sybase.drop.sql
|
89
|
-
- test/fixtures/db_definitions/
|
90
|
-
- test/fixtures/db_definitions/
|
91
|
-
- test/fixtures/db_definitions/
|
91
|
+
- test/fixtures/db_definitions/postgresql.sql
|
92
|
+
- test/fixtures/db_definitions/informix2.drop.sql
|
93
|
+
- test/fixtures/db_definitions/mysql2.drop.sql
|
94
|
+
- test/fixtures/db_definitions/progress.sql
|
95
|
+
- test/fixtures/db_definitions/sqlserver2.drop.sql
|
92
96
|
- test/fixtures/db_definitions/virtuoso.drop.sql
|
93
|
-
- test/fixtures/db_definitions/
|
94
|
-
- test/fixtures/db_definitions/
|
95
|
-
- test/fixtures/db_definitions/
|
96
|
-
-
|
97
|
-
-
|
97
|
+
- test/fixtures/db_definitions/informix.drop.sql
|
98
|
+
- test/fixtures/db_definitions/db22.sql
|
99
|
+
- test/fixtures/db_definitions/sybase2.drop.sql
|
100
|
+
- test/fixtures/db_definitions/informix.sql
|
101
|
+
- test/fixtures/db_definitions/postgresql.drop.sql
|
102
|
+
- test/fixtures/db_definitions/ingres2.drop.sql
|
103
|
+
- test/fixtures/db_definitions/oracle_odbc2.sql
|
104
|
+
- test/fixtures/db_definitions/ingres.drop.sql
|
98
105
|
- support/pack_odbc.rb
|
99
|
-
- support/
|
100
|
-
- support/
|
101
|
-
- support/test
|
106
|
+
- support/odbc_rails.diff
|
107
|
+
- support/lib
|
102
108
|
- support/lib/active_record
|
103
109
|
- support/lib/active_record/connection_adapters
|
104
110
|
- support/lib/active_record/connection_adapters/abstract
|
105
111
|
- support/lib/active_record/connection_adapters/abstract/schema_definitions.rb
|
106
|
-
- support/
|
112
|
+
- support/rake_fixes
|
107
113
|
- support/rake_fixes/databases.dif
|
108
114
|
- support/rake_fixes/README
|
109
|
-
- support/
|
115
|
+
- support/rake
|
116
|
+
- support/rake/rails_plugin_package_task.rb
|
117
|
+
- support/test
|
110
118
|
- support/test/migration_test.rb
|
119
|
+
- support/test/base_test.rb
|
111
120
|
- AUTHORS
|
112
121
|
- ChangeLog
|
113
122
|
- COPYING
|
114
123
|
- LICENSE
|
115
124
|
- NEWS
|
116
125
|
- README
|
117
|
-
|
118
|
-
|
126
|
+
has_rdoc: true
|
127
|
+
homepage: http://odbc-rails.rubyforge.org
|
128
|
+
post_install_message:
|
119
129
|
rdoc_options:
|
120
130
|
- --title
|
121
131
|
- OpenLink ODBC Adapter for Ruby on Rails
|
@@ -135,22 +145,26 @@ rdoc_options:
|
|
135
145
|
- test
|
136
146
|
- --include
|
137
147
|
- active_record/connection_adapters/*.rb
|
138
|
-
|
139
|
-
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: "0"
|
155
|
+
version:
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: "0"
|
161
|
+
version:
|
145
162
|
requirements: []
|
146
163
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: "1.15"
|
156
|
-
version:
|
164
|
+
rubyforge_project:
|
165
|
+
rubygems_version: 1.1.1
|
166
|
+
signing_key:
|
167
|
+
specification_version: 2
|
168
|
+
summary: ODBC Data Adapter for ActiveRecord.
|
169
|
+
test_files: []
|
170
|
+
|