Skip to content

Commit 0e8bb5a

Browse files
author
Montana Mendy
authored
Add files via upload
1 parent 1f1b56a commit 0e8bb5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1824
-0
lines changed

do_h2/ChangeLog.markdown

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## 0.10.10 2012-10-11
2+
3+
No changes
4+
5+
## 0.10.9 2012-08-13
6+
7+
No changes
8+
9+
## 0.10.7 2011-10-13
10+
11+
No changes
12+
13+
## 0.10.6 2011-05-22
14+
15+
No changes
16+
17+
## 0.10.5 2011-05-03
18+
19+
No changes
20+
21+
## 0.10.4 2011-04-28
22+
23+
New features
24+
* Add save point to transactions (all)
25+
* JRuby 1.9 mode support (encodings etc.)
26+
27+
Bugfixes
28+
* Fix bug when using nested transactions in concurrent scenarios (all)
29+
* Use column aliases instead of names (jruby)
30+
31+
Other
32+
* Switch back to RSpec
33+
34+
## 0.10.3 2011-01-30
35+
* No changes
36+
37+
## 0.10.2 2010-05-19
38+
* No changes
39+
40+
## 0.10.1 2010-01-08
41+
42+
* Switch to Jeweler for Gem building tasks (this change may be temporary).
43+
* Switch to using Bacon for running specs: This should make specs friendlier to
44+
new Ruby implementations that are not yet 100% MRI-compatible, and in turn,
45+
pave the road for our own IronRuby and MacRuby support.
46+
* Switch to the newly added rake-compiler `JavaExtensionTask` for compiling
47+
JRuby extensions, instead of our (broken) home-grown solution.
48+
49+
## 0.10.0 2009-09-15
50+
51+
Initial release of H2 driver (using *do_jdbc*).
52+
53+
* Known Issues
54+
* JRuby-only

do_h2/Gemfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
source :rubygems
2+
3+
path '../'
4+
5+
gemspec
6+
7+
group :development do # Development dependencies (as in the gemspec)
8+
gem 'rake'
9+
end

do_h2/LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2008 - 2011 Alex Coles, Ikonoklastik Productions
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

do_h2/README.markdown

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# do_h2
2+
3+
* <http://dataobjects.info>
4+
5+
## Description
6+
7+
An H2 driver for DataObjects.
8+
9+
## Features/Problems
10+
11+
This driver implements the DataObjects API for the H2 relational database.
12+
This driver is currently provided only for JRuby.
13+
14+
## Synopsis
15+
16+
An example of usage:
17+
18+
@connection = DataObjects::Connection.new("h2://employees")
19+
@reader = @connection.create_command('SELECT * FROM users').execute_reader
20+
@reader.next!
21+
22+
The `Connection` constructor should be passed either a DataObjects-style URL or
23+
JDBC-style URL:
24+
25+
h2://employees
26+
jdbc:h2:mem
27+
28+
## Requirements
29+
30+
* JRuby 1.3.1 + (1.4+ recommended)
31+
* `data_objects` gem
32+
* `do_jdbc` gem (shared library)
33+
34+
## Install
35+
36+
To install the gem:
37+
38+
jruby -S gem install do_h2
39+
40+
To compile and install from source:
41+
42+
* Install the Java Development Kit (provided if you are on a recent version of
43+
Mac OS X) from <http://java.sun.com>
44+
* Install a recent version of JRuby. Ensure `jruby` is in your `PATH` and/or
45+
you have configured the `JRUBY_HOME` environment variable to point to your
46+
JRuby installation.
47+
* Install `data_objects` and `do_jdbc` with `jruby -S rake install`.
48+
* Install this driver with `jruby -S rake install`.
49+
50+
For more information, see the H2 driver wiki page:
51+
<http://wiki.github.com/datamapper/do/h2>.
52+
53+
## Developers
54+
55+
Follow the above installation instructions. Additionally, you'll need:
56+
* `rspec` gem for running specs.
57+
* `YARD` gem for generating documentation.
58+
59+
See the DataObjects wiki for more comprehensive information:
60+
<http://wiki.github.com/datamapper/do/jruby>.
61+
62+
To run specs:
63+
64+
jruby -S rake spec
65+
66+
To run specs without compiling extensions first:
67+
68+
jruby -S rake spec_no_compile
69+
70+
To run individual specs:
71+
72+
jruby -S rake spec SPEC=spec/connection_spec.rb
73+
74+
## License
75+
76+
This code is licensed under an **MIT (X11) License**. Please see the
77+
accompanying `LICENSE` file.

do_h2/Rakefile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require 'pathname'
2+
require 'rubygems'
3+
require 'bundler'
4+
require 'rubygems/package_task'
5+
Bundler::GemHelper.install_tasks
6+
7+
require 'rake'
8+
require 'rake/clean'
9+
10+
ROOT = Pathname(__FILE__).dirname.expand_path
11+
12+
require ROOT + 'lib/do_h2/version'
13+
14+
JRUBY = RUBY_PLATFORM =~ /java/
15+
IRONRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
16+
WINDOWS = Gem.win_platform? || (JRUBY && ENV_JAVA['os.name'] =~ /windows/i)
17+
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
18+
19+
CLEAN.include(%w[ {tmp,pkg}/ **/*.{o,so,bundle,jar,log,a,gem,dSYM,obj,pdb,exp,DS_Store,rbc,db} ext-java/target ])
20+
21+
22+
Rake::Task['build'].clear_actions if Rake::Task.task_defined?('build')
23+
task :build => [ :java, :gem ]
24+
25+
FileList['tasks/**/*.rake'].each { |task| import task }

do_h2/buildfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Apache Buildr buildfile for do_h2
2+
# see http://incubator.apache.org/buildr/ for more information on Apache Buildr
3+
require 'buildr'
4+
require 'pathname'
5+
6+
VERSION_NUMBER = '1.0'
7+
JDBC_SUPPORT = ['data_objects:jdbc:jar:1.0']
8+
TARGET_DIR = 'pkg/classes'
9+
repositories.remote << 'http://www.ibiblio.org/maven2/'
10+
11+
define 'do_h2' do
12+
project.version = VERSION_NUMBER
13+
project.group = 'data_objects.rb'
14+
15+
manifest['Copyright'] = 'Alex Coles (C) 2008-2011'
16+
17+
compile.using :target => '1.5', :lint => 'all', :deprecation => 'true'
18+
19+
define 'ext-java' do
20+
package(:jar).clean.include(TARGET_DIR)
21+
22+
jdbc_support_jar = file('../../do_jdbc/lib/do_jdbc_internal.jar')
23+
jdbc_support = artifact('data_objects:jdbc:jar:1.0').from(jdbc_support_jar)
24+
25+
compile.into(TARGET_DIR).with(JDBC_SUPPORT)
26+
end
27+
end

do_h2/do_h2.gemspec

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# -*- encoding: utf-8 -*-
2+
3+
Gem::Specification.new do |s|
4+
s.name = %q{do_h2}
5+
s.version = "0.10.10"
6+
s.platform = %q{java}
7+
8+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9+
s.authors = ["Alex Coles"]
10+
s.description = %q{Implements the DataObjects API for H2}
11+
s.email = %q{[email protected]}
12+
s.extra_rdoc_files = [
13+
"ChangeLog.markdown",
14+
"LICENSE",
15+
"README.markdown"
16+
]
17+
s.files = [
18+
"ChangeLog.markdown",
19+
"LICENSE",
20+
"README.markdown",
21+
"Rakefile",
22+
"lib/do_h2.rb",
23+
"lib/do_h2/version.rb",
24+
"spec/command_spec.rb",
25+
"spec/connection_spec.rb",
26+
"spec/encoding_spec.rb",
27+
"spec/reader_spec.rb",
28+
"spec/result_spec.rb",
29+
"spec/spec_helper.rb",
30+
"spec/typecast/array_spec.rb",
31+
"spec/typecast/bigdecimal_spec.rb",
32+
"spec/typecast/boolean_spec.rb",
33+
"spec/typecast/byte_array_spec.rb",
34+
"spec/typecast/class_spec.rb",
35+
"spec/typecast/date_spec.rb",
36+
"spec/typecast/datetime_spec.rb",
37+
"spec/typecast/float_spec.rb",
38+
"spec/typecast/integer_spec.rb",
39+
"spec/typecast/nil_spec.rb",
40+
"spec/typecast/other_spec.rb",
41+
"spec/typecast/range_spec.rb",
42+
"spec/typecast/string_spec.rb",
43+
"spec/typecast/time_spec.rb",
44+
"tasks/compile.rake",
45+
"tasks/release.rake",
46+
"tasks/spec.rake"
47+
]
48+
s.require_paths = ["lib"]
49+
s.rubyforge_project = %q{dorb}
50+
s.rubygems_version = %q{1.6.2}
51+
s.summary = %q{DataObjects H2 Driver}
52+
s.test_files = [
53+
"spec/command_spec.rb",
54+
"spec/connection_spec.rb",
55+
"spec/encoding_spec.rb",
56+
"spec/reader_spec.rb",
57+
"spec/result_spec.rb",
58+
"spec/spec_helper.rb",
59+
"spec/typecast/array_spec.rb",
60+
"spec/typecast/bigdecimal_spec.rb",
61+
"spec/typecast/boolean_spec.rb",
62+
"spec/typecast/byte_array_spec.rb",
63+
"spec/typecast/class_spec.rb",
64+
"spec/typecast/date_spec.rb",
65+
"spec/typecast/datetime_spec.rb",
66+
"spec/typecast/float_spec.rb",
67+
"spec/typecast/integer_spec.rb",
68+
"spec/typecast/nil_spec.rb",
69+
"spec/typecast/other_spec.rb",
70+
"spec/typecast/range_spec.rb",
71+
"spec/typecast/string_spec.rb",
72+
"spec/typecast/time_spec.rb"
73+
]
74+
75+
if s.respond_to? :specification_version then
76+
s.specification_version = 3
77+
78+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
79+
s.add_runtime_dependency(%q<data_objects>, ["= 0.10.10"])
80+
s.add_runtime_dependency(%q<do_jdbc>, ["= 0.10.10"])
81+
s.add_runtime_dependency(%q<jdbc-h2>, ["~> 1.1.107"])
82+
s.add_development_dependency(%q<rspec>, ["~> 2.5"])
83+
s.add_development_dependency(%q<rake-compiler>, ["~> 0.7"])
84+
else
85+
s.add_dependency(%q<data_objects>, ["= 0.10.10"])
86+
s.add_dependency(%q<do_jdbc>, ["= 0.10.10"])
87+
s.add_dependency(%q<jdbc-h2>, ["~> 1.1.107"])
88+
s.add_dependency(%q<rspec>, ["~> 2.5"])
89+
s.add_dependency(%q<rake-compiler>, ["~> 0.7"])
90+
end
91+
else
92+
s.add_dependency(%q<data_objects>, ["= 0.10.10"])
93+
s.add_dependency(%q<do_jdbc>, ["= 0.10.10"])
94+
s.add_dependency(%q<jdbc-h2>, ["~> 1.1.107"])
95+
s.add_dependency(%q<rspec>, ["~> 2.5"])
96+
s.add_dependency(%q<rake-compiler>, ["~> 0.7"])
97+
end
98+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package do_h2;
2+
3+
import data_objects.drivers.AbstractDataObjectsService;
4+
import data_objects.drivers.DriverDefinition;
5+
6+
public class DoH2Service extends AbstractDataObjectsService {
7+
8+
private final static DriverDefinition driver = new H2DriverDefinition();
9+
10+
/**
11+
*
12+
* @return
13+
*/
14+
@Override
15+
public DriverDefinition getDriverDefinition() {
16+
return driver;
17+
}
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package do_h2;
2+
3+
import data_objects.drivers.AbstractDriverDefinition;
4+
5+
public class H2DriverDefinition extends AbstractDriverDefinition {
6+
public final static String URI_SCHEME = "h2";
7+
public final static String RUBY_MODULE_NAME = "H2";
8+
public final static String JDBC_DRIVER = "org.h2.Driver";
9+
10+
/**
11+
*
12+
*/
13+
public H2DriverDefinition(){
14+
super(URI_SCHEME, RUBY_MODULE_NAME, JDBC_DRIVER);
15+
}
16+
17+
/**
18+
*
19+
* @return
20+
*/
21+
@Override
22+
public boolean supportsJdbcGeneratedKeys()
23+
{
24+
return true;
25+
}
26+
27+
/**
28+
*
29+
* @return
30+
*/
31+
@Override
32+
public boolean supportsJdbcScrollableResultSets()
33+
{
34+
return true;
35+
}
36+
37+
}

0 commit comments

Comments
 (0)