sequel 5.85.0 → 5.93.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 +4 -4
- data/lib/sequel/adapters/ado.rb +1 -1
- data/lib/sequel/adapters/ibmdb.rb +1 -0
- data/lib/sequel/adapters/jdbc/db2.rb +2 -2
- data/lib/sequel/adapters/jdbc/derby.rb +2 -2
- data/lib/sequel/adapters/jdbc/h2.rb +2 -2
- data/lib/sequel/adapters/jdbc/hsqldb.rb +2 -2
- data/lib/sequel/adapters/jdbc/jtds.rb +2 -2
- data/lib/sequel/adapters/jdbc/mysql.rb +1 -1
- data/lib/sequel/adapters/jdbc/oracle.rb +5 -5
- data/lib/sequel/adapters/jdbc/postgresql.rb +5 -5
- data/lib/sequel/adapters/jdbc/sqlanywhere.rb +6 -6
- data/lib/sequel/adapters/jdbc/sqlite.rb +2 -2
- data/lib/sequel/adapters/jdbc/sqlserver.rb +2 -2
- data/lib/sequel/adapters/jdbc.rb +8 -8
- data/lib/sequel/adapters/mysql2.rb +8 -1
- data/lib/sequel/adapters/oracle.rb +16 -0
- data/lib/sequel/adapters/shared/access.rb +1 -0
- data/lib/sequel/adapters/shared/mssql.rb +4 -3
- data/lib/sequel/adapters/shared/mysql.rb +8 -4
- data/lib/sequel/adapters/shared/oracle.rb +1 -0
- data/lib/sequel/adapters/shared/postgres.rb +140 -9
- data/lib/sequel/adapters/sqlite.rb +4 -0
- data/lib/sequel/adapters/trilogy.rb +1 -2
- data/lib/sequel/core.rb +15 -0
- data/lib/sequel/database/dataset_defaults.rb +3 -3
- data/lib/sequel/database/misc.rb +17 -4
- data/lib/sequel/database/query.rb +11 -11
- data/lib/sequel/database/schema_generator.rb +8 -0
- data/lib/sequel/dataset/deprecated_singleton_class_methods.rb +1 -1
- data/lib/sequel/dataset/prepared_statements.rb +70 -25
- data/lib/sequel/dataset/query.rb +9 -5
- data/lib/sequel/dataset/sql.rb +19 -9
- data/lib/sequel/extensions/connection_validator.rb +15 -10
- data/lib/sequel/extensions/migration.rb +23 -3
- data/lib/sequel/extensions/null_dataset.rb +2 -2
- data/lib/sequel/extensions/pg_auto_parameterize.rb +6 -1
- data/lib/sequel/extensions/pg_auto_parameterize_in_array.rb +93 -10
- data/lib/sequel/extensions/pg_enum.rb +3 -3
- data/lib/sequel/extensions/pg_row.rb +3 -1
- data/lib/sequel/extensions/pg_schema_caching.rb +90 -0
- data/lib/sequel/extensions/query_blocker.rb +172 -0
- data/lib/sequel/extensions/schema_caching.rb +24 -9
- data/lib/sequel/extensions/schema_dumper.rb +16 -4
- data/lib/sequel/extensions/sqlite_json_ops.rb +1 -1
- data/lib/sequel/extensions/string_agg.rb +2 -2
- data/lib/sequel/extensions/virtual_row_method_block.rb +1 -0
- data/lib/sequel/model/associations.rb +28 -3
- data/lib/sequel/model/base.rb +67 -18
- data/lib/sequel/plugins/composition.rb +1 -1
- data/lib/sequel/plugins/enum.rb +1 -1
- data/lib/sequel/plugins/forbid_lazy_load.rb +14 -1
- data/lib/sequel/plugins/inspect_pk.rb +44 -0
- data/lib/sequel/plugins/instance_filters.rb +4 -1
- data/lib/sequel/plugins/inverted_subsets.rb +1 -0
- data/lib/sequel/plugins/lazy_attributes.rb +1 -1
- data/lib/sequel/plugins/nested_attributes.rb +10 -5
- data/lib/sequel/plugins/paged_operations.rb +5 -2
- data/lib/sequel/plugins/pg_auto_constraint_validations.rb +6 -1
- data/lib/sequel/plugins/pg_auto_validate_enums.rb +88 -0
- data/lib/sequel/plugins/pg_eager_any_typed_array.rb +95 -0
- data/lib/sequel/plugins/rcte_tree.rb +1 -1
- data/lib/sequel/plugins/serialization.rb +11 -5
- data/lib/sequel/plugins/sql_comments.rb +7 -2
- data/lib/sequel/plugins/static_cache_cache.rb +50 -13
- data/lib/sequel/plugins/subset_conditions.rb +85 -5
- data/lib/sequel/plugins/subset_static_cache.rb +263 -0
- data/lib/sequel/sql.rb +15 -6
- data/lib/sequel/version.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd35e8223b7f6d450cf4c1efeaad152236b4a1e360299aa46b03841bb45996c6
|
4
|
+
data.tar.gz: '096a62cc241cf6f48d0c2b3e0799402f21aa24a1196a332e022ef53ebaaeea85'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b66c7e30dfb69468ad41bfe64de4e0442ad62590ea735b2e4bb591c46b949794a7a453c21532999c89296694f0136d9353041ec56fc470ab2ba0483f0534d61
|
7
|
+
data.tar.gz: 978dcd457829ff39f1ae9769dc574049cf29d07a2dbc8e307aa806a7b1954cd72432257de37d9e5236269b5746f615f8d0f7feb4979e9b86b619f582344afc29
|
data/lib/sequel/adapters/ado.rb
CHANGED
@@ -179,7 +179,7 @@ module Sequel
|
|
179
179
|
|
180
180
|
def adapter_initialize
|
181
181
|
case @opts[:conn_string]
|
182
|
-
when /Microsoft\.(Jet|ACE)\.OLEDB/
|
182
|
+
when /Microsoft\.(Jet|ACE)\.OLEDB/i
|
183
183
|
require_relative 'ado/access'
|
184
184
|
extend Sequel::ADO::Access::DatabaseMethods
|
185
185
|
self.dataset_class = ADO::Access::Dataset
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('
|
3
|
+
Sequel::JDBC.load_driver('Java::ComIbmDb2Jcc::DB2Driver')
|
4
4
|
require_relative '../shared/db2'
|
5
5
|
require_relative 'transactions'
|
6
6
|
|
@@ -25,7 +25,7 @@ module Sequel
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
db.extend_datasets Sequel::DB2::DatasetMethods
|
28
|
-
|
28
|
+
Java::ComIbmDb2Jcc::DB2Driver
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('
|
3
|
+
Sequel::JDBC.load_driver('Java::OrgApacheDerbyJdbc::EmbeddedDriver', :Derby)
|
4
4
|
require_relative 'transactions'
|
5
5
|
require_relative '../utils/columns_limit_1'
|
6
6
|
|
@@ -10,7 +10,7 @@ module Sequel
|
|
10
10
|
DATABASE_SETUP[:derby] = proc do |db|
|
11
11
|
db.extend(Sequel::JDBC::Derby::DatabaseMethods)
|
12
12
|
db.dataset_class = Sequel::JDBC::Derby::Dataset
|
13
|
-
|
13
|
+
Java::OrgApacheDerbyJdbc::EmbeddedDriver
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('
|
3
|
+
Sequel::JDBC.load_driver('Java::OrgH2::Driver', :H2)
|
4
4
|
require_relative '../../extensions/auto_cast_date_and_time'
|
5
5
|
|
6
6
|
module Sequel
|
@@ -9,7 +9,7 @@ module Sequel
|
|
9
9
|
DATABASE_SETUP[:h2] = proc do |db|
|
10
10
|
db.extend(Sequel::JDBC::H2::DatabaseMethods)
|
11
11
|
db.dataset_class = Sequel::JDBC::H2::Dataset
|
12
|
-
|
12
|
+
Java::OrgH2::Driver
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('
|
3
|
+
Sequel::JDBC.load_driver('Java::OrgHsqldb::jdbcDriver', :HSQLDB)
|
4
4
|
require_relative 'transactions'
|
5
5
|
require_relative '../../extensions/auto_cast_date_and_time'
|
6
6
|
|
@@ -10,7 +10,7 @@ module Sequel
|
|
10
10
|
DATABASE_SETUP[:hsqldb] = proc do |db|
|
11
11
|
db.extend(Sequel::JDBC::HSQLDB::DatabaseMethods)
|
12
12
|
db.dataset_class = Sequel::JDBC::HSQLDB::Dataset
|
13
|
-
|
13
|
+
Java::OrgHsqldb::jdbcDriver
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('Java::
|
3
|
+
Sequel::JDBC.load_driver('Java::NetSourceforgeJtdsJdbc::Driver', :JTDS)
|
4
4
|
require_relative 'mssql'
|
5
5
|
|
6
6
|
module Sequel
|
@@ -10,7 +10,7 @@ module Sequel
|
|
10
10
|
db.extend(Sequel::JDBC::JTDS::DatabaseMethods)
|
11
11
|
db.extend_datasets Sequel::MSSQL::DatasetMethods
|
12
12
|
db.send(:set_mssql_unicode_strings)
|
13
|
-
Java::
|
13
|
+
Java::NetSourceforgeJtdsJdbc::Driver
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Sequel
|
4
4
|
module JDBC
|
5
|
-
driver = Sequel::JDBC.load_driver(%w'
|
5
|
+
driver = Sequel::JDBC.load_driver(%w'Java::ComMysqlCjJdbc::Driver Java::ComMysqlJdbc::Driver', :MySQL)
|
6
6
|
require_relative '../shared/mysql'
|
7
7
|
|
8
8
|
Sequel.synchronize do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('Java::
|
3
|
+
Sequel::JDBC.load_driver('Java::OracleJdbcDriver::OracleDriver')
|
4
4
|
require_relative '../shared/oracle'
|
5
5
|
require_relative 'transactions'
|
6
6
|
|
@@ -10,12 +10,12 @@ module Sequel
|
|
10
10
|
DATABASE_SETUP[:oracle] = proc do |db|
|
11
11
|
db.extend(Sequel::JDBC::Oracle::DatabaseMethods)
|
12
12
|
db.dataset_class = Sequel::JDBC::Oracle::Dataset
|
13
|
-
Java::
|
13
|
+
Java::OracleJdbcDriver::OracleDriver
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
module Oracle
|
18
|
-
JAVA_BIG_DECIMAL_CONSTRUCTOR =
|
18
|
+
JAVA_BIG_DECIMAL_CONSTRUCTOR = Java::JavaMath::BigDecimal.java_class.constructor(Java::long).method(:new_instance)
|
19
19
|
ORACLE_DECIMAL = Object.new
|
20
20
|
def ORACLE_DECIMAL.call(r, i)
|
21
21
|
if v = r.getBigDecimal(i)
|
@@ -76,7 +76,7 @@ module Sequel
|
|
76
76
|
rs = log_connection_yield(sql, conn){stmt.executeQuery(sql)}
|
77
77
|
rs.next
|
78
78
|
rs.getLong(1)
|
79
|
-
rescue
|
79
|
+
rescue Java::JavaSql::SQLException
|
80
80
|
nil
|
81
81
|
end
|
82
82
|
end
|
@@ -122,7 +122,7 @@ module Sequel
|
|
122
122
|
NUMERIC_TYPE = Java::JavaSQL::Types::NUMERIC
|
123
123
|
TIMESTAMP_TYPE = Java::JavaSQL::Types::TIMESTAMP
|
124
124
|
CLOB_TYPE = Java::JavaSQL::Types::CLOB
|
125
|
-
TIMESTAMPTZ_TYPES = [Java::
|
125
|
+
TIMESTAMPTZ_TYPES = [Java::OracleJdbc::OracleTypes::TIMESTAMPTZ, Java::OracleJdbc::OracleTypes::TIMESTAMPLTZ].freeze
|
126
126
|
|
127
127
|
def type_convertor(map, meta, type, i)
|
128
128
|
case type
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('
|
3
|
+
Sequel::JDBC.load_driver('Java::OrgPostgresql::Driver', :Postgres)
|
4
4
|
require_relative '../shared/postgres'
|
5
5
|
|
6
6
|
module Sequel
|
@@ -9,7 +9,7 @@ module Sequel
|
|
9
9
|
DATABASE_SETUP[:postgresql] = proc do |db|
|
10
10
|
db.dataset_class = Sequel::JDBC::Postgres::Dataset
|
11
11
|
db.extend(Sequel::JDBC::Postgres::DatabaseMethods)
|
12
|
-
|
12
|
+
Java::OrgPostgresql::Driver
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -43,7 +43,7 @@ module Sequel
|
|
43
43
|
|
44
44
|
synchronize(opts[:server]) do |conn|
|
45
45
|
begin
|
46
|
-
copy_manager =
|
46
|
+
copy_manager = Java::OrgPostgresqlCopy::CopyManager.new(conn)
|
47
47
|
copier = copy_manager.copy_in(copy_into_sql(table, opts))
|
48
48
|
if defined?(yield)
|
49
49
|
while buf = yield
|
@@ -74,7 +74,7 @@ module Sequel
|
|
74
74
|
# See Sequel::Postgres::Adapter#copy_table
|
75
75
|
def copy_table(table, opts=OPTS)
|
76
76
|
synchronize(opts[:server]) do |conn|
|
77
|
-
copy_manager =
|
77
|
+
copy_manager = Java::OrgPostgresqlCopy::CopyManager.new(conn)
|
78
78
|
copier = copy_manager.copy_out(copy_table_sql(table, opts))
|
79
79
|
begin
|
80
80
|
if defined?(yield)
|
@@ -148,7 +148,7 @@ module Sequel
|
|
148
148
|
# and set that as the prepared statement argument.
|
149
149
|
def set_ps_arg(cps, arg, i)
|
150
150
|
if v = bound_variable_arg(arg, nil)
|
151
|
-
obj =
|
151
|
+
obj = Java::OrgPostgresqlUtil::PGobject.new
|
152
152
|
obj.setType("unknown")
|
153
153
|
obj.setValue(v)
|
154
154
|
cps.setObject(i, obj)
|
@@ -6,12 +6,12 @@ require_relative 'transactions'
|
|
6
6
|
module Sequel
|
7
7
|
module JDBC
|
8
8
|
drv = [
|
9
|
-
lambda{Java::
|
10
|
-
lambda{Java::
|
11
|
-
lambda{Java::
|
12
|
-
lambda{Java::
|
13
|
-
lambda{Java::
|
14
|
-
lambda{Java::
|
9
|
+
lambda{Java::SybaseJdbc4Sqlanywhere::IDriver},
|
10
|
+
lambda{Java::IanywhereMlJdbcodbcJdbc4::IDriver},
|
11
|
+
lambda{Java::SybaseJdbcSqlanywhere::IDriver},
|
12
|
+
lambda{Java::IanywhereMlJdbcodbcJdbc::IDriver},
|
13
|
+
lambda{Java::ComSybaseJdbc4Jdbc::Sybdriver},
|
14
|
+
lambda{Java::ComSybaseJdbc3Jdbc::Sybdriver}
|
15
15
|
].each do |class_proc|
|
16
16
|
begin
|
17
17
|
break class_proc.call
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('
|
3
|
+
Sequel::JDBC.load_driver('Java::OrgSqlite::JDBC', :SQLite3)
|
4
4
|
require_relative '../shared/sqlite'
|
5
5
|
|
6
6
|
module Sequel
|
@@ -10,7 +10,7 @@ module Sequel
|
|
10
10
|
db.extend(Sequel::JDBC::SQLite::DatabaseMethods)
|
11
11
|
db.extend_datasets Sequel::SQLite::DatasetMethods
|
12
12
|
db.set_integer_booleans
|
13
|
-
|
13
|
+
Java::OrgSqlite::JDBC
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
Sequel::JDBC.load_driver('
|
3
|
+
Sequel::JDBC.load_driver('Java::ComMicrosoftSqlserverJdbc::SQLServerDriver')
|
4
4
|
require_relative 'mssql'
|
5
5
|
|
6
6
|
module Sequel
|
@@ -10,7 +10,7 @@ module Sequel
|
|
10
10
|
db.extend(Sequel::JDBC::SQLServer::DatabaseMethods)
|
11
11
|
db.extend_datasets Sequel::MSSQL::DatasetMethods
|
12
12
|
db.send(:set_mssql_unicode_strings)
|
13
|
-
|
13
|
+
Java::ComMicrosoftSqlserverJdbc::SQLServerDriver
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
data/lib/sequel/adapters/jdbc.rb
CHANGED
@@ -20,7 +20,7 @@ module Sequel
|
|
20
20
|
|
21
21
|
# Create custom NativeException alias for nicer access, and also so that
|
22
22
|
# JRuby 9.2+ so it doesn't use the deprecated ::NativeException
|
23
|
-
NativeException =
|
23
|
+
NativeException = Java::JavaLang::Exception
|
24
24
|
|
25
25
|
# Default database error classes
|
26
26
|
DATABASE_ERROR_CLASSES = [NativeException]
|
@@ -227,7 +227,7 @@ module Sequel
|
|
227
227
|
raise e unless driver
|
228
228
|
# If the DriverManager can't get the connection - use the connect
|
229
229
|
# method of the driver. (This happens under Tomcat for instance)
|
230
|
-
props =
|
230
|
+
props = Java::JavaUtil::Properties.new
|
231
231
|
if opts && opts[:user] && opts[:password]
|
232
232
|
props.setProperty("user", opts[:user])
|
233
233
|
props.setProperty("password", opts[:password])
|
@@ -506,7 +506,7 @@ module Sequel
|
|
506
506
|
# Gets the connection from JNDI.
|
507
507
|
def get_connection_from_jndi
|
508
508
|
jndi_name = JNDI_URI_REGEXP.match(uri)[1]
|
509
|
-
|
509
|
+
Java::JavaxNaming::InitialContext.new.lookup(jndi_name).connection
|
510
510
|
end
|
511
511
|
|
512
512
|
# Gets the JDBC connection uri from the JNDI resource.
|
@@ -530,19 +530,19 @@ module Sequel
|
|
530
530
|
|
531
531
|
# Support Date objects used in bound variables
|
532
532
|
def java_sql_date(date)
|
533
|
-
|
533
|
+
Java::JavaSql::Date.new(Time.local(date.year, date.month, date.day).to_i * 1000)
|
534
534
|
end
|
535
535
|
|
536
536
|
# Support DateTime objects used in bound variables
|
537
537
|
def java_sql_datetime(datetime)
|
538
|
-
ts =
|
538
|
+
ts = Java::JavaSql::Timestamp.new(Time.local(datetime.year, datetime.month, datetime.day, datetime.hour, datetime.min, datetime.sec).to_i * 1000)
|
539
539
|
ts.setNanos((datetime.sec_fraction * 1000000000).to_i)
|
540
540
|
ts
|
541
541
|
end
|
542
542
|
|
543
543
|
# Support fractional seconds for Time objects used in bound variables
|
544
544
|
def java_sql_timestamp(time)
|
545
|
-
ts =
|
545
|
+
ts = Java::JavaSql::Timestamp.new(time.to_i * 1000)
|
546
546
|
ts.setNanos(time.nsec)
|
547
547
|
ts
|
548
548
|
end
|
@@ -636,11 +636,11 @@ module Sequel
|
|
636
636
|
def schema_column_set_db_type(schema)
|
637
637
|
case schema[:type]
|
638
638
|
when :string
|
639
|
-
if schema[:db_type] =~ /\A(character( varying)?|n?(var)?char2?)\z/
|
639
|
+
if schema[:db_type] =~ /\A(character( varying)?|n?(var)?char2?)\z/i && schema[:column_size] > 0
|
640
640
|
schema[:db_type] += "(#{schema[:column_size]})"
|
641
641
|
end
|
642
642
|
when :decimal
|
643
|
-
if schema[:db_type] =~ /\A(decimal|numeric)\z/
|
643
|
+
if schema[:db_type] =~ /\A(decimal|numeric)\z/i && schema[:column_size] > 0 && schema[:scale] >= 0
|
644
644
|
schema[:db_type] += "(#{schema[:column_size]}, #{schema[:scale]})"
|
645
645
|
end
|
646
646
|
end
|
@@ -97,7 +97,14 @@ module Sequel
|
|
97
97
|
synchronize(opts[:server]) do |conn|
|
98
98
|
stmt, ps_sql = conn.prepared_statements[ps_name]
|
99
99
|
unless ps_sql == sql
|
100
|
-
|
100
|
+
if stmt
|
101
|
+
begin
|
102
|
+
stmt.close
|
103
|
+
rescue ::Mysql2::Error
|
104
|
+
# probably Invalid statement handle, can happen from dropping
|
105
|
+
# related table, ignore as we won't be using it again.
|
106
|
+
end
|
107
|
+
end
|
101
108
|
stmt = log_connection_yield("Preparing #{ps_name}: #{sql}", conn){conn.prepare(sql)}
|
102
109
|
conn.prepared_statements[ps_name] = [stmt, sql]
|
103
110
|
end
|
@@ -353,6 +353,20 @@ module Sequel
|
|
353
353
|
i = prepared_args.length
|
354
354
|
LiteralString.new(":#{i}")
|
355
355
|
end
|
356
|
+
|
357
|
+
# Avoid infinite recursion on Oracle <12 for datasets with limits
|
358
|
+
# (which are implemented via subqueries). If the given dataset's
|
359
|
+
# prepared args are the same object as current dataset's, call the
|
360
|
+
# standard Sequel::Dataset#subselect_sql_append method, instead
|
361
|
+
# of calling super (which will call prepared_sql and result in
|
362
|
+
# infinite recursion).
|
363
|
+
def subselect_sql_append(sql, ds)
|
364
|
+
if !supports_fetch_next_rows? && ds.opts[:prepared_args].equal?(@opts[:prepared_args])
|
365
|
+
orig_subselect_sql_append(sql, ds)
|
366
|
+
else
|
367
|
+
super
|
368
|
+
end
|
369
|
+
end
|
356
370
|
end
|
357
371
|
|
358
372
|
BindArgumentMethods = prepared_statements_module(:bind, ArgumentMapper)
|
@@ -383,6 +397,8 @@ module Sequel
|
|
383
397
|
|
384
398
|
private
|
385
399
|
|
400
|
+
alias orig_subselect_sql_append subselect_sql_append
|
401
|
+
|
386
402
|
def literal_other_append(sql, v)
|
387
403
|
case v
|
388
404
|
when OraDate
|
@@ -88,6 +88,7 @@ module Sequel
|
|
88
88
|
|
89
89
|
module DatasetMethods
|
90
90
|
include(Module.new do
|
91
|
+
Sequel.set_temp_name(self){"Sequel::Access::DatasetMethods::_SQLMethods"}
|
91
92
|
Dataset.def_sql_method(self, :select, %w'select distinct limit columns into from join where group order having compounds')
|
92
93
|
end)
|
93
94
|
include EmulateOffsetWithReverseAndCount
|
@@ -480,11 +480,11 @@ module Sequel
|
|
480
480
|
|
481
481
|
def schema_column_type(db_type)
|
482
482
|
case db_type
|
483
|
-
when /\A(?:bit)\z/
|
483
|
+
when /\A(?:bit)\z/i
|
484
484
|
:boolean
|
485
|
-
when /\A(?:(?:small)?money)\z/
|
485
|
+
when /\A(?:(?:small)?money)\z/i
|
486
486
|
:decimal
|
487
|
-
when /\A(timestamp|rowversion)\z/
|
487
|
+
when /\A(timestamp|rowversion)\z/i
|
488
488
|
:blob
|
489
489
|
else
|
490
490
|
super
|
@@ -574,6 +574,7 @@ module Sequel
|
|
574
574
|
|
575
575
|
module DatasetMethods
|
576
576
|
include(Module.new do
|
577
|
+
Sequel.set_temp_name(self){"Sequel::MSSQL::DatasetMethods::_SQLMethods"}
|
577
578
|
Dataset.def_sql_method(self, :select, %w'with select distinct limit columns into from lock join where group having compounds order')
|
578
579
|
end)
|
579
580
|
include EmulateOffsetWithRowNumber
|
@@ -550,11 +550,11 @@ module Sequel
|
|
550
550
|
|
551
551
|
def schema_column_type(db_type)
|
552
552
|
case db_type
|
553
|
-
when /\Aset/
|
553
|
+
when /\Aset/i
|
554
554
|
:set
|
555
|
-
when /\Amediumint/
|
555
|
+
when /\Amediumint/i
|
556
556
|
:integer
|
557
|
-
when /\Amediumtext/
|
557
|
+
when /\Amediumtext/i
|
558
558
|
:string
|
559
559
|
else
|
560
560
|
super
|
@@ -567,7 +567,7 @@ module Sequel
|
|
567
567
|
im = input_identifier_meth(opts[:dataset])
|
568
568
|
table = SQL::Identifier.new(im.call(table_name))
|
569
569
|
table = SQL::QualifiedIdentifier.new(im.call(opts[:schema]), table) if opts[:schema]
|
570
|
-
metadata_dataset.with_sql("
|
570
|
+
metadata_dataset.with_sql("SHOW FULL COLUMNS FROM ?", table).map do |row|
|
571
571
|
extra = row.delete(:Extra)
|
572
572
|
if row[:primary_key] = row.delete(:Key) == 'PRI'
|
573
573
|
row[:auto_increment] = !!(extra.to_s =~ /auto_increment/i)
|
@@ -577,10 +577,14 @@ module Sequel
|
|
577
577
|
row[:generated] = !!(extra.to_s =~ /VIRTUAL|STORED|PERSISTENT/i)
|
578
578
|
end
|
579
579
|
row[:allow_null] = row.delete(:Null) == 'YES'
|
580
|
+
row[:comment] = row.delete(:Comment)
|
581
|
+
row[:comment] = nil if row[:comment] == ""
|
580
582
|
row[:default] = row.delete(:Default)
|
581
583
|
row[:db_type] = row.delete(:Type)
|
582
584
|
row[:type] = schema_column_type(row[:db_type])
|
583
585
|
row[:extra] = extra
|
586
|
+
row.delete(:Collation)
|
587
|
+
row.delete(:Privileges)
|
584
588
|
[m.call(row.delete(:Field)), row]
|
585
589
|
end
|
586
590
|
end
|
@@ -333,6 +333,7 @@ module Sequel
|
|
333
333
|
BITAND_PROC = lambda{|a, b| Sequel.lit(["CAST(BITAND(", ", ", ") AS INTEGER)"], a, b)}
|
334
334
|
|
335
335
|
include(Module.new do
|
336
|
+
Sequel.set_temp_name(self){"Sequel::Oracle::DatasetMethods::_SQLMethods"}
|
336
337
|
Dataset.def_sql_method(self, :select, %w'with select distinct columns from join where group having compounds order limit lock')
|
337
338
|
end)
|
338
339
|
|