Permalink
Browse files

Merge branch 'abevoelker-add-openedge-adapter'

Conflicts:
	data_objects/lib/data_objects/spec/shared/connection_spec.rb
  • Loading branch information...
2 parents 012db27 + 6a8083e commit 55c3b841cc121154e68b8deb1d1716542054cbf7 @dbussink dbussink committed Sep 27, 2012
Showing with 1,284 additions and 15 deletions.
  1. +4 −0 README.markdown
  2. +10 −15 data_objects/lib/data_objects/spec/shared/connection_spec.rb
  3. +3 −0 do_jdbc/src/main/java/data_objects/Command.java
  4. +11 −0 do_jdbc/src/main/java/data_objects/drivers/AbstractDriverDefinition.java
  5. +10 −0 do_jdbc/src/main/java/data_objects/drivers/DriverDefinition.java
  6. +2 −0 do_openedge/.rspec
  7. 0 do_openedge/ChangeLog.markdown
  8. +14 −0 do_openedge/Gemfile
  9. +19 −0 do_openedge/LICENSE
  10. +107 −0 do_openedge/README.markdown
  11. +25 −0 do_openedge/Rakefile
  12. +27 −0 do_openedge/buildfile
  13. +96 −0 do_openedge/do_openedge.gemspec
  14. +19 −0 do_openedge/ext-java/src/main/java/do_openedge/DoOpenedgeService.java
  15. +211 −0 do_openedge/ext-java/src/main/java/do_openedge/OpenEdgeDriverDefinition.java
  16. +29 −0 do_openedge/lib/do_openedge.rb
  17. +5 −0 do_openedge/lib/do_openedge/version.rb
  18. +9 −0 do_openedge/spec/command_spec.rb
  19. +23 −0 do_openedge/spec/connection_spec.rb
  20. +8 −0 do_openedge/spec/encoding_spec.rb
  21. 0 do_openedge/spec/rcov.opts
  22. +8 −0 do_openedge/spec/reader_spec.rb
  23. +16 −0 do_openedge/spec/result_spec.rb
  24. +261 −0 do_openedge/spec/spec_helper.rb
  25. +8 −0 do_openedge/spec/typecast/array_spec.rb
  26. +54 −0 do_openedge/spec/typecast/bigdecimal_spec.rb
  27. +9 −0 do_openedge/spec/typecast/boolean_spec.rb
  28. +96 −0 do_openedge/spec/typecast/byte_array_spec.rb
  29. +68 −0 do_openedge/spec/typecast/class_spec.rb
  30. +9 −0 do_openedge/spec/typecast/date_spec.rb
  31. +9 −0 do_openedge/spec/typecast/datetime_spec.rb
  32. +9 −0 do_openedge/spec/typecast/float_spec.rb
  33. +8 −0 do_openedge/spec/typecast/integer_spec.rb
  34. +10 −0 do_openedge/spec/typecast/nil_spec.rb
  35. +8 −0 do_openedge/spec/typecast/other_spec.rb
  36. +8 −0 do_openedge/spec/typecast/range_spec.rb
  37. +8 −0 do_openedge/spec/typecast/string_spec.rb
  38. +8 −0 do_openedge/spec/typecast/time_spec.rb
  39. +30 −0 do_openedge/tasks/compile.rake
  40. +14 −0 do_openedge/tasks/release.rake
  41. +11 −0 do_openedge/tasks/spec.rake
View
@@ -44,6 +44,10 @@ At present the following drivers are available:
<td>SQL Server</td>
<td><em>pending</em></td>
<td>x</td></tr>
+ <tr>
+ <td>OpenEdge</td>
+ <td>-</td>
+ <td>x</td></tr>
</table>
There is experimental support for [Rubinius][rubinius].
@@ -1,3 +1,13 @@
+def test_connection(conn)
+ reader = conn.create_command(CONFIG.testsql || "SELECT 1").execute_reader
+ reader.next!
+ result = reader.values[0]
+ result
+ensure
+ reader.close
+ conn.close
+end
+
shared_examples_for 'a Connection' do
before :all do
@@ -25,11 +35,6 @@
end
describe 'various connection URIs' do
- def test_connection(conn)
- reader = conn.create_command(CONFIG.testsql || "SELECT 1").execute_reader
- reader.next!
- reader.values[0]
- end
it 'should open with an uri object' do
uri = DataObjects::URI.new(
@@ -141,16 +146,6 @@ def connecting_with(uri)
end
end
-def test_connection(conn)
- reader = conn.create_command(CONFIG.testsql || "SELECT 1").execute_reader
- reader.next!
- result = reader.values[0]
- result
-ensure
- reader.close
- conn.close
-end
-
shared_examples_for 'a Connection with JDBC URL support' do
it 'should work with JDBC URLs' do
@@ -190,6 +190,9 @@ public IRubyObject execute_non_query(IRubyObject[] args) {
// If there is no support, then a custom method can be defined
// to return a ResultSet with keys
keys = driver.getGeneratedKeys(conn);
+ // The OpenEdge driver needs additional information
+ if (keys == null)
+ keys = driver.getGeneratedKeys(conn, sqlStatement, sqlText);
}
}
if (usePS && keys != null) {
@@ -562,6 +562,17 @@ public ResultSet getGeneratedKeys(Connection connection) {
/**
*
+ * @param connection
+ * @param ps
+ * @param sqlText
+ * @return
+ */
+ public ResultSet getGeneratedKeys(Connection connection, PreparedStatement ps, String sqlText) throws SQLException{
+ return null;
+ }
+
+ /**
+ *
* @return
*/
public Properties getDefaultConnectionProperties() {
@@ -156,6 +156,16 @@ public void setPreparedStatementParam(PreparedStatement ps,
public ResultSet getGeneratedKeys(Connection connection);
/**
+ * Same as above, except with extra parameters (needed by the OpenEdge driver)
+ *
+ * @param connection
+ * @param ps
+ * @param sqlText
+ * @return
+ */
+ public ResultSet getGeneratedKeys(Connection connection, PreparedStatement ps, String sqlText) throws SQLException;
+
+ /**
* A default list of properties for a connection for a driver.
*
* @return
View
@@ -0,0 +1,2 @@
+--format documentation
+--colour
No changes.
View
@@ -0,0 +1,14 @@
+source :rubygems
+
+path '../'
+
+gemspec
+
+platforms :jruby do
+ gem 'jdbc-openedge'
+ gem 'do_jdbc'
+end
+
+group :development do # Development dependencies (as in the gemspec)
+ gem 'rake', '~> 0.8.7'
+end
View
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Abe Voelker, other DataObjects contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -0,0 +1,107 @@
+# do_openedge
+
+* <http://dataobjects.info>
+
+## Description
+
+An OpenEdge driver for DataObjects.
+
+## Features/Problems
+
+This driver implements the DataObjects API for the Progress OpenEdge relational database.
+This driver is currently provided only for JRuby.
+
+### Known Issues
+
+ * `BLOB`/`CLOB` fields cannot be used as predicates or arithmetic/comparison
+ operators. In other words, you cannot query rows based on their value. You
+ will have to query the rows using a different column value (there is no
+ issue doing reads or writes with `BLOB`/`CLOB` fields). See [ProKB P91964][0]
+ for more info.
+ * The 10.2B JDBC driver causes `DECIMAL`/`NUMERIC` SQL types to round up to the
+ nearest integer and then truncate all digits after the decimal point. According
+ to [ProKB P187898][1], it appears to be a regression bug in the JDBC driver.
+
+## Synopsis
+
+An example of usage:
+
+ @connection = DataObjects::Connection.new("openedge://localhost:4000/sports2000")
+ @reader = @connection.create_command('SELECT * FROM State').execute_reader
+ @reader.next!
+
+The `Connection` constructor should be passed either a DataObjects-style URI or
+JDBC-style URI:
+
+ openedge://user:password@host:port/database?option1=value1&option2=value2
+ jdbc:datadirect:openedge://host:port/database?user=<value>&password=<value>
+
+Note that the DataDirect proprietary-style JDBC URI tokenized with `;`s:
+
+ jdbc:datadirect:openedge://host:port;databaseName=database;user=<value>;password=<value>
+
+is **not** supported.
+
+## Requirements
+
+ * JRuby 1.3.1 + (1.4+ recommended)
+ * `data_objects` gem
+ * `do_jdbc` gem (shared library)
+
+## Install
+
+To install the gem:
+
+ jruby -S gem install do_openedge
+
+To compile and install from source:
+
+ * Install the Java Development Kit (provided if you are on a recent version of
+ Mac OS X) from <http://java.sun.com>
+ * Install a recent version of JRuby. Ensure `jruby` is in your `PATH` and/or
+ you have configured the `JRUBY_HOME` environment variable to point to your
+ JRuby installation.
+ * Install `data_objects` and `do_jdbc` with `jruby -S rake install`.
+ * Install this driver with `jruby -S rake install`.
+
+## Developers
+
+Follow the above installation instructions. Additionally, you'll need:
+ * `rspec` gem for running specs.
+ * `YARD` gem for generating documentation.
+
+See the DataObjects wiki for more comprehensive information:
+<http://wiki.github.com/datamapper/do/jruby>.
+
+To run specs:
+
+ jruby -S rake spec
+
+To run specs without compiling extensions first:
+
+ jruby -S rake spec_no_compile
+
+To run individual specs:
+
+ jruby -S rake spec SPEC=spec/connection_spec.rb
+
+### Spec data setup
+
+The specs require an empty database to use for running tests against
+(the database will be written/read from by the tests). Here are
+some commands to be ran from `proenv` to create an empty
+database that can be used for testing (note the use of UTF-8,
+which is required for proper multibyte string support):
+
+ prodb test empty
+ proutil test -C convchar convert utf-8
+ sql_env
+ proserve test -S 4000
+
+## License
+
+This code is licensed under an **MIT License**. Please see the
+accompanying `LICENSE` file.
+
+[0]: http://knowledgebase.progress.com/articles/Article/P91964
+[1]: http://knowledgebase.progress.com/articles/Article/P187898
View
@@ -0,0 +1,25 @@
+require 'pathname'
+require 'rubygems'
+require 'bundler'
+require 'rubygems/package_task'
+Bundler::GemHelper.install_tasks
+
+require 'rake'
+require 'rake/clean'
+
+ROOT = Pathname(__FILE__).dirname.expand_path
+
+require ROOT + 'lib/do_openedge/version'
+
+JRUBY = RUBY_PLATFORM =~ /java/
+IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
+WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
+SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
+
+CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext-java/target ])
+
+
+Rake::Task['build'].clear_actions if Rake::Task.task_defined?('build')
+task :build => [ :java, :gem ]
+
+FileList['tasks/**/*.rake'].each { |task| import task }
View
@@ -0,0 +1,27 @@
+# Apache Buildr buildfile for do_openedge
+# see http://incubator.apache.org/buildr/ for more information on Apache Buildr
+require 'buildr'
+require 'pathname'
+
+VERSION_NUMBER = '1.0'
+JDBC_SUPPORT = ['data_objects:jdbc:jar:1.0']
+TARGET_DIR = 'pkg/classes'
+repositories.remote << 'http://www.ibiblio.org/maven2/'
+
+define 'do_openedge' do
+ project.version = VERSION_NUMBER
+ project.group = 'data_objects.rb'
+
+ manifest['Copyright'] = 'Abe Voelker (C) 2012'
+
+ compile.using :target => '1.5', :lint => 'all', :deprecation => 'true'
+
+ define 'ext-java' do
+ package(:jar).clean.include(TARGET_DIR)
+
+ jdbc_support_jar = file('../../do_jdbc/lib/do_jdbc_internal.jar')
+ jdbc_support = artifact('data_objects:jdbc:jar:1.0').from(jdbc_support_jar)
+
+ compile.into(TARGET_DIR).with(JDBC_SUPPORT)
+ end
+end
@@ -0,0 +1,96 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{do_openedge}
+ s.version = "0.10.8"
+ s.platform = %q{java}
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Abe Voelker"]
+ s.date = %q{2012-06-05}
+ s.description = %q{Implements the DataObjects API for OpenEdge}
+ s.email = %q{abe@abevoelker.com}
+ s.extra_rdoc_files = [
+ "ChangeLog.markdown",
+ "LICENSE",
+ "README.markdown"
+ ]
+ s.files = [
+ "ChangeLog.markdown",
+ "LICENSE",
+ "README.markdown",
+ "Rakefile",
+ "lib/do_openedge.rb",
+ "lib/do_openedge/version.rb",
+ "spec/command_spec.rb",
+ "spec/connection_spec.rb",
+ "spec/encoding_spec.rb",
+ "spec/reader_spec.rb",
+ "spec/result_spec.rb",
+ "spec/spec_helper.rb",
+ "spec/typecast/array_spec.rb",
+ "spec/typecast/bigdecimal_spec.rb",
+ "spec/typecast/boolean_spec.rb",
+ "spec/typecast/byte_array_spec.rb",
+ "spec/typecast/class_spec.rb",
+ "spec/typecast/date_spec.rb",
+ "spec/typecast/datetime_spec.rb",
+ "spec/typecast/float_spec.rb",
+ "spec/typecast/integer_spec.rb",
+ "spec/typecast/nil_spec.rb",
+ "spec/typecast/other_spec.rb",
+ "spec/typecast/range_spec.rb",
+ "spec/typecast/string_spec.rb",
+ "spec/typecast/time_spec.rb",
+ "tasks/compile.rake",
+ "tasks/release.rake",
+ "tasks/spec.rake"
+ ]
+ s.require_paths = ["lib"]
+ s.rubyforge_project = %q{dorb}
+ s.rubygems_version = %q{1.6.2}
+ s.summary = %q{DataObjects OpenEdge Driver}
+ s.test_files = [
+ "spec/command_spec.rb",
+ "spec/connection_spec.rb",
+ "spec/encoding_spec.rb",
+ "spec/reader_spec.rb",
+ "spec/result_spec.rb",
+ "spec/spec_helper.rb",
+ "spec/typecast/array_spec.rb",
+ "spec/typecast/bigdecimal_spec.rb",
+ "spec/typecast/boolean_spec.rb",
+ "spec/typecast/byte_array_spec.rb",
+ "spec/typecast/class_spec.rb",
+ "spec/typecast/date_spec.rb",
+ "spec/typecast/datetime_spec.rb",
+ "spec/typecast/float_spec.rb",
+ "spec/typecast/integer_spec.rb",
+ "spec/typecast/nil_spec.rb",
+ "spec/typecast/other_spec.rb",
+ "spec/typecast/range_spec.rb",
+ "spec/typecast/string_spec.rb",
+ "spec/typecast/time_spec.rb"
+ ]
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<data_objects>, ["= 0.10.8"])
+ s.add_runtime_dependency(%q<do_jdbc>, ["= 0.10.8"])
+ s.add_development_dependency(%q<rspec>, ["~> 2.5"])
+ s.add_development_dependency(%q<rake-compiler>, ["~> 0.7"])
+ else
+ s.add_dependency(%q<data_objects>, ["= 0.10.8"])
+ s.add_dependency(%q<do_jdbc>, ["= 0.10.8"])
+ s.add_dependency(%q<rspec>, ["~> 2.5"])
+ s.add_dependency(%q<rake-compiler>, ["~> 0.7"])
+ end
+ else
+ s.add_dependency(%q<data_objects>, ["= 0.10.8"])
+ s.add_dependency(%q<do_jdbc>, ["= 0.10.8"])
+ s.add_dependency(%q<rspec>, ["~> 2.5"])
+ s.add_dependency(%q<rake-compiler>, ["~> 0.7"])
+ end
+end
Oops, something went wrong.

0 comments on commit 55c3b84

Please sign in to comment.