andrew311-activerecord-odbc-adapter 2.3.1

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