activerecord-advantage-adapter 0.1.6 → 0.1.8
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: 0b99c457f121d0e626de75648f383a4c74e4e1068de8299fa4676f6174bb90c3
|
4
|
+
data.tar.gz: 2ef0863fd117d012ec8bf3fcc62daff584f66d28124db927d159c3113fbbcbc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04d3efce90e1c6cd0c8a4cf13c5a3f2b0f7152e97c401e2341463ce9e59e0c26b809eb39c506207e25e705cbe4b1e33e8641dceea9e8dd4dac1f3d9ed043b25b
|
7
|
+
data.tar.gz: 316c0e9ec840e759fa74e63767f7314ab4873e12a0b6abc2bf269e3e16b59e620f4f9be84226f8934b5f59c8a2619af472a8d349632f6d9d6e1ef35f495ba45a
|
@@ -1,7 +1,7 @@
|
|
1
1
|
lib = File.expand_path("../lib", __FILE__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
|
-
pkg_version = "0.1.
|
4
|
+
pkg_version = "0.1.8"
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'activerecord-advantage-adapter'
|
@@ -39,8 +39,8 @@ Gem::Specification.new do |spec|
|
|
39
39
|
'activerecord-advantage-adapter.gemspec']
|
40
40
|
spec.require_paths = ['lib']
|
41
41
|
|
42
|
-
spec.add_development_dependency 'bundler', '~>
|
43
|
-
spec.add_development_dependency 'rake', '~>
|
42
|
+
spec.add_development_dependency 'bundler', '~> 2.2.10'
|
43
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
44
44
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
45
45
|
|
46
46
|
spec.add_runtime_dependency 'advantage', '~> 0.1', '>= 0.1.2'
|
@@ -20,8 +20,8 @@
|
|
20
20
|
#
|
21
21
|
#====================================================
|
22
22
|
|
23
|
-
require
|
24
|
-
require
|
23
|
+
require 'active_record/connection_adapters/abstract_adapter'
|
24
|
+
require 'arel/visitors/advantage'
|
25
25
|
|
26
26
|
# Singleton class to hold a valid instance of the AdvantageInterface across all connections
|
27
27
|
class ADS
|
@@ -62,6 +62,23 @@ module ActiveRecord
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
# copied and modified from "relation/calculations.rb"
|
66
|
+
module Calculations
|
67
|
+
def count(column_name = nil)
|
68
|
+
if block_given?
|
69
|
+
unless column_name.nil?
|
70
|
+
raise ArgumentError, "Column name argument is not supported when a block is passed."
|
71
|
+
end
|
72
|
+
super()
|
73
|
+
elsif column_name.nil?
|
74
|
+
# ADS doesn't like counting multiple columns, so if there is no column, force the primary_key
|
75
|
+
calculate(:count, self.primary_key)
|
76
|
+
else
|
77
|
+
calculate(:count, column_name)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
65
82
|
module ConnectionAdapters
|
66
83
|
class AdvantageException < StandardError
|
67
84
|
attr_reader :errno
|
@@ -240,7 +257,7 @@ module ActiveRecord
|
|
240
257
|
log(sql, 'delete', binds) { exec_query(sql, binds) }
|
241
258
|
end
|
242
259
|
|
243
|
-
def exec_query(sql, name = "SQL", _binds = [])
|
260
|
+
def exec_query(sql, name = "SQL", _binds = [], **_options)
|
244
261
|
cols, record = execute(sql, name)
|
245
262
|
ActiveRecord::Result.new(cols, record)
|
246
263
|
end
|
@@ -309,6 +326,14 @@ module ActiveRecord
|
|
309
326
|
select(sql, name).map { |row| strip_or_self(row['TABLE_NAME']) }
|
310
327
|
end
|
311
328
|
|
329
|
+
if Rails::VERSION::MAJOR == 5
|
330
|
+
# this really needs fixing, in the case where a database contains views, but that requires
|
331
|
+
# a "data dictionary", and I'm testing against a collection of "database tables"
|
332
|
+
def views(_name = nil)
|
333
|
+
[]
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
312
337
|
# Return a list of columns
|
313
338
|
def columns(table_name, _name = nil) #:nodoc:
|
314
339
|
table_structure(table_name).map do |field|
|
@@ -456,9 +481,9 @@ SQL
|
|
456
481
|
protected
|
457
482
|
|
458
483
|
# Execute a query
|
459
|
-
def select(sql, name = nil, binds = []) #:nodoc:
|
484
|
+
def select(sql, name = nil, binds = [], **options) #:nodoc:
|
460
485
|
if Rails::VERSION::MAJOR >= 4
|
461
|
-
exec_query(sql, name, binds)
|
486
|
+
exec_query(sql, name, binds, **options)
|
462
487
|
else
|
463
488
|
exec_query(sql, name, binds).to_hash
|
464
489
|
end
|
@@ -486,17 +511,49 @@ SQL
|
|
486
511
|
options.include?(:default) && !(options[:null] == false && options[:default].nil?)
|
487
512
|
end
|
488
513
|
|
514
|
+
|
489
515
|
private
|
490
516
|
|
517
|
+
def type_map
|
518
|
+
@type_map ||= Type::TypeMap.new.tap { |m| initialize_type_map(m) }
|
519
|
+
end
|
520
|
+
|
521
|
+
# copied from "connection_adapters/abstract_adapter.rb"
|
522
|
+
def register_class(mapping, key, klass)
|
523
|
+
mapping.register_type(key) do |*args|
|
524
|
+
klass.new
|
525
|
+
end
|
526
|
+
end
|
527
|
+
|
491
528
|
# Used in the lookup_cast_type procedure
|
492
|
-
def initialize_type_map(m
|
493
|
-
|
529
|
+
def initialize_type_map(m)
|
530
|
+
register_class m, %r(boolean)i, Type::Boolean
|
531
|
+
register_class m, %r(char)i, Type::String
|
532
|
+
register_class m, %r(binary)i, Type::Binary
|
533
|
+
register_class m, %r(text)i, Type::Text
|
534
|
+
register_class m, %r(date)i, Type::Date
|
535
|
+
register_class m, %r(time)i, Type::Time
|
536
|
+
register_class m, %r(datetime)i, Type::DateTime
|
537
|
+
register_class m, %r(float)i, Type::Float
|
538
|
+
register_class m, %r(int)i, Type::Integer
|
539
|
+
register_class m, %r(decimal)i, Type::Decimal
|
540
|
+
|
541
|
+
m.alias_type %r(logical)i, "boolean"
|
542
|
+
m.alias_type %r(numeric)i, "decimal"
|
543
|
+
m.alias_type %r(string)i, "char"
|
494
544
|
m.alias_type %r(memo)i, "char"
|
545
|
+
m.alias_type %r(image)i, "binary"
|
546
|
+
m.alias_type %r(varchar)i, "char"
|
547
|
+
m.alias_type %r(timestamp)i, "datetime"
|
548
|
+
m.alias_type %r(number)i, "decimal"
|
549
|
+
m.alias_type %r(money)i, "decimal"
|
550
|
+
m.alias_type %r(double)i, "float"
|
551
|
+
|
495
552
|
m.alias_type %r(long binary)i, "binary"
|
496
553
|
m.alias_type %r(integer)i, "int"
|
497
554
|
m.alias_type %r(short)i, "int"
|
498
555
|
m.alias_type %r(autoinc)i, "int"
|
499
|
-
m.alias_type %r(
|
556
|
+
m.alias_type %r(raw)i, "binary"
|
500
557
|
end
|
501
558
|
|
502
559
|
# Connect
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-advantage-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgar Sherman
|
8
8
|
- Jon Adams
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-06-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,28 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 2.2.10
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 2.2.10
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 12.3.3
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: 12.3.3
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +95,7 @@ metadata:
|
|
95
95
|
homepage_uri: http://devzone.advantagedatabase.com
|
96
96
|
source_code_uri: https://github.com/t12nslookup/activerecord-advantage-adapter/
|
97
97
|
changelog_uri: https://github.com/t12nslookup/activerecord-advantage-adapter/blob/main/CHANGELOG.md
|
98
|
-
post_install_message:
|
98
|
+
post_install_message:
|
99
99
|
rdoc_options: []
|
100
100
|
require_paths:
|
101
101
|
- lib
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubygems_version: 3.1.4
|
114
|
-
signing_key:
|
114
|
+
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: ActiveRecord driver for Advantage
|
117
117
|
test_files: []
|