activerecord-nuodb-adapter 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +31 -0
- data/CONTRIBUTION.rdoc +97 -0
- data/README.rdoc +28 -158
- data/Rakefile +1 -1
- data/activerecord-nuodb-adapter.gemspec +2 -2
- data/lib/active_record/connection_adapters/nuodb/version.rb +1 -1
- data/lib/active_record/connection_adapters/nuodb_adapter.rb +84 -12
- metadata +13 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5dc9e5f9a4b2c788d6edc4827f2acf2eed90c1a3
|
4
|
+
data.tar.gz: 936c6fe1f003e90aea1d2a2a19a9597e912be953
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 54151b9b46c73960f51398a54f766362b6d02d8695a99dc3c3c9b3977c0c413952ef6f550e51219239f2769351330bb30ffb1c663c02b96cf183f4929e6f4ab2
|
7
|
+
data.tar.gz: 698fa5ee9edef596ef016e77bdd987e03a85d55b95aad1ab38be47e9f859013078163bfeb3f86471ac34593df97be16285ecb42d18327206ceb111e5f9585a2b
|
data/.travis.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 1.9.3
|
5
|
+
|
6
|
+
env:
|
7
|
+
- NUODB_ROOT=/opt/nuodb
|
8
|
+
|
9
|
+
notifications:
|
10
|
+
recipients:
|
11
|
+
- buck.robert.j@gmail.com
|
12
|
+
- rbuck@nuodb.com
|
13
|
+
- lbayas@nuodb.com
|
14
|
+
|
15
|
+
before_install:
|
16
|
+
- wget http://www.nuodb.com/latest/nuodb-1.0.2.linux.x64.deb --output-document=/var/tmp/nuodb.deb
|
17
|
+
- sudo dpkg -i /var/tmp/nuodb.deb
|
18
|
+
- sleep 2
|
19
|
+
|
20
|
+
before_script:
|
21
|
+
- ${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz --verbose debug --archive /var/tmp/nuodb --initialize --force &
|
22
|
+
- sleep 2
|
23
|
+
- ${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz &
|
24
|
+
- sleep 2
|
25
|
+
- echo "create user cloud password 'user';" | ${NUODB_ROOT}/bin/nuosql test@localhost --user dba --password baz
|
26
|
+
|
27
|
+
script:
|
28
|
+
- NUODB_ROOT=/opt/nuodb rake clean build test install
|
29
|
+
|
30
|
+
after_script:
|
31
|
+
- sudo dpkg -r nuodb
|
data/CONTRIBUTION.rdoc
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
= Contributing to the Ruby ActiveRecord NuoDB Adapter
|
2
|
+
|
3
|
+
== BUILDING THE GEM
|
4
|
+
|
5
|
+
To compile and test run this command:
|
6
|
+
|
7
|
+
rake clean build
|
8
|
+
|
9
|
+
== INSTALLING THE GEM
|
10
|
+
|
11
|
+
gem install activerecord-nuodb-adapter
|
12
|
+
|
13
|
+
Or from the source tree:
|
14
|
+
|
15
|
+
gem install pkg/activerecord-nuodb-adapter-1.0.1.gem
|
16
|
+
|
17
|
+
Or you can do this using Rake:
|
18
|
+
|
19
|
+
rake clean build uninstall install
|
20
|
+
|
21
|
+
== TESTING THE GEM
|
22
|
+
|
23
|
+
Start up a minimal chorus as follows:
|
24
|
+
|
25
|
+
java -jar ${NUODB_ROOT}/jar/nuoagent.jar --broker &
|
26
|
+
${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz &
|
27
|
+
|
28
|
+
Create a user in the database:
|
29
|
+
|
30
|
+
${NUODB_ROOT}/bin/nuosql test@localhost --user dba --password baz
|
31
|
+
> create user cloud password 'user';
|
32
|
+
> exit
|
33
|
+
|
34
|
+
Run the tests:
|
35
|
+
|
36
|
+
rake test
|
37
|
+
|
38
|
+
== PUBLISHING THE GEM
|
39
|
+
|
40
|
+
=== TAGGING
|
41
|
+
|
42
|
+
Tag the product using tags per the SemVer specification; our tags have a v-prefix:
|
43
|
+
|
44
|
+
git tag -a v1.0.1 -m "SemVer Version: v1.0.1"
|
45
|
+
git push --tags
|
46
|
+
|
47
|
+
If you make a mistake, take it back quickly:
|
48
|
+
|
49
|
+
git tag -d v1.0.1
|
50
|
+
git push origin :refs/tags/v1.0.1
|
51
|
+
|
52
|
+
===PUBLISHING
|
53
|
+
|
54
|
+
Here are the commands used to publish:
|
55
|
+
|
56
|
+
gem push pkg/activerecord-nuodb-adapter-1.0.1.gem
|
57
|
+
|
58
|
+
== INSPECTING THE GEM
|
59
|
+
|
60
|
+
It is often useful to inspect the contents of a Gem before distribution.
|
61
|
+
To do this you dump the contents of a gem thus:
|
62
|
+
|
63
|
+
gem unpack pkg/activerecord-nuodb-adapter-1.0.1.gem
|
64
|
+
|
65
|
+
== RUNNING ACTIVE RECORD COMPLIANCE TEST SUITES
|
66
|
+
|
67
|
+
Install both the NuoDB Ruby Gem and the NuoDB ActiveRecord Adapter Gem:
|
68
|
+
|
69
|
+
gem install nuodb
|
70
|
+
gem install activerecord-nuodb-adapter
|
71
|
+
|
72
|
+
You may need to uninstall an earlier version to ensure you only have
|
73
|
+
the version you want to install:
|
74
|
+
|
75
|
+
gem uninstall activerecord-nuodb-adapter
|
76
|
+
|
77
|
+
Run equivalent commands to the following to set up your environment:
|
78
|
+
|
79
|
+
export NUODB_AR=1
|
80
|
+
export NUODB_ROOT=/Users/rbuck/tmp/nuodb
|
81
|
+
export PATH=${NUODB_ROOT}/bin:${PATH}
|
82
|
+
|
83
|
+
Start up NuoDB as follows:
|
84
|
+
|
85
|
+
java -jar ${NUODB_ROOT}/jar/nuoagent.jar --broker &
|
86
|
+
${NUODB_ROOT}/bin/nuodb --chorus arunit --password bar --dba-user dba --dba-password baz --force &
|
87
|
+
|
88
|
+
Configure your RVM environment:
|
89
|
+
|
90
|
+
cd rails
|
91
|
+
bundle install
|
92
|
+
|
93
|
+
Run the test suite as follows:
|
94
|
+
|
95
|
+
cd activerecord
|
96
|
+
ARCONN=nuodb ruby -Itest test/cases/base_test.rb
|
97
|
+
|
data/README.rdoc
CHANGED
@@ -1,172 +1,42 @@
|
|
1
|
-
= Ruby ActiveRecord NuoDB Adapter
|
1
|
+
= Ruby ActiveRecord NuoDB Adapter {<img src="https://secure.travis-ci.org/nuodb/ruby-activerecord-nuodb-adapter.png?branch=master" alt="Continuous Integration Status" />}[http://travis-ci.org/nuodb/ruby-activerecord-nuodb-adapter] {<img src="https://gemnasium.com/nuodb/ruby-activerecord-nuodb-adapter.png?travis" alt="Dependency Status" />}[https://gemnasium.com/nuodb/ruby-activerecord-nuodb-adapter] {<img src="https://codeclimate.com/github/nuodb/ruby-activerecord-nuodb-adapter.png" />}[https://codeclimate.com/github/nuodb/ruby-activerecord-nuodb-adapter]
|
2
2
|
|
3
|
-
|
3
|
+
The Ruby ActiveRecord NuoDB Adapter enables the ActiveRecord ORM to work with {NuoDB}[http://nuodb.com/]. Together with the {Ruby NuoDB driver}[https://github.com/nuodb/ruby-nuodb], this gem allows for NuoDB backed Rails applications.
|
4
4
|
|
5
|
-
|
5
|
+
Note: At this time the Ruby ActiveRecord NuoDB Adapter does not support Windows.
|
6
6
|
|
7
|
-
==
|
7
|
+
== Getting Started
|
8
8
|
|
9
|
-
|
10
|
-
of having it running against NuoDB...
|
9
|
+
1. If you haven't already, {Download and Install NuoDB}[http://nuodb.com/download-nuodb/]
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
export NUODB_ROOT=/Users/Path/To/NuoDB
|
15
|
-
java -jar ${NUODB_ROOT}/jar/nuoagent.jar --broker &
|
16
|
-
${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz --verbose debug --archive /var/tmp/nuodb --initialize --force &
|
17
|
-
${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz &
|
18
|
-
|
19
|
-
Create a user in the database:
|
20
|
-
|
21
|
-
${NUODB_ROOT}/bin/nuosql test@localhost --user dba --password baz
|
22
|
-
> create user cloud password 'user';
|
23
|
-
> exit
|
24
|
-
|
25
|
-
Install our Gems; the following shows how to do this if you have copies
|
26
|
-
of the gems locally, but is easier if you install them from rubygems.org.
|
27
|
-
|
28
|
-
gem install nuodb-1.0.0.gem
|
29
|
-
gem install activerecord-nuodb-adapter-1.0.0.gem
|
30
|
-
|
31
|
-
Prepare a sample application:
|
32
|
-
|
33
|
-
rails new slambook
|
34
|
-
cd slambook/
|
35
|
-
|
36
|
-
Add the following Gems to your Gemfile:
|
37
|
-
|
38
|
-
gem 'nuodb', '=1.0.0'
|
39
|
-
gem 'activerecord-nuodb-adapter', '=1.0.0'
|
40
|
-
|
41
|
-
Update your config/database.yml file as follows:
|
42
|
-
|
43
|
-
development:
|
44
|
-
adapter: nuodb
|
45
|
-
database: test@localhost
|
46
|
-
username: cloud
|
47
|
-
password: user
|
48
|
-
schema: test
|
49
|
-
|
50
|
-
test:
|
51
|
-
adapter: nuodb
|
52
|
-
database: test@localhost
|
53
|
-
username: cloud
|
54
|
-
password: user
|
55
|
-
schema: test
|
56
|
-
|
57
|
-
production:
|
58
|
-
adapter: nuodb
|
59
|
-
database: test@localhost
|
60
|
-
username: cloud
|
61
|
-
password: user
|
62
|
-
schema: test
|
63
|
-
|
64
|
-
6. Build the application and prepare your databases:
|
11
|
+
2. Add the ActiveRecord NuoDB Adapter to your Gemfile
|
65
12
|
|
13
|
+
gem 'activerecord-nuodb-adapter'
|
14
|
+
|
15
|
+
3. Use bundler to install
|
16
|
+
|
66
17
|
bundle install
|
67
|
-
rake db:create
|
68
|
-
rake db:migrate
|
69
|
-
|
70
|
-
7. Start the Rails server:
|
71
|
-
|
72
|
-
bundle exec rails server
|
73
|
-
|
74
|
-
8. Open up your browser:
|
75
|
-
|
76
|
-
chrome http://localhost:3000
|
77
|
-
|
78
|
-
== BUILDING THE GEM
|
79
|
-
|
80
|
-
To compile and test run this command:
|
81
|
-
|
82
|
-
rake clean build
|
83
|
-
|
84
|
-
== INSTALLING THE GEM
|
85
|
-
|
86
|
-
gem install activerecord-nuodb-adapter-1.0.0.gem
|
87
|
-
|
88
|
-
Or from the source tree:
|
89
|
-
|
90
|
-
gem install pkg/activerecord-nuodb-adapter-1.0.0.gem
|
91
|
-
|
92
|
-
Or you can do this using Rake:
|
93
|
-
|
94
|
-
rake clean build uninstall install
|
95
|
-
|
96
|
-
== TESTING THE GEM
|
97
|
-
|
98
|
-
Start up a minimal chorus as follows:
|
99
|
-
|
100
|
-
java -jar ${NUODB_ROOT}/jar/nuoagent.jar --broker &
|
101
|
-
${NUODB_ROOT}/bin/nuodb --chorus test --password bar --dba-user dba --dba-password baz &
|
102
|
-
|
103
|
-
Create a user in the database:
|
104
|
-
|
105
|
-
${NUODB_ROOT}/bin/nuosql test@localhost --user dba --password baz
|
106
|
-
> create user cloud password 'user';
|
107
|
-
> exit
|
108
|
-
|
109
|
-
Run the tests:
|
110
|
-
|
111
|
-
rake test
|
112
|
-
|
113
|
-
== PUBLISHING THE GEM
|
114
|
-
|
115
|
-
=== TAGGING
|
116
|
-
|
117
|
-
Tag the product using tags per the SemVer specification; our tags have a v-prefix:
|
118
|
-
|
119
|
-
git tag -a v1.0.0 -m "SemVer Version: v1.0.0"
|
120
|
-
git push --tags
|
121
|
-
|
122
|
-
If you make a mistake, take it back quickly:
|
123
|
-
|
124
|
-
git tag -d v1.0.0
|
125
|
-
git push origin :refs/tags/v1.0.0
|
126
|
-
|
127
|
-
===PUBLISHING
|
128
|
-
|
129
|
-
Here are the commands used to publish:
|
130
|
-
|
131
|
-
gem push pkg/nuodb-1.0.0.gem
|
132
|
-
|
133
|
-
== INSPECTING THE GEM
|
134
|
-
|
135
|
-
It is often useful to inspect the contents of a Gem before distribution.
|
136
|
-
To do this you dump the contents of a gem thus:
|
137
|
-
|
138
|
-
gem unpack pkg/activerecord-nuodb-adapter-1.0.0.gem
|
139
|
-
|
140
|
-
== RUNNING ACTIVE RECORD COMPLIANCE TEST SUITES
|
141
|
-
|
142
|
-
Install both the NuoDB Ruby Gem and the NuoDB ActiveRecord Adapter Gem:
|
143
|
-
|
144
|
-
gem install nuodb
|
145
|
-
gem install activerecord-nuodb-adapter
|
146
|
-
|
147
|
-
You may need to uninstall an earlier version to ensure you only have
|
148
|
-
the version you want to install:
|
149
18
|
|
150
|
-
|
19
|
+
4. Use the NuoDB Manager to create your database by starting a Storage Manager (SM) and Transaction Engine (TE)
|
151
20
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
export PATH=${NUODB_ROOT}/bin:${PATH}
|
157
|
-
|
158
|
-
Start up NuoDB as follows:
|
159
|
-
|
160
|
-
java -jar ${NUODB_ROOT}/jar/nuoagent.jar --broker &
|
161
|
-
${NUODB_ROOT}/bin/nuodb --chorus arunit --password bar --dba-user dba --dba-password baz --force &
|
21
|
+
java -jar /opt/nuodb/jar/nuodbmanager.jar --broker localhost --user domain --password bird
|
22
|
+
|
23
|
+
> start process sm host localhost database blog_development archive /var/opt/nuodb/production-archives/blog_development initialize yes
|
24
|
+
> start process te host localhost database blog_development options '--dba-user blog --dba-password bl0gPassw0rd'
|
162
25
|
|
163
|
-
|
26
|
+
5. Update your config/database.yml file
|
27
|
+
|
28
|
+
development:
|
29
|
+
adapter: nuodb
|
30
|
+
database: blog_development@localhost
|
31
|
+
username: blog
|
32
|
+
password: bl0gPassw0rd
|
33
|
+
schema: blog
|
164
34
|
|
165
|
-
|
166
|
-
bundle install
|
35
|
+
== More Information
|
167
36
|
|
168
|
-
|
37
|
+
* {NuoDB Community Forum}[http://www.nuodb.com/community/forum.php]
|
38
|
+
* {NuoDB Online Documentation}[http://www.nuodb.com/community/documentation.php]
|
169
39
|
|
170
|
-
|
171
|
-
ARCONN=nuodb ruby -Itest test/cases/base_test.rb
|
40
|
+
== Contributing
|
172
41
|
|
42
|
+
See {Contribution}[link:CONTRIBUTION.rdoc] for information about contributing to the Ruby ActiveRecord NuoDB Adapter.
|
data/Rakefile
CHANGED
@@ -126,7 +126,7 @@ task :build do
|
|
126
126
|
end
|
127
127
|
|
128
128
|
task :install => :build do
|
129
|
-
sh %{gem install pkg/#{GEM_NAME}-#{ActiveRecord::ConnectionAdapters::NuoDB::VERSION} --no-rdoc --no-ri}
|
129
|
+
sh %{gem install pkg/#{GEM_NAME}-#{ActiveRecord::ConnectionAdapters::NuoDB::VERSION}.gem --no-rdoc --no-ri}
|
130
130
|
end
|
131
131
|
|
132
132
|
task :uninstall do
|
@@ -15,9 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.extra_rdoc_files = %w[README.rdoc]
|
16
16
|
|
17
17
|
gem.add_dependency('activerecord', '~> 3.2.8')
|
18
|
-
gem.add_development_dependency('rake', '~> 0.
|
18
|
+
gem.add_development_dependency('rake', '~> 10.0.3')
|
19
19
|
gem.add_development_dependency('rdoc', '~> 3.10')
|
20
|
-
gem.add_dependency('nuodb', '~> 1.0.
|
20
|
+
gem.add_dependency('nuodb', '~> 1.0.2')
|
21
21
|
|
22
22
|
gem.files = `git ls-files`.split($\)
|
23
23
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
@@ -135,8 +135,6 @@ module ActiveRecord
|
|
135
135
|
4
|
136
136
|
when /^bigint/i
|
137
137
|
8
|
138
|
-
when /\(max\)/, /decimal/, /numeric/
|
139
|
-
nil
|
140
138
|
else
|
141
139
|
super
|
142
140
|
end
|
@@ -146,6 +144,12 @@ module ActiveRecord
|
|
146
144
|
case field_type
|
147
145
|
when /bit/i then
|
148
146
|
:boolean
|
147
|
+
when /timestamp/i then
|
148
|
+
:timestamp
|
149
|
+
when /time/i then
|
150
|
+
:time
|
151
|
+
when /date/i then
|
152
|
+
:date
|
149
153
|
else
|
150
154
|
super
|
151
155
|
end
|
@@ -386,20 +390,49 @@ module ActiveRecord
|
|
386
390
|
|
387
391
|
def change_column(table_name, column_name, type, options = {})
|
388
392
|
raise NotImplementedError, "change_column is not implemented"
|
393
|
+
#execute("ALTER TABLE #{quote_table_name(table_name)} #{change_column_sql(table_name, column_name, type, options)}")
|
389
394
|
end
|
390
395
|
|
391
396
|
def change_column_default(table_name, column_name, default)
|
392
397
|
raise NotImplementedError, "change_column_default is not implemented"
|
398
|
+
#column = column_for(table_name, column_name)
|
399
|
+
#change_column table_name, column_name, column.sql_type, :default => default
|
400
|
+
end
|
401
|
+
|
402
|
+
def change_column_null(table_name, column_name, null, default = nil)
|
403
|
+
raise NotImplementedError, "change_column_null is not implemented"
|
404
|
+
#column = column_for(table_name, column_name)
|
405
|
+
#unless null || default.nil?
|
406
|
+
# execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL")
|
407
|
+
#end
|
408
|
+
#change_column table_name, column_name, column.sql_type, :null => null
|
393
409
|
end
|
394
410
|
|
395
411
|
def rename_column(table_name, column_name, new_column_name)
|
396
412
|
raise NotImplementedError, "rename_column is not implemented"
|
413
|
+
#execute("ALTER TABLE #{quote_table_name(table_name)} #{rename_column_sql(table_name, column_name, new_column_name)}")
|
397
414
|
end
|
398
415
|
|
399
416
|
def rename_table(table_name, new_name)
|
400
417
|
raise NotImplementedError, "rename_table is not implemented"
|
418
|
+
#execute("RENAME TABLE #{quote_table_name(table_name)} TO #{quote_table_name(new_name)}")
|
419
|
+
end
|
420
|
+
|
421
|
+
def add_column(table_name, column_name, type, options = {})
|
422
|
+
clear_cache!
|
423
|
+
add_column_sql = "ALTER TABLE #{quote_table_name(table_name)} ADD COLUMN #{quote_column_name(column_name)}"
|
424
|
+
add_column_options!(add_column_sql, options)
|
425
|
+
execute(add_column_sql)
|
426
|
+
end
|
427
|
+
|
428
|
+
def remove_index!(table_name, index_name) #:nodoc:
|
429
|
+
raise NotImplementedError, "remove_index! is not implemented"
|
401
430
|
end
|
402
431
|
|
432
|
+
def rename_index(table_name, old_name, new_name)
|
433
|
+
execute("ALTER INDEX #{quote_column_name(old_name)} RENAME TO #{quote_table_name(new_name)}")
|
434
|
+
end
|
435
|
+
|
403
436
|
def table_exists?(table_name)
|
404
437
|
return false unless table_name
|
405
438
|
|
@@ -519,7 +552,7 @@ module ActiveRecord
|
|
519
552
|
:binary => {:name => 'binary'},
|
520
553
|
:boolean => {:name => 'boolean'},
|
521
554
|
:date => {:name => 'date'},
|
522
|
-
:datetime => {:name => '
|
555
|
+
:datetime => {:name => 'timestamp'},
|
523
556
|
:decimal => {:name => 'decimal'},
|
524
557
|
:float => {:name => 'float', :limit => 8},
|
525
558
|
:integer => {:name => 'integer'},
|
@@ -534,21 +567,58 @@ module ActiveRecord
|
|
534
567
|
}
|
535
568
|
end
|
536
569
|
|
570
|
+
# jruby version -- no original
|
571
|
+
def modify_types(tp)
|
572
|
+
tp[:primary_key] = 'int not null generated always primary key'
|
573
|
+
tp[:boolean] = {:name => 'boolean'}
|
574
|
+
tp[:date] = {:name => 'date', :limit => nil}
|
575
|
+
tp[:datetime] = {:name => 'timestamp', :limit => nil}
|
576
|
+
tp[:decimal] = {:name => 'decimal'}
|
577
|
+
tp[:integer] = {:name => 'int', :limit => 4}
|
578
|
+
tp[:string] = {:name => 'string'}
|
579
|
+
tp[:time] = {:name => 'time', :limit => nil}
|
580
|
+
tp[:timestamp] = {:name => 'timestamp', :limit => nil}
|
581
|
+
tp
|
582
|
+
end
|
583
|
+
|
584
|
+
# jruby version
|
537
585
|
# maps logical rails types to nuodb-specific data types.
|
538
586
|
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
|
539
587
|
case type.to_s
|
540
588
|
when 'integer'
|
541
589
|
return 'integer' unless limit
|
542
590
|
case limit
|
543
|
-
when 1
|
591
|
+
when 1..2
|
544
592
|
'smallint'
|
545
|
-
when 3
|
593
|
+
when 3..4
|
546
594
|
'integer'
|
547
595
|
when 5..8
|
548
596
|
'bigint'
|
549
597
|
else
|
550
598
|
raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with precision 0 instead.")
|
551
599
|
end
|
600
|
+
when 'timestamp'
|
601
|
+
column_type_sql = 'timestamp'
|
602
|
+
unless precision.nil?
|
603
|
+
case precision
|
604
|
+
when 0..9
|
605
|
+
column_type_sql << "(#{precision})"
|
606
|
+
else
|
607
|
+
nil
|
608
|
+
end
|
609
|
+
end
|
610
|
+
column_type_sql
|
611
|
+
when 'time'
|
612
|
+
column_type_sql = 'time'
|
613
|
+
unless precision.nil?
|
614
|
+
case precision
|
615
|
+
when 0..9
|
616
|
+
column_type_sql << "(#{precision})"
|
617
|
+
else
|
618
|
+
nil
|
619
|
+
end
|
620
|
+
end
|
621
|
+
column_type_sql
|
552
622
|
else
|
553
623
|
super
|
554
624
|
end
|
@@ -610,6 +680,14 @@ module ActiveRecord
|
|
610
680
|
|
611
681
|
public
|
612
682
|
|
683
|
+
def select_rows(sql, name = nil)
|
684
|
+
exec_query(sql, name).rows
|
685
|
+
end
|
686
|
+
|
687
|
+
def select_values(sql, name = nil)
|
688
|
+
exec_query(sql, name).values
|
689
|
+
end
|
690
|
+
|
613
691
|
def outside_transaction?
|
614
692
|
nil
|
615
693
|
end
|
@@ -643,7 +721,7 @@ module ActiveRecord
|
|
643
721
|
end
|
644
722
|
|
645
723
|
def default_sequence_name(table, column)
|
646
|
-
result = exec_query(<<-eosql, 'SCHEMA')
|
724
|
+
result = exec_query(<<-eosql, 'SCHEMA', [table.to_s, column.to_s])
|
647
725
|
SELECT generator_sequence FROM system.fields WHERE tablename='#{table}' AND field='#{column}'
|
648
726
|
eosql
|
649
727
|
result.rows.first.first
|
@@ -735,12 +813,6 @@ module ActiveRecord
|
|
735
813
|
exec_query(sql, name, binds.map { |col, val| type_cast(val, col) }).to_a
|
736
814
|
end
|
737
815
|
|
738
|
-
protected
|
739
|
-
|
740
|
-
def select_rows(sql, name = nil)
|
741
|
-
exec_query(sql, name).rows
|
742
|
-
end
|
743
|
-
|
744
816
|
private
|
745
817
|
|
746
818
|
def column_names (result)
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-nuodb-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Robert Buck
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,23 +27,20 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
33
|
+
version: 10.0.3
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
version: 10.0.3
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rdoc
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,19 +55,17 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: nuodb
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.0.
|
61
|
+
version: 1.0.2
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.0.
|
68
|
+
version: 1.0.2
|
78
69
|
description: An adapter for ActiveRecord and AREL to support the NuoDB distributed
|
79
70
|
database backend.
|
80
71
|
email:
|
@@ -86,7 +77,9 @@ extra_rdoc_files:
|
|
86
77
|
files:
|
87
78
|
- .buildpath
|
88
79
|
- .gitignore
|
80
|
+
- .travis.yml
|
89
81
|
- AUTHORS
|
82
|
+
- CONTRIBUTION.rdoc
|
90
83
|
- COPYING
|
91
84
|
- Gemfile
|
92
85
|
- History.txt
|
@@ -103,28 +96,27 @@ files:
|
|
103
96
|
homepage: http://nuodb.github.com/ruby-activerecord-nuodb-adapter/
|
104
97
|
licenses:
|
105
98
|
- BSD
|
99
|
+
metadata: {}
|
106
100
|
post_install_message:
|
107
101
|
rdoc_options:
|
108
102
|
- --charset=UTF-8
|
109
103
|
require_paths:
|
110
104
|
- lib
|
111
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
-
none: false
|
113
106
|
requirements:
|
114
|
-
- -
|
107
|
+
- - '>='
|
115
108
|
- !ruby/object:Gem::Version
|
116
109
|
version: '0'
|
117
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
-
none: false
|
119
111
|
requirements:
|
120
|
-
- -
|
112
|
+
- - '>='
|
121
113
|
- !ruby/object:Gem::Version
|
122
114
|
version: '0'
|
123
115
|
requirements: []
|
124
116
|
rubyforge_project:
|
125
|
-
rubygems_version:
|
117
|
+
rubygems_version: 2.0.3
|
126
118
|
signing_key:
|
127
|
-
specification_version:
|
119
|
+
specification_version: 4
|
128
120
|
summary: ActiveRecord adapter with AREL support for NuoDB.
|
129
121
|
test_files:
|
130
122
|
- test/test_simple.rb
|