activerecord-jdbcsplice-adapter 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +22 -15
- data/activerecord-jdbcsplice-adapter.gemspec +1 -1
- data/lib/active_record/jdbcsplice/adapter/version.rb +1 -1
- data/lib/arjdbc/splice/connection_methods.rb +3 -2
- data/lib/arjdbc/tasks/databases.rake +2 -1
- data/lib/arjdbc/tasks/rake_tasks.rb +32 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f576ad90fdef4ed1f6bcc3c3b46a640f478b6878
|
4
|
+
data.tar.gz: f57e8ef17dd58b52402039515b926a7f78a96dcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6309894c05dd8b3b78033a3b474842e735d1ea4919ccf5ac7170cfb6d6f54dfbaa1c9c244bca7ebd238b1ac60b1df73e0ca72228ec4c25a3b4d3e6f6a6385266
|
7
|
+
data.tar.gz: 672adccffbbdf715af0d6530582b14c314121aacb106539a5647f7ed8fab04434e02e083be05739d596f57bc856283a33375da90d311c1f0b29d3ea44286811e
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Activerecord::Jdbcsplice::Adapter
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Splice Engine JDBC adapter for JRuby on Rails.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -14,7 +12,7 @@ gem 'activerecord-jdbcsplice-adapter'
|
|
14
12
|
|
15
13
|
And then execute:
|
16
14
|
|
17
|
-
$ bundle
|
15
|
+
$ bundle install
|
18
16
|
|
19
17
|
Or install it yourself as:
|
20
18
|
|
@@ -22,20 +20,29 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
23
|
+
To use Splice JDBC adapter, install the gem, and update your `database.yml` like:
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
```ruby
|
26
|
+
default: &default
|
27
|
+
adapter: jdbcsplice
|
28
|
+
username: splice
|
29
|
+
password: admin
|
30
|
+
prepared_statements: true
|
31
|
+
pool: 1000
|
32
|
+
host: localhost
|
33
|
+
port: 1527
|
34
34
|
|
35
|
-
|
35
|
+
development:
|
36
|
+
<<: *default
|
37
|
+
database: splicedb
|
36
38
|
|
39
|
+
test:
|
40
|
+
<<: *default
|
41
|
+
database: splicedb_test
|
37
42
|
|
38
|
-
## License
|
39
43
|
|
40
|
-
|
44
|
+
production:
|
45
|
+
<<: *default
|
46
|
+
database: splicedb_production
|
41
47
|
|
48
|
+
```
|
@@ -10,8 +10,9 @@ ArJdbc::ConnectionMethods.module_eval do
|
|
10
10
|
rescue LoadError # assuming driver.jar is on the class-path
|
11
11
|
end
|
12
12
|
|
13
|
-
throw "Please specify Splice Cluster URL by defining '
|
14
|
-
|
13
|
+
throw "Please specify Splice Cluster URL by defining 'host' and 'port' in database.yml" if config[:host].blank? || config[:port].blank?
|
14
|
+
|
15
|
+
config[:url] ||= "jdbc:splice://#{config[:host]}:#{config[:port]}/#{config[:database]};create=true"
|
15
16
|
config[:driver] ||= defined?(::Jdbc::Splice.driver_name) ?
|
16
17
|
::Jdbc::Splice.driver_name : 'com.splicemachine.db.jdbc.ClientDriver'
|
17
18
|
|
@@ -1 +1,2 @@
|
|
1
|
-
require 'arjdbc/tasks/database_tasks'
|
1
|
+
require 'arjdbc/tasks/database_tasks'
|
2
|
+
require 'arjdbc/tasks/rake_tasks'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
namespace :db do
|
2
|
+
namespace :splice do
|
3
|
+
|
4
|
+
task :destroy_all => :environment do
|
5
|
+
['development', 'test'].each do |environment|
|
6
|
+
db_config = Rails.configuration.database_configuration[environment].dup
|
7
|
+
schema_name = db_config['schema']
|
8
|
+
|
9
|
+
ActiveRecord::Base.establish_connection.with_connection do |connection|
|
10
|
+
schemas = connection.execute("SELECT ssc.schemaname FROM SYS.SYSSCHEMAS ssc where ssc.schemaname not in (SELECT sc.schemaname FROM SYS.SYSSCHEMAS sc where sc.schemaname like 'SYS%' OR sc.schemaname like 'SQL%')
|
11
|
+
").map {|t| t['schemaname']}
|
12
|
+
|
13
|
+
schemas.each do |schema|
|
14
|
+
puts "Schema: #{schema}"
|
15
|
+
tables = connection.execute("select ts.tablename from sys.systables ts where ts.tablename not in (select t.tablename from sys.systables t where t.tablename like 'SYS%')").map {|t| t['tablename']}
|
16
|
+
|
17
|
+
tables.each do |table|
|
18
|
+
begin
|
19
|
+
connection.execute("DROP TABLE #{schema}.#{table}")
|
20
|
+
puts "#{table} dropped."
|
21
|
+
rescue => e
|
22
|
+
puts "#{table} skipped."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-jdbcsplice-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kolosek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-jdbc-adapter
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.1.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.1.1
|
41
41
|
description: Splice Engine JDBC adapter for JRuby on Rails.
|
42
42
|
email:
|
43
43
|
- office@kolosek.com
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- lib/arjdbc/tasks.rb
|
66
66
|
- lib/arjdbc/tasks/database_tasks.rb
|
67
67
|
- lib/arjdbc/tasks/databases.rake
|
68
|
+
- lib/arjdbc/tasks/rake_tasks.rb
|
68
69
|
homepage: http://splicemachine.com
|
69
70
|
licenses:
|
70
71
|
- MIT
|