spariev-activerecord-odbc-adapter 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/AUTHORS +16 -0
  2. data/COPYING +21 -0
  3. data/ChangeLog +147 -0
  4. data/LICENSE +5 -0
  5. data/NEWS +25 -0
  6. data/README +229 -0
  7. data/Rakefile +191 -0
  8. data/VERSION.yml +4 -0
  9. data/lib/active_record/connection_adapters/odbc_adapter.rb +1958 -0
  10. data/lib/active_record/vendor/odbcext_db2.rb +87 -0
  11. data/lib/active_record/vendor/odbcext_informix.rb +144 -0
  12. data/lib/active_record/vendor/odbcext_informix_col.rb +45 -0
  13. data/lib/active_record/vendor/odbcext_ingres.rb +156 -0
  14. data/lib/active_record/vendor/odbcext_microsoftsqlserver.rb +216 -0
  15. data/lib/active_record/vendor/odbcext_microsoftsqlserver_col.rb +40 -0
  16. data/lib/active_record/vendor/odbcext_mysql.rb +174 -0
  17. data/lib/active_record/vendor/odbcext_oracle.rb +219 -0
  18. data/lib/active_record/vendor/odbcext_postgresql.rb +158 -0
  19. data/lib/active_record/vendor/odbcext_progress.rb +139 -0
  20. data/lib/active_record/vendor/odbcext_progress89.rb +259 -0
  21. data/lib/active_record/vendor/odbcext_sqlanywhere.rb +115 -0
  22. data/lib/active_record/vendor/odbcext_sqlanywhere_col.rb +49 -0
  23. data/lib/active_record/vendor/odbcext_sybase.rb +213 -0
  24. data/lib/active_record/vendor/odbcext_sybase_col.rb +49 -0
  25. data/lib/active_record/vendor/odbcext_virtuoso.rb +158 -0
  26. data/lib/odbc_adapter.rb +28 -0
  27. data/test/connections/native_odbc/connection.rb +137 -0
  28. data/test/fixtures/db_definitions/db2.drop.sql +33 -0
  29. data/test/fixtures/db_definitions/db2.sql +237 -0
  30. data/test/fixtures/db_definitions/db22.drop.sql +2 -0
  31. data/test/fixtures/db_definitions/db22.sql +5 -0
  32. data/test/fixtures/db_definitions/informix.drop.sql +33 -0
  33. data/test/fixtures/db_definitions/informix.sql +223 -0
  34. data/test/fixtures/db_definitions/informix2.drop.sql +2 -0
  35. data/test/fixtures/db_definitions/informix2.sql +5 -0
  36. data/test/fixtures/db_definitions/ingres.drop.sql +68 -0
  37. data/test/fixtures/db_definitions/ingres.sql +252 -0
  38. data/test/fixtures/db_definitions/ingres2.drop.sql +2 -0
  39. data/test/fixtures/db_definitions/ingres2.sql +5 -0
  40. data/test/fixtures/db_definitions/mysql.drop.sql +33 -0
  41. data/test/fixtures/db_definitions/mysql.sql +238 -0
  42. data/test/fixtures/db_definitions/mysql2.drop.sql +2 -0
  43. data/test/fixtures/db_definitions/mysql2.sql +5 -0
  44. data/test/fixtures/db_definitions/oracle_odbc.drop.sql +72 -0
  45. data/test/fixtures/db_definitions/oracle_odbc.sql +296 -0
  46. data/test/fixtures/db_definitions/oracle_odbc2.drop.sql +2 -0
  47. data/test/fixtures/db_definitions/oracle_odbc2.sql +6 -0
  48. data/test/fixtures/db_definitions/postgresql.drop.sql +38 -0
  49. data/test/fixtures/db_definitions/postgresql.sql +267 -0
  50. data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
  51. data/test/fixtures/db_definitions/postgresql2.sql +5 -0
  52. data/test/fixtures/db_definitions/progress.drop.sql +67 -0
  53. data/test/fixtures/db_definitions/progress.sql +255 -0
  54. data/test/fixtures/db_definitions/progress2.drop.sql +2 -0
  55. data/test/fixtures/db_definitions/progress2.sql +6 -0
  56. data/test/fixtures/db_definitions/sqlserver.drop.sql +35 -0
  57. data/test/fixtures/db_definitions/sqlserver.sql +247 -0
  58. data/test/fixtures/db_definitions/sqlserver2.drop.sql +2 -0
  59. data/test/fixtures/db_definitions/sqlserver2.sql +5 -0
  60. data/test/fixtures/db_definitions/sybase.drop.sql +35 -0
  61. data/test/fixtures/db_definitions/sybase.sql +222 -0
  62. data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
  63. data/test/fixtures/db_definitions/sybase2.sql +5 -0
  64. data/test/fixtures/db_definitions/virtuoso.drop.sql +33 -0
  65. data/test/fixtures/db_definitions/virtuoso.sql +218 -0
  66. data/test/fixtures/db_definitions/virtuoso2.drop.sql +2 -0
  67. data/test/fixtures/db_definitions/virtuoso2.sql +5 -0
  68. metadata +130 -0
data/AUTHORS ADDED
@@ -0,0 +1,16 @@
1
+ #
2
+ # List of Authors/Contributors
3
+ #
4
+
5
+ Original Author:
6
+ ----------------
7
+ Carl Blakeley <cblakeley@openlinksw.co.uk> (cb)
8
+
9
+
10
+ Current Maintainer:
11
+ -------------------
12
+ Patrick van Kleef <iodbc@@openlinksw.com> (pvk)
13
+
14
+
15
+ Contributors:
16
+ -------------
data/COPYING ADDED
@@ -0,0 +1,21 @@
1
+ OpenLink ODBC Adapter for Ruby on Rails
2
+ Copyright (C) 2006 OpenLink Software
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject
10
+ to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
19
+ ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20
+ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,147 @@
1
+ 2008-04-23 15:18 source
2
+
3
+ * Updated version to 2.0 for final release
4
+
5
+ 2008-04-23 15:17 source
6
+
7
+ * Updated documentation
8
+
9
+ 2008-04-22 16:55 source
10
+
11
+ * Added support for DSN-less connections
12
+
13
+ 2008-04-22 16:52 source
14
+
15
+ * Added initial support for SQL Anywhere
16
+
17
+ 2008-04-14 11:02 source
18
+
19
+ * Updated version to 1.9.9
20
+
21
+ 2008-04-13 22:46 source
22
+
23
+ * Added initial support for Rails 2.0.x / ActiveRecord 2.0.x
24
+
25
+ 2007-02-27 15:28 source
26
+
27
+ * Set version 1.4 for final release
28
+
29
+ 2007-02-27 12:53 source
30
+
31
+ * Small rdoc fix
32
+
33
+ 2007-02-27 11:05 source
34
+
35
+ * Added small diff for rake unit testing
36
+
37
+ 2007-02-27 11:00 source
38
+
39
+ * Changes for Rails 1.2.x / ActiveRecord 1.15.x
40
+ * Added support for :decimal type
41
+ * Added :emulate_booleans connection option
42
+
43
+ 2007-01-09 10:18 source
44
+
45
+ * Updated version number to 1.3
46
+
47
+ 2007-01-09 10:11 source
48
+
49
+ * Added support for PostgreSQL
50
+
51
+ 2006-12-11 12:01 source
52
+
53
+ * Updated for final release 1.2
54
+
55
+ 2006-12-11 12:00 source
56
+
57
+ * Added additional documentation for installing gem and plugin version
58
+
59
+ 2006-12-06 16:16 source
60
+
61
+ * Added for gem support
62
+
63
+ 2006-12-06 16:14 source
64
+
65
+ * Added dependency to activerecord
66
+
67
+ 2006-12-06 15:01 source
68
+
69
+ * Fixed version number
70
+
71
+ 2006-12-06 15:01 source
72
+
73
+ * Changed doc into rdoc
74
+
75
+ 2006-12-06 14:55 source
76
+
77
+ * Added support for building plugin
78
+ * Added support for building gem
79
+
80
+ 2006-12-06 14:42 source
81
+
82
+ * Changed directory structure for building both plugin and gem
83
+
84
+ 2006-11-22 15:53 source
85
+
86
+ * Added support for Progress versions 8 (SQL89 engine), 9 & 10 (SQL92 engine)
87
+
88
+ 2006-10-18 14:32 source
89
+
90
+ * Updated package version to 1.1
91
+
92
+ 2006-10-18 12:35 source
93
+
94
+ * Added unicode types (th)
95
+
96
+ 2006-10-10 14:13 source
97
+
98
+ * Less files to ignore
99
+
100
+ 2006-10-10 14:13 source
101
+
102
+ * Removed comment from notes about unicode support
103
+
104
+ 2006-10-10 10:57 source
105
+
106
+ * Reindented code (cmb)
107
+
108
+ 2006-10-09 09:03 source
109
+
110
+ * Latest diff for rails code (cmb)
111
+
112
+ 2006-10-09 07:25 source
113
+
114
+ * Added support for DB2 (cmb)
115
+
116
+ 2006-10-09 07:23 source
117
+
118
+ * Renamed sybase_odbc.sql to sybase.sql (cmb)
119
+
120
+ 2006-09-28 10:31 source
121
+
122
+ * Added support for MySQL, Sybase and SQL Server (cb)
123
+
124
+ 2006-08-23 14:07 source
125
+
126
+ * Final documentation patches
127
+
128
+ 2006-08-22 20:26 source
129
+
130
+ Initial checkin
131
+
132
+ 2006-08-21 23:37 source
133
+
134
+ Initial checkin
135
+
136
+ 2006-08-21 14:00 source
137
+
138
+ Initial checkin
139
+
140
+ 2006-08-21 12:57 source
141
+
142
+ Initial checkin
143
+
144
+ 2006-08-17 16:54 source
145
+
146
+ Initial checkin
147
+
data/LICENSE ADDED
@@ -0,0 +1,5 @@
1
+ ODBC Adapter for Ruby on Rails
2
+ Copyright (C) 2006 OpenLink Software
3
+
4
+ The OpenLink ODBC Adapter for Ruby on Rails is released under the
5
+ MIT license (see COPYING).
data/NEWS ADDED
@@ -0,0 +1,25 @@
1
+ April 23, 2008, V2.0:
2
+ * Changes for Rails 2.0.x / ActiveRecord 2.0.x
3
+ * Added support for DSN-less connections
4
+ * Added support for SQLAnywhere
5
+
6
+ February 27, 2007, V1.4:
7
+ * Changes for Rails 1.2.x / ActiveRecord 1.15.x
8
+ * Added support for :decimal type
9
+ * Added :emulate_booleans connection option
10
+
11
+ January 9, 2007, V1.3:
12
+ * Added support for PostgreSQL
13
+
14
+ December 11, 2006, V1.2:
15
+ * Added option to install adapter as a gem
16
+ * Added option to install adapter as a plugin
17
+ * Added support for Progress 8 (SQL 89)
18
+ * Added support for Progress 9 and 10 (SQL 92)
19
+
20
+ October 18, 2006, V1.1:
21
+ * Added support for DB2, MySQL, Sybase and SQL Server
22
+ * Fixed initial unicode support
23
+
24
+ August 23 2006, V1.0:
25
+ * Initial archive
data/README ADDED
@@ -0,0 +1,229 @@
1
+ = OpenLink ODBC Data Adapter for Ruby on Rails
2
+
3
+ (C) 2008 OpenLink Software
4
+
5
+
6
+ == Status
7
+
8
+ <b>23-Apr-2008</b>
9
+
10
+ The adapter has been updated to support Rails 2.0.2 / ActiveRecord 2.0.2
11
+ The new adapter (v2.0) is not recommended for use with earlier releases of
12
+ Rails or ActiveRecord.
13
+
14
+ * For Rails 2.0.2 / ActiveRecord 2.0.2 or later, use odbc-rails v2.0
15
+ * For Rails 1.2.x / ActiveRecord 1.15.x, use odbc-rails v1.5
16
+ * For Rails 1.1.x / ActiveRecord 1.14.x, use odbc-rails v1.3
17
+
18
+ The configuration instructions for v1.4 or earlier differ slightly from those
19
+ included here for v2.0. Please refer to the documentation packaged with the
20
+ respective adapter when using the previous releases.
21
+
22
+ Added support for DSN-less connections (thanks to Ralf Vitasek).
23
+ Added support for SQLAnywhere (thanks to Bryan Lahartinger).
24
+
25
+ <b>23-Feb-2007</b>
26
+
27
+ The adapter has been updated to support Rails 1.2.x / ActiveRecord 1.15.x.
28
+ The new adapter (v1.4) is not recommended for use with Rails 1.1 / ActiveRecord
29
+ 1.14.x. Please use v1.3 of the adapter with Rails 1.1.
30
+
31
+ The driver now supports the new ActiveRecord :decimal type and an
32
+ :emulate_booleans connection option. See http://odbc-rails.rubyforge.org for
33
+ more information about this option.
34
+
35
+ <b>09-Jan-2007</b>
36
+
37
+ The adapter accompanying this note is a Generic ODBC Adapter for Ruby on Rails
38
+ being developed by <B>OpenLink&nbsp;Software</B>[http://www.openlinksw.com].
39
+
40
+ The aim of this development is to provide a single ODBC-based adapter
41
+ capable of supporting the most popular DBMSes, in contrast to the
42
+ current approach in the Rails community of each database requiring
43
+ its own adapter.
44
+
45
+ It currently supports Ingres r3, Informix 9.3 or later, Oracle 10g,
46
+ MySQL 5 and OpenLink's Virtuoso
47
+ (Open&nbsp;Source&nbsp;Edition[http://virtuoso.openlinksw.com]),
48
+ SQL Server 2000/2005, Sybase ASE 15, DB2 v9, Progress v8/9/10 and PostgreSQL 8.2.
49
+
50
+ Testing to date has been limited to the ROR 'Expenses' sample
51
+ application described at http://developer.apple.com/tools/rubyonrails.html
52
+ and the ActiveRecord test modules base_test.rb and migration_test.rb.
53
+
54
+ Testing has been performed on Linux, Windows and Mac OS X using
55
+ OpenLink's own ODBC drivers and the native Virtuoso ODBC client.
56
+
57
+
58
+ == Pre-Requisites
59
+
60
+ The OpenLink ODBC Adapter for Ruby on Rails needs the
61
+ ActiveRecord[http://wiki.rubyonrails.com/rails/pages/ActiveRecord]
62
+ package installed.
63
+
64
+ The Adapter also requires Christian Werner's
65
+ Ruby&nbsp;ODBC&nbsp;Bridge[http://www.ch-werner.de/rubyodbc]
66
+ (release 0.9991 or later), to bridge to an underlying ODBC driver.
67
+
68
+
69
+ == Contents
70
+
71
+ In the accompanying sources, the lib directory structure is equivalent
72
+ to the lib directory located under ACTIVE_RECORD_ROOT in your main
73
+ Ruby tree.
74
+
75
+ On Windows ACTIVE_RECORD_ROOT will be something like:
76
+
77
+ c:\ruby\lib\ruby\gems\1.8\gems\activerecord-x.y.z
78
+
79
+ On Unix and Mac OS X ACTIVE_RECORD_ROOT will be something like:
80
+
81
+ /usr/lib/ruby/gems/1.8/gems/activerecord-x.y.z
82
+ or
83
+ /usr/local/lib/ruby/gems/1.8/gems/activerecord-x.y.z
84
+
85
+ On Mac OS X using Locomotive ACTIVE_RECORD_ROOT will be
86
+ something like:
87
+
88
+ /Applications/Locomotive2/bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-x.y.z
89
+
90
+ lib/ contains the files which constitute the new ODBC adapter.
91
+
92
+ test/ contains the fixture definitions for testing the adapter.
93
+
94
+ support/odbc_rails.diff contains some patches to ActiveRecord tests.
95
+
96
+ The patches to base_test.rb and migration_test.rb are not essential.
97
+ However, they modify or bypass certain tests to cope with limitations
98
+ of particular databases. Other developers have previously modified
99
+ the tests similarly to cope with limitations of other Rails-supported
100
+ databases. The patched versions of files touched by odbc_rails.diff can
101
+ be found in support/test.
102
+
103
+ == Installation
104
+
105
+ There are 3 ways to install the ODBC Adapter package: either as a gem
106
+ (recommended), a plugin, or by running the custom installation script. Pick
107
+ one of the following, depending on whether you want the adapter to be
108
+ available system-wide or just within a particular Rails project.
109
+
110
+ === Installation as a Gem
111
+
112
+ * Install the odbc-rails gem by running:
113
+
114
+ # gem install -r activerecord-odbc-adapter --include-dependencies
115
+
116
+
117
+ === Installation as a Plugin
118
+
119
+ Installing the OpenLink ODBC Data Adapter as a plugin makes it available to
120
+ a particular Rails application only.
121
+
122
+ ==== Automatic Plugin installation
123
+
124
+ The adapter can be automatically installed as a plugin by navigating to the
125
+ root of your Rails application and typing either:
126
+
127
+ script/plugin install odbc-rails
128
+ or
129
+ script/plugin install http://odbc-rails.rubyforge.org/plugins/odbc-rails
130
+
131
+ On Windows, replace <tt>script/plugin</tt> by <tt>ruby script/plugin</tt>.
132
+ e.g. <tt>ruby script/plugin install odbc-rails</tt>
133
+
134
+
135
+ ==== Manual Plugin Installation
136
+
137
+ You can also install the plugin manually by unpacking the sources into the
138
+ vendor/plugins directory of your Rails application.
139
+
140
+ === Custom installation script
141
+
142
+ When using <tt>rake install</tt> or running the install_odbc.rb script by
143
+ hand, the script tries to determine the location of the activerecord
144
+ package within your Ruby installation and allows you to overrule the
145
+ directory it has found with a directory of your choice. If more than one
146
+ version of activerecord is found, the default will be the latest version.
147
+
148
+ On Mac OS X the installation script is also capable of locating Locomotive,
149
+ if installed, and will ask to install in there.
150
+
151
+ The install_odbc.rb script also verifies that the pre-requisites are
152
+ installed.
153
+
154
+ If all else fails this document also describes the steps to install the
155
+ ODBC adapter into activerecord manually.
156
+
157
+
158
+ ==== Using rake
159
+
160
+ The simplest way to install the adapter is by using the following
161
+ command as root:
162
+
163
+ # rake install
164
+
165
+ or if your system supports sudo:
166
+
167
+ $ sudo rake install
168
+
169
+
170
+ The Rakefile also defines some targets specifically for developers:
171
+
172
+ $ rake rdoc # Generate rdoc documentation in ~/doc
173
+
174
+ $ rake package # Create distribution package in ~/distrib
175
+
176
+ $ rake clean # Remove generated files and directories
177
+
178
+
179
+ ==== Running installation script
180
+
181
+ The second way of installing the adapter is running the
182
+ <tt>install_odbc.rb</tt> script as root.
183
+
184
+ # ruby install_odbc.rb
185
+
186
+ or if your system supports sudo:
187
+
188
+ $ sudo ruby install_odbc.rb
189
+
190
+
191
+ === Installing files manually
192
+
193
+ The third way of installing the adapter is by performing the installation
194
+ steps yourself.
195
+
196
+ * Copy odbc_adapter.rb to the ACTIVE_RECORD_ROOT/lib/active_record/connection_adapters/ directory
197
+
198
+ * Copy the odbcext_*.rb files to the ACTIVE_RECORD_ROOT/lib/active_record/vendor/ directory
199
+
200
+ == Configuring the Adapter
201
+
202
+ Examples of the required connection parameters can be found in
203
+
204
+ test/connections/native_odbc/connection.rb
205
+
206
+ If you enable call-tracing by setting :trace => true, specify the
207
+ logger output file as illustrated in connection.rb, e.g.
208
+
209
+ ActiveRecord::Base.logger = Logger.new("debug_odbc.log")
210
+
211
+ == License
212
+
213
+ The OpenLink ODBC Adapter for Ruby on Rails is released under the
214
+ MIT license as detailed in the file COPYING.
215
+
216
+
217
+ === Submitting fixes and enhancements
218
+
219
+ Patches and new contributions can be submitted as diffs from the
220
+ current CVS archive by:
221
+
222
+ $ cvs add newfiles
223
+
224
+ $ cvs -z3 diff -uN > diffs
225
+
226
+ Patches and contributions can be send to the OpenLink iODBC source
227
+ archive mainainter at mailto:iodbc@openlinksw.com to be included
228
+ in the next distribution. Please provide accompanying documentation
229
+ on which bugs are fixed or new features are introduced.