activerecord-cubrid2-adapter 0.0.6 → 0.1.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '083943f215dc84e878a3d8d5d79c8b1a25703c1380ca2798c6e767205fcc792d'
|
4
|
+
data.tar.gz: 975804dda34c9ed0cc36ed5d37076ba0485cc0051b0fd08a9dbaa5079864d127
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 823ff2da41876111cb1cb3cce15171fcb9790536305658c7389e63f11447b7343f8f4dcd8aa771b804d927367be3b99361a5a1c4a2fc4dbb41388d39421c00a7
|
7
|
+
data.tar.gz: '08c0ae544747c7a8b2fae2ad44d07b64d8097c499113b3eff9baf77e78268783bd277c70fbf1767b7625d99f11f54710a847c7e209d1c6f5d2706ecb3157f53c'
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# activerecord-cubrid2-adapter
|
2
2
|
Cubrid database connector for ruby, and active_record, depends on 'cubrid' gem
|
3
3
|
|
4
|
+
[](https://badge.fury.io/rb/activerecord-cubrid2-adapter)
|
5
|
+
|
4
6
|
DESCRIPTION
|
5
7
|
-----------
|
6
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
@@ -200,7 +200,7 @@ module ActiveRecord
|
|
200
200
|
|
201
201
|
stmt = nil
|
202
202
|
|
203
|
-
#pp "######### #{sql}"
|
203
|
+
# pp "######### #{sql}"
|
204
204
|
log(sql, name) do
|
205
205
|
ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
|
206
206
|
stmt = @connection.query(sql)
|
@@ -241,19 +241,32 @@ module ActiveRecord
|
|
241
241
|
|
242
242
|
# SCHEMA STATEMENTS ========================================
|
243
243
|
|
244
|
-
#
|
245
|
-
def recreate_database(
|
246
|
-
|
244
|
+
# Recreate database
|
245
|
+
def recreate_database(name, options = {})
|
246
|
+
drop_database(name)
|
247
|
+
create_database(name, options)
|
247
248
|
end
|
248
249
|
|
249
|
-
# Create a new Cubrid database
|
250
|
-
|
251
|
-
|
250
|
+
# Create a new Cubrid database
|
251
|
+
# TODO: not workign with rake db:create
|
252
|
+
def create_database(name, options = {})
|
253
|
+
options[:db_volume_size] ||= '20' # megabytes
|
254
|
+
options[:log_volume_size] ||= '20' # megabytes
|
255
|
+
options[:encoding] ||= 'en_US.utf8'
|
256
|
+
|
257
|
+
Kernel.exec 'cubrid createdb ' +
|
258
|
+
"--db-volume-size=#{options[:db_volume_size]}M " +
|
259
|
+
"--log-volume-size=#{options[:log_volume_size]}M #{name} " +
|
260
|
+
"#{options[:encoding]}"
|
261
|
+
|
262
|
+
Kernel.exec "cubrid service start #{name}"
|
252
263
|
end
|
253
264
|
|
254
|
-
# Drops a Cubrid database
|
255
|
-
|
256
|
-
|
265
|
+
# Drops a Cubrid database
|
266
|
+
# TODO: not workign with rake db:drop
|
267
|
+
def drop_database(name)
|
268
|
+
Kernel.exec "cubrid service stop #{name}"
|
269
|
+
Kernel.exec "cubrid deletedb #{name}"
|
257
270
|
end
|
258
271
|
|
259
272
|
def current_database
|
@@ -464,18 +477,30 @@ module ActiveRecord
|
|
464
477
|
prikeys
|
465
478
|
end
|
466
479
|
|
467
|
-
|
468
|
-
|
480
|
+
if ActiveRecord.version.to_s < '6.1.3.1'
|
481
|
+
def default_uniqueness_comparison(attribute, value, klass = nil) # :nodoc:
|
482
|
+
column = column_for_attribute(attribute)
|
469
483
|
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
484
|
+
if column.collation && !column.case_sensitive? && !value.nil?
|
485
|
+
ActiveSupport::Deprecation.warn(<<~MSG.squish)
|
486
|
+
Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1.
|
487
|
+
To continue case sensitive comparison on the :#{attribute.name} attribute in #{klass} model,
|
488
|
+
pass `case_sensitive: true` option explicitly to the uniqueness validator.
|
489
|
+
MSG
|
490
|
+
attribute.eq(Arel::Nodes::Bin.new(value))
|
491
|
+
else
|
492
|
+
super
|
493
|
+
end
|
494
|
+
end
|
495
|
+
else
|
496
|
+
def default_uniqueness_comparison(attribute, value) # :nodoc:
|
497
|
+
column = column_for_attribute(attribute)
|
498
|
+
|
499
|
+
if column.collation && !column.case_sensitive? && !value.nil?
|
500
|
+
attribute.eq(Arel::Nodes::Bin.new(value))
|
501
|
+
else
|
502
|
+
super
|
503
|
+
end
|
479
504
|
end
|
480
505
|
end
|
481
506
|
|
@@ -13,7 +13,7 @@ module ActiveRecord
|
|
13
13
|
config = config.symbolize_keys
|
14
14
|
config[:flags] ||= 0
|
15
15
|
|
16
|
-
client = Cubrid2::Client.new(config)
|
16
|
+
client = ::Cubrid2::Client.new(config)
|
17
17
|
ConnectionAdapters::Cubrid2Adapter.new(client, logger, nil, config)
|
18
18
|
rescue Cubrid2::Error => e
|
19
19
|
raise ActiveRecord::NoDatabaseError if e.error_number == ER_DATABASE_CONNECTION_ERROR
|
@@ -145,7 +145,7 @@ module ActiveRecord
|
|
145
145
|
private
|
146
146
|
|
147
147
|
def connect
|
148
|
-
@connection = Cubrid2::Client.new(@config)
|
148
|
+
@connection = ::Cubrid2::Client.new(@config)
|
149
149
|
configure_connection
|
150
150
|
end
|
151
151
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cubrid2-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eui-Taik Na
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.3.7
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: ActiveRecord Cubrid Adapter.
|