activerecord-oracle_enhanced-adapter 1.8.0.rc1 → 1.8.0.rc2
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/History.md +16 -0
- data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +3 -3
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +9 -3
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +0 -4
- data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +4 -0
- data/lib/active_record/oracle_enhanced/type/timestamptz.rb +23 -0
- data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +22 -103
- data/spec/spec_config.yaml.template +11 -0
- data/spec/support/alter_system_user_password.sql +2 -0
- data/spec/support/create_oracle_enhanced_users.sql +31 -0
- metadata +17 -16
- data/.rspec +0 -4
- data/Gemfile +0 -29
- data/RUNNING_TESTS.md +0 -109
- data/Rakefile +0 -39
- data/VERSION +0 -1
- data/activerecord-oracle_enhanced-adapter.gemspec +0 -91
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03e596bfe5c5140e4cbf6dd7bacbaacdf97766eb
|
4
|
+
data.tar.gz: ae305e3211e34a5341b5d53075588641a62919b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09e01b985dae8d8fb9550e772188946c97a53a9436600df58488d697dac989ea58b8112df01d4ca6738bc7cd32f81184d28a4b9a673f7f286bce079c0bd56c93'
|
7
|
+
data.tar.gz: d13e2aabe98d177de165da2c762d3339c0f4b7e452fef02bfbc71b62848484b8e25c44516f44db306e29d25fc30584380f342ff82fd0db34d59439723d698bd4
|
data/History.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## 1.8.0.rc2 / 2017-04-19
|
2
|
+
|
3
|
+
* Changes and bug fixes
|
4
|
+
* Fix `select_all` with legacy `binds` [#1246,#1248,#1250]
|
5
|
+
* Fix the `BINARY_FLOAT` column type returns nil in JRuby [#1244, #1254, #1255]
|
6
|
+
* Handle `TIMESTAMP WITH TIMEZONE` separately from `TIMEZONE` [#1206, #1267, #1268]
|
7
|
+
* Changing `NLS_DATE_FORMAT` and `NLS_TIMESTAMP_FORMAT` is not supported [#1267, #1268]
|
8
|
+
* Let abstract adapter type cast Date, DateTime and Time for JRuby [#1272, #1273]
|
9
|
+
* Collapse a file specification in gemspec [#1296, #1297]
|
10
|
+
* Do not write VERSION directly with gemspec [#1298, #1299]
|
11
|
+
* Omit specification of release date in gemspec [#1298, #1299]
|
12
|
+
* Add missing `timestamptz.rb` to gemspec at release18 branch [#1286]
|
13
|
+
* Remove specs for unsupported behaviour which causes `ORA-01861` [#1267, #1269, #1271]
|
14
|
+
* Address `OCIException: OCI8 was already closed` at specs for JSON [#1265, #1266]
|
15
|
+
* Bump Ruby version to 2.2.7 [#1261]
|
16
|
+
|
1
17
|
## 1.8.0.rc1 / 2017-03-20
|
2
18
|
|
3
19
|
* Major enhancements
|
@@ -17,7 +17,7 @@ module ActiveRecord
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def exec_query(sql, name = "SQL", binds = [], prepare: false)
|
20
|
-
type_casted_binds = binds
|
20
|
+
type_casted_binds = type_casted_binds(binds)
|
21
21
|
|
22
22
|
log(sql, name, binds, type_casted_binds) do
|
23
23
|
cursor = nil
|
@@ -94,7 +94,7 @@ module ActiveRecord
|
|
94
94
|
# New method in ActiveRecord 3.1
|
95
95
|
def exec_insert(sql, name = nil, binds = [], pk = nil, sequence_name = nil)
|
96
96
|
sql, binds = sql_for_insert(sql, pk, nil, sequence_name, binds)
|
97
|
-
type_casted_binds = binds
|
97
|
+
type_casted_binds = type_casted_binds(binds)
|
98
98
|
|
99
99
|
log(sql, name, binds, type_casted_binds) do
|
100
100
|
returning_id_col = returning_id_index = nil
|
@@ -130,7 +130,7 @@ module ActiveRecord
|
|
130
130
|
|
131
131
|
# New method in ActiveRecord 3.1
|
132
132
|
def exec_update(sql, name = nil, binds = [])
|
133
|
-
type_casted_binds = binds
|
133
|
+
type_casted_binds = type_casted_binds(binds)
|
134
134
|
|
135
135
|
log(sql, name, binds, type_casted_binds) do
|
136
136
|
cached = false
|
@@ -137,7 +137,11 @@ module ActiveRecord
|
|
137
137
|
end
|
138
138
|
|
139
139
|
# Set session time zone to current time zone
|
140
|
-
|
140
|
+
if ActiveRecord::Base.default_timezone == :local
|
141
|
+
@raw_connection.setSessionTimeZone(time_zone)
|
142
|
+
elsif ActiveRecord::Base.default_timezone == :utc
|
143
|
+
@raw_connection.setSessionTimeZone("UTC")
|
144
|
+
end
|
141
145
|
|
142
146
|
# Set default number of rows to prefetch
|
143
147
|
# @raw_connection.setDefaultRowPrefetch(prefetch_rows) if prefetch_rows
|
@@ -362,8 +366,8 @@ module ActiveRecord
|
|
362
366
|
when Java::JavaSql::Timestamp
|
363
367
|
@raw_statement.setTimestamp(position, value)
|
364
368
|
when Time
|
365
|
-
|
366
|
-
@raw_statement.setTimestamp(position,
|
369
|
+
new_value = Java::java.sql.Timestamp.new(value.year - 1900, value.month - 1, value.day, value.hour, value.min, value.sec, value.usec * 1000)
|
370
|
+
@raw_statement.setTimestamp(position, new_value)
|
367
371
|
when NilClass
|
368
372
|
# TODO: currently nil is always bound as NULL with VARCHAR type.
|
369
373
|
# When nils will actually be used by ActiveRecord as bound parameters
|
@@ -506,6 +510,8 @@ module ActiveRecord
|
|
506
510
|
else
|
507
511
|
BigDecimal.new(d.stringValue)
|
508
512
|
end
|
513
|
+
when :BINARY_FLOAT
|
514
|
+
rset.getFloat(i)
|
509
515
|
when :VARCHAR2, :CHAR, :LONG, :NVARCHAR2, :NCHAR
|
510
516
|
rset.getString(i)
|
511
517
|
when :DATE
|
@@ -12,10 +12,6 @@ module ActiveRecord
|
|
12
12
|
clob = Java::OracleSql::CLOB.createTemporary(@connection.raw_connection, false, Java::OracleSql::CLOB::DURATION_SESSION)
|
13
13
|
clob.setString(1, value.to_s)
|
14
14
|
clob
|
15
|
-
when Date, DateTime
|
16
|
-
Java::oracle.sql.DATE.new(value.strftime("%Y-%m-%d %H:%M:%S"))
|
17
|
-
when Time
|
18
|
-
Java::java.sql.Timestamp.new(value.year - 1900, value.month - 1, value.day, value.hour, value.min, value.sec, value.usec * 1000)
|
19
15
|
else
|
20
16
|
super
|
21
17
|
end
|
@@ -119,7 +119,7 @@ module ActiveRecord
|
|
119
119
|
|
120
120
|
def _type_cast(value)
|
121
121
|
case value
|
122
|
-
when
|
122
|
+
when ActiveRecord::OracleEnhanced::Type::TimestampTz::Data
|
123
123
|
if value.acts_like?(:time)
|
124
124
|
zone_conversion_method = ActiveRecord::Base.default_timezone == :utc ? :getutc : :getlocal
|
125
125
|
value.respond_to?(zone_conversion_method) ? value.send(zone_conversion_method) : value
|
@@ -941,6 +941,7 @@ module ActiveRecord
|
|
941
941
|
def initialize_type_map(m)
|
942
942
|
super
|
943
943
|
# oracle
|
944
|
+
register_class_with_precision m, %r(ZONE)i, ActiveRecord::OracleEnhanced::Type::TimestampTz
|
944
945
|
register_class_with_limit m, %r(raw)i, ActiveRecord::OracleEnhanced::Type::Raw
|
945
946
|
register_class_with_limit m, %r(char)i, ActiveRecord::OracleEnhanced::Type::String
|
946
947
|
register_class_with_limit m, %r(clob)i, ActiveRecord::OracleEnhanced::Type::Text
|
@@ -1114,3 +1115,6 @@ ActiveRecord::Type.register(:boolean, ActiveRecord::OracleEnhanced::Type::Boolea
|
|
1114
1115
|
# Add JSON attribute support
|
1115
1116
|
require "active_record/oracle_enhanced/type/json"
|
1116
1117
|
ActiveRecord::Type.register(:json, ActiveRecord::OracleEnhanced::Type::Json, adapter: :oracleenhanced)
|
1118
|
+
|
1119
|
+
# Add Type:TimestampTz
|
1120
|
+
require "active_record/oracle_enhanced/type/timestamptz"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module OracleEnhanced
|
3
|
+
module Type
|
4
|
+
class TimestampTz < ActiveRecord::Type::DateTime
|
5
|
+
def type
|
6
|
+
:timestamptz
|
7
|
+
end
|
8
|
+
|
9
|
+
class Data < DelegateClass(::Time) # :nodoc:
|
10
|
+
end
|
11
|
+
|
12
|
+
def serialize(value)
|
13
|
+
case value = super
|
14
|
+
when ::Time
|
15
|
+
Data.new(value)
|
16
|
+
else
|
17
|
+
value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -511,100 +511,6 @@ describe "OracleEnhancedAdapter timestamp with timezone support" do
|
|
511
511
|
|
512
512
|
end
|
513
513
|
|
514
|
-
describe "OracleEnhancedAdapter date and timestamp with different NLS date formats" do
|
515
|
-
before(:all) do
|
516
|
-
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
|
517
|
-
@conn = ActiveRecord::Base.connection
|
518
|
-
@conn.execute <<-SQL
|
519
|
-
CREATE TABLE test_employees (
|
520
|
-
employee_id NUMBER(6,0) PRIMARY KEY,
|
521
|
-
first_name VARCHAR2(20),
|
522
|
-
last_name VARCHAR2(25),
|
523
|
-
email VARCHAR2(25),
|
524
|
-
phone_number VARCHAR2(20),
|
525
|
-
hire_date DATE,
|
526
|
-
job_id NUMBER(6,0),
|
527
|
-
salary NUMBER(8,2),
|
528
|
-
commission_pct NUMBER(2,2),
|
529
|
-
manager_id NUMBER(6,0),
|
530
|
-
department_id NUMBER(4,0),
|
531
|
-
created_at DATE,
|
532
|
-
created_at_ts TIMESTAMP
|
533
|
-
)
|
534
|
-
SQL
|
535
|
-
@conn.execute <<-SQL
|
536
|
-
CREATE SEQUENCE test_employees_seq MINVALUE 1
|
537
|
-
INCREMENT BY 1 CACHE 20 NOORDER NOCYCLE
|
538
|
-
SQL
|
539
|
-
# @conn.execute %q{alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS'}
|
540
|
-
@conn.execute "alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'"
|
541
|
-
# @conn.execute %q{alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS'}
|
542
|
-
@conn.execute "alter session set nls_timestamp_format = 'DD-MON-YYYY HH24:MI:SS'"
|
543
|
-
end
|
544
|
-
|
545
|
-
after(:all) do
|
546
|
-
@conn.execute "DROP TABLE test_employees"
|
547
|
-
@conn.execute "DROP SEQUENCE test_employees_seq"
|
548
|
-
end
|
549
|
-
|
550
|
-
before(:each) do
|
551
|
-
class ::TestEmployee < ActiveRecord::Base
|
552
|
-
self.primary_key = "employee_id"
|
553
|
-
end
|
554
|
-
@today = Date.new(2008, 6, 28)
|
555
|
-
@now = Time.local(2008, 6, 28, 13, 34, 33)
|
556
|
-
end
|
557
|
-
|
558
|
-
after(:each) do
|
559
|
-
Object.send(:remove_const, "TestEmployee")
|
560
|
-
ActiveRecord::Base.clear_cache!
|
561
|
-
ActiveRecord::Base.default_timezone = :utc
|
562
|
-
end
|
563
|
-
|
564
|
-
def create_test_employee
|
565
|
-
@employee = TestEmployee.create(
|
566
|
-
first_name: "First",
|
567
|
-
last_name: "Last",
|
568
|
-
hire_date: @today,
|
569
|
-
created_at: @now,
|
570
|
-
created_at_ts: @now
|
571
|
-
)
|
572
|
-
@employee.reload
|
573
|
-
end
|
574
|
-
|
575
|
-
it "should return Time value from DATE column if emulate_dates_by_column_name is false" do
|
576
|
-
ActiveRecord::Base.default_timezone = :local
|
577
|
-
class ::TestEmployee < ActiveRecord::Base
|
578
|
-
attribute :hire_date, :datetime
|
579
|
-
end
|
580
|
-
create_test_employee
|
581
|
-
expect(@employee.hire_date.class).to eq(Time)
|
582
|
-
expect(@employee.hire_date).to eq(@today.to_time)
|
583
|
-
end
|
584
|
-
|
585
|
-
it "should return Date value from DATE column if column name contains 'date' and emulate_dates_by_column_name is true" do
|
586
|
-
create_test_employee
|
587
|
-
expect(@employee.hire_date.class).to eq(Date)
|
588
|
-
expect(@employee.hire_date).to eq(@today)
|
589
|
-
end
|
590
|
-
|
591
|
-
it "should return Time value from DATE column if column name does not contain 'date' and emulate_dates_by_column_name is true" do
|
592
|
-
class ::TestEmployee < ActiveRecord::Base
|
593
|
-
attribute :created_at, :datetime
|
594
|
-
end
|
595
|
-
create_test_employee
|
596
|
-
expect(@employee.created_at.class).to eq(Time)
|
597
|
-
expect(@employee.created_at).to eq(@now)
|
598
|
-
end
|
599
|
-
|
600
|
-
it "should return Time value from TIMESTAMP columns" do
|
601
|
-
create_test_employee
|
602
|
-
expect(@employee.created_at_ts.class).to eq(Time)
|
603
|
-
expect(@employee.created_at_ts).to eq(@now)
|
604
|
-
end
|
605
|
-
|
606
|
-
end
|
607
|
-
|
608
514
|
describe "OracleEnhancedAdapter assign string to :date and :datetime columns" do
|
609
515
|
before(:all) do
|
610
516
|
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
|
@@ -1333,9 +1239,14 @@ describe "OracleEnhancedAdapter handling of BINARY_FLOAT columns" do
|
|
1333
1239
|
CREATE SEQUENCE test2_employees_seq MINVALUE 1
|
1334
1240
|
INCREMENT BY 1 START WITH 10040 CACHE 20 NOORDER NOCYCLE
|
1335
1241
|
SQL
|
1242
|
+
|
1243
|
+
class ::Test2Employee < ActiveRecord::Base
|
1244
|
+
end
|
1336
1245
|
end
|
1337
1246
|
|
1338
1247
|
after(:all) do
|
1248
|
+
Object.send(:remove_const, "Test2Employee")
|
1249
|
+
|
1339
1250
|
@conn.execute "DROP TABLE test2_employees"
|
1340
1251
|
@conn.execute "DROP SEQUENCE test2_employees_seq"
|
1341
1252
|
end
|
@@ -1345,13 +1256,21 @@ describe "OracleEnhancedAdapter handling of BINARY_FLOAT columns" do
|
|
1345
1256
|
column = columns.detect { |c| c.name == "hourly_rate" }
|
1346
1257
|
expect(column.type).to eq(:float)
|
1347
1258
|
end
|
1259
|
+
|
1260
|
+
it "should BINARY_FLOAT column type returns an approximate value" do
|
1261
|
+
employee = Test2Employee.create(hourly_rate: 4.4)
|
1262
|
+
|
1263
|
+
employee.reload
|
1264
|
+
|
1265
|
+
expect(employee.hourly_rate).to eq(4.400000095367432)
|
1266
|
+
end
|
1348
1267
|
end
|
1349
1268
|
|
1350
1269
|
describe "OracleEnhancedAdapter attribute API support for JSON type" do
|
1351
1270
|
|
1352
1271
|
include SchemaSpecHelper
|
1353
1272
|
|
1354
|
-
before(:
|
1273
|
+
before(:all) do
|
1355
1274
|
@conn = ActiveRecord::Base.connection
|
1356
1275
|
@oracle12c_or_higher = !! @conn.select_value(
|
1357
1276
|
"select * from product_component_version where product like 'Oracle%' and to_number(substr(version,1,2)) >= 12")
|
@@ -1362,27 +1281,27 @@ describe "OracleEnhancedAdapter attribute API support for JSON type" do
|
|
1362
1281
|
t.string :title
|
1363
1282
|
t.text :article
|
1364
1283
|
end
|
1284
|
+
execute "alter table test_posts add constraint test_posts_title_is_json check (title is json)"
|
1285
|
+
execute "alter table test_posts add constraint test_posts_article_is_json check (article is json)"
|
1365
1286
|
end
|
1366
|
-
@conn.execute <<-SQL
|
1367
|
-
alter table test_posts add constraint test_posts_title_is_json check (title is json)
|
1368
|
-
SQL
|
1369
|
-
@conn.execute <<-SQL
|
1370
|
-
alter table test_posts add constraint test_posts_article_is_json check (article is json)
|
1371
|
-
SQL
|
1372
1287
|
|
1373
|
-
class TestPost < ActiveRecord::Base
|
1288
|
+
class ::TestPost < ActiveRecord::Base
|
1374
1289
|
attribute :title, :json
|
1375
1290
|
attribute :article, :json
|
1376
1291
|
end
|
1377
1292
|
end
|
1378
1293
|
|
1379
|
-
after(:
|
1294
|
+
after(:all) do
|
1380
1295
|
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
|
1381
1296
|
schema_define do
|
1382
1297
|
drop_table :test_posts, if_exists: true
|
1383
1298
|
end
|
1384
1299
|
end
|
1385
1300
|
|
1301
|
+
before(:each) do
|
1302
|
+
TestPost.delete_all
|
1303
|
+
end
|
1304
|
+
|
1386
1305
|
it "should support attribute api for JSON" do
|
1387
1306
|
post = TestPost.create!(title: { "publish" => true, "foo" => "bar" }, article: { "bar" => "baz" })
|
1388
1307
|
post.reload
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# copy this file to spec/config.yaml and set appropriate values
|
2
|
+
# you can also use environment variables, see spec_helper.rb
|
3
|
+
database:
|
4
|
+
name: 'orcl'
|
5
|
+
host: '127.0.0.1'
|
6
|
+
port: 1521
|
7
|
+
user: 'oracle_enhanced'
|
8
|
+
password: 'oracle_enhanced'
|
9
|
+
sys_password: 'admin'
|
10
|
+
non_default_tablespace: 'SYSTEM'
|
11
|
+
timezone: 'Europe/Riga'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
alter database default tablespace USERS;
|
2
|
+
|
3
|
+
CREATE USER oracle_enhanced IDENTIFIED BY oracle_enhanced;
|
4
|
+
|
5
|
+
GRANT unlimited tablespace, create session, create table, create sequence,
|
6
|
+
create procedure, create trigger, create view, create materialized view,
|
7
|
+
create database link, create synonym, create type, ctxapp TO oracle_enhanced;
|
8
|
+
|
9
|
+
CREATE USER oracle_enhanced_schema IDENTIFIED BY oracle_enhanced_schema;
|
10
|
+
|
11
|
+
GRANT unlimited tablespace, create session, create table, create sequence,
|
12
|
+
create procedure, create trigger, create view, create materialized view,
|
13
|
+
create database link, create synonym, create type, ctxapp TO oracle_enhanced_schema;
|
14
|
+
|
15
|
+
CREATE USER arunit IDENTIFIED BY arunit;
|
16
|
+
|
17
|
+
GRANT unlimited tablespace, create session, create table, create sequence,
|
18
|
+
create procedure, create trigger, create view, create materialized view,
|
19
|
+
create database link, create synonym, create type, ctxapp TO arunit;
|
20
|
+
|
21
|
+
CREATE USER arunit2 IDENTIFIED BY arunit2;
|
22
|
+
|
23
|
+
GRANT unlimited tablespace, create session, create table, create sequence,
|
24
|
+
create procedure, create trigger, create view, create materialized view,
|
25
|
+
create database link, create synonym, create type, ctxapp TO arunit2;
|
26
|
+
|
27
|
+
CREATE USER ruby IDENTIFIED BY oci8;
|
28
|
+
GRANT connect, resource, create view,create synonym TO ruby;
|
29
|
+
GRANT EXECUTE ON dbms_lock TO ruby;
|
30
|
+
GRANT CREATE VIEW TO ruby;
|
31
|
+
GRANT unlimited tablespace to ruby;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-oracle_enhanced-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.0.
|
4
|
+
version: 1.8.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimonds Simanovskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -61,15 +61,9 @@ extensions: []
|
|
61
61
|
extra_rdoc_files:
|
62
62
|
- README.md
|
63
63
|
files:
|
64
|
-
- ".rspec"
|
65
|
-
- Gemfile
|
66
64
|
- History.md
|
67
65
|
- License.txt
|
68
66
|
- README.md
|
69
|
-
- RUNNING_TESTS.md
|
70
|
-
- Rakefile
|
71
|
-
- VERSION
|
72
|
-
- activerecord-oracle_enhanced-adapter.gemspec
|
73
67
|
- lib/active_record/connection_adapters/emulation/oracle_adapter.rb
|
74
68
|
- lib/active_record/connection_adapters/oracle_enhanced/column.rb
|
75
69
|
- lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb
|
@@ -98,6 +92,7 @@ files:
|
|
98
92
|
- lib/active_record/oracle_enhanced/type/raw.rb
|
99
93
|
- lib/active_record/oracle_enhanced/type/string.rb
|
100
94
|
- lib/active_record/oracle_enhanced/type/text.rb
|
95
|
+
- lib/active_record/oracle_enhanced/type/timestamptz.rb
|
101
96
|
- lib/activerecord-oracle_enhanced-adapter.rb
|
102
97
|
- spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb
|
103
98
|
- spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb
|
@@ -111,7 +106,10 @@ files:
|
|
111
106
|
- spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb
|
112
107
|
- spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb
|
113
108
|
- spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb
|
109
|
+
- spec/spec_config.yaml.template
|
114
110
|
- spec/spec_helper.rb
|
111
|
+
- spec/support/alter_system_user_password.sql
|
112
|
+
- spec/support/create_oracle_enhanced_users.sql
|
115
113
|
homepage: http://github.com/rsim/oracle-enhanced
|
116
114
|
licenses:
|
117
115
|
- MIT
|
@@ -132,21 +130,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
130
|
version: 1.8.11
|
133
131
|
requirements: []
|
134
132
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.6.
|
133
|
+
rubygems_version: 2.6.11
|
136
134
|
signing_key:
|
137
135
|
specification_version: 4
|
138
136
|
summary: Oracle enhanced adapter for ActiveRecord
|
139
137
|
test_files:
|
140
|
-
- spec/
|
138
|
+
- spec/spec_config.yaml.template
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
- spec/support/create_oracle_enhanced_users.sql
|
141
|
+
- spec/support/alter_system_user_password.sql
|
142
|
+
- spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb
|
143
|
+
- spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb
|
141
144
|
- spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb
|
142
145
|
- spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb
|
143
|
-
- spec/active_record/connection_adapters/
|
144
|
-
- spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb
|
146
|
+
- spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb
|
145
147
|
- spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb
|
146
|
-
- spec/active_record/connection_adapters/
|
148
|
+
- spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb
|
147
149
|
- spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb
|
148
150
|
- spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb
|
149
|
-
- spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb
|
150
151
|
- spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb
|
151
|
-
- spec/active_record/connection_adapters/
|
152
|
-
- spec/
|
152
|
+
- spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb
|
153
|
+
- spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb
|
data/.rspec
DELETED
data/Gemfile
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
git_source(:github) do |repo_name|
|
4
|
-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
5
|
-
"https://github.com/#{repo_name}.git"
|
6
|
-
end
|
7
|
-
|
8
|
-
group :development do
|
9
|
-
gem "rspec"
|
10
|
-
gem "rdoc"
|
11
|
-
gem "rake"
|
12
|
-
|
13
|
-
gem "activerecord", github: "rails/rails", branch: "5-1-stable"
|
14
|
-
gem "ruby-plsql", github: "rsim/ruby-plsql", branch: "master"
|
15
|
-
|
16
|
-
platforms :ruby do
|
17
|
-
gem "ruby-oci8", github: "kubo/ruby-oci8"
|
18
|
-
gem "byebug"
|
19
|
-
end
|
20
|
-
|
21
|
-
platforms :jruby do
|
22
|
-
gem "pry"
|
23
|
-
gem "pry-nav"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
group :test do
|
28
|
-
gem "simplecov", github: "colszowka/simplecov", branch: "master", require: false
|
29
|
-
end
|
data/RUNNING_TESTS.md
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
[](https://travis-ci.org/rsim/oracle-enhanced)
|
2
|
-
|
3
|
-
# When and Which tests need to be executed
|
4
|
-
|
5
|
-
When you are creating a fix and/or some new features for Oracle enhanced adapter,
|
6
|
-
It is recommended to execute Oracle enhanced adapter unit tests and ActiveRecord unit tests.
|
7
|
-
|
8
|
-
* Oracle enhanced adapter unit test
|
9
|
-
* ActiveRecord unit test
|
10
|
-
|
11
|
-
This document explains how to prepare and execute Oracle enhanced adapter unit test.
|
12
|
-
For ActiveRecord unit test, please refer [Contributing to Ruby on Rails](http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html) .
|
13
|
-
|
14
|
-
This document talks about developing Oracle enhanced adapter itself, does NOT talk about developing Rails applications using Oracle enhanced adapter.
|
15
|
-
|
16
|
-
# Building development and test environment
|
17
|
-
|
18
|
-
You can create Oracle enhanced adapter development and test environment by following one of them. If you are first to create this environment
|
19
|
-
[rails-dev-box runs_oracle branch](https://github.com/yahonda/rails-dev-box/tree/runs_oracle) is recommended.
|
20
|
-
|
21
|
-
## [rails-dev-box runs_oracle branch](https://github.com/yahonda/rails-dev-box/tree/runs_oracle)
|
22
|
-
* Please follow the [README](https://github.com/yahonda/rails-dev-box/tree/runs_oracle#a-virtual-machine-for-ruby-on-rails-core-development-with-oracle-database) .
|
23
|
-
|
24
|
-
## [rails-dev-box runs_oracle_on_docker branch](https://github.com/yahonda/rails-dev-box/tree/runs_oracle_on_docker)
|
25
|
-
* Please follow the [README](https://github.com/yahonda/rails-dev-box/blob/runs_oracle_on_docker/README.md#a-virtual-machine-for-ruby-on-rails-core-development) .
|
26
|
-
|
27
|
-
## Create by yourself
|
28
|
-
You can create your development and test environment by yourself.
|
29
|
-
|
30
|
-
### Install Ruby
|
31
|
-
Install Ruby 2.2.2 or higher version of Ruby and JRuby 9.0.5 or higher. To switch multiple version of ruby, you can use use [ruby-build](https://github.com/rbenv/ruby-build) or [Ruby Version Manager(RVM)](https://rvm.io/).
|
32
|
-
|
33
|
-
### Creating the test database
|
34
|
-
To test Oracle enhanced adapter Oracle database is necesssary. You can build by your own or use the Docker to run pre-build Oracle Database Express Edition 11g Release 2.
|
35
|
-
|
36
|
-
#### Create database by yourself
|
37
|
-
Oracle database 11.2 or later with SYS and SYSTEM user access. AL32UTF8 database character set is recommended.
|
38
|
-
|
39
|
-
#### Docker
|
40
|
-
If no Oracle database with SYS and SYSTEM user access is available, try the docker approach.
|
41
|
-
|
42
|
-
* Install [Docker](https://docker.github.io/engine/installation/)
|
43
|
-
|
44
|
-
* Pull [docker-oracle-xe-11g](https://hub.docker.com/r/wnameless/oracle-xe-11g/) image from docker hub
|
45
|
-
```sh
|
46
|
-
$ docker pull wnameless/oracle-xe-11g
|
47
|
-
```
|
48
|
-
|
49
|
-
* Start a Oracle database docker container with mapped ports. Use port `49161` to access the database.
|
50
|
-
```sh
|
51
|
-
$ docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
|
52
|
-
```
|
53
|
-
|
54
|
-
* Check connection to the database with `sqlplus`. The user is `system`, the password is `oracle`.
|
55
|
-
```sh
|
56
|
-
$ sqlplus64 system/oracle@localhost:49161
|
57
|
-
```
|
58
|
-
|
59
|
-
|
60
|
-
### Creating database schemas at the test database
|
61
|
-
|
62
|
-
* Create Oracle database schema for test purposes. Review `spec/spec_helper.rb` to see default schema/user names and database names (use environment variables to override defaults)
|
63
|
-
|
64
|
-
```sql
|
65
|
-
SQL> CREATE USER oracle_enhanced IDENTIFIED BY oracle_enhanced;
|
66
|
-
SQL> GRANT unlimited tablespace, create session, create table, create sequence, create procedure, create trigger, create view, create materialized view, create database link, create synonym, create type, ctxapp TO oracle_enhanced;
|
67
|
-
|
68
|
-
SQL> CREATE USER oracle_enhanced_schema IDENTIFIED BY oracle_enhanced_schema;
|
69
|
-
SQL> GRANT unlimited tablespace, create session, create table, create sequence, create procedure, create trigger, create view, create materialized view, create database link, create synonym, create type, ctxapp TO oracle_enhanced_schema;
|
70
|
-
```
|
71
|
-
|
72
|
-
### Configure database login credentials
|
73
|
-
|
74
|
-
* Configure database credentials in one of two ways:
|
75
|
-
* copy `spec/spec_config.yaml.template` to `spec/spec_config.yaml` and modify as needed
|
76
|
-
* set required environment variables (see DATABASE_NAME in spec_helper.rb)
|
77
|
-
|
78
|
-
* The oracle enhanced configuration file `spec/spec_config.yaml` should look like:
|
79
|
-
|
80
|
-
```yaml
|
81
|
-
# copy this file to spec/config.yaml and set appropriate values
|
82
|
-
# you can also use environment variables, see spec_helper.rb
|
83
|
-
database:
|
84
|
-
name: 'xe'
|
85
|
-
host: 'localhost'
|
86
|
-
port: 49161
|
87
|
-
user: 'oracle_enhanced'
|
88
|
-
password: 'oracle_enhanced'
|
89
|
-
sys_password: 'oracle'
|
90
|
-
non_default_tablespace: 'SYSTEM'
|
91
|
-
timezone: 'Europe/Riga'
|
92
|
-
```
|
93
|
-
|
94
|
-
# Running Oracle enhanced adapter unit tests
|
95
|
-
|
96
|
-
* Install bundler
|
97
|
-
```sh
|
98
|
-
$ gem install bundler
|
99
|
-
```
|
100
|
-
|
101
|
-
* Execute bundle install to install required gems
|
102
|
-
```sh
|
103
|
-
$ bundle install
|
104
|
-
```
|
105
|
-
|
106
|
-
* Run Oracle enhanced adapter unit tests
|
107
|
-
```sh
|
108
|
-
$ bundle exec rake spec
|
109
|
-
```
|
data/Rakefile
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "bundler"
|
3
|
-
require "bundler/gem_tasks"
|
4
|
-
begin
|
5
|
-
Bundler.setup(:default, :development)
|
6
|
-
rescue Bundler::BundlerError => e
|
7
|
-
$stderr.puts e.message
|
8
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
-
exit e.status_code
|
10
|
-
end
|
11
|
-
|
12
|
-
require "rake"
|
13
|
-
|
14
|
-
require "rspec/core/rake_task"
|
15
|
-
RSpec::Core::RakeTask.new(:spec)
|
16
|
-
|
17
|
-
desc "Clear test database"
|
18
|
-
task :clear do
|
19
|
-
require "./spec/spec_helper"
|
20
|
-
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
|
21
|
-
require "active_support/core_ext"
|
22
|
-
ActiveRecord::Base.connection.execute_structure_dump(ActiveRecord::Base.connection.full_drop)
|
23
|
-
ActiveRecord::Base.connection.execute("PURGE RECYCLEBIN") rescue nil
|
24
|
-
end
|
25
|
-
|
26
|
-
# Clear test database before running spec
|
27
|
-
task spec: :clear
|
28
|
-
|
29
|
-
task default: :spec
|
30
|
-
|
31
|
-
require "rdoc/task"
|
32
|
-
Rake::RDocTask.new do |rdoc|
|
33
|
-
version = File.exist?("VERSION") ? File.read("VERSION") : ""
|
34
|
-
|
35
|
-
rdoc.rdoc_dir = "doc"
|
36
|
-
rdoc.title = "activerecord-oracle_enhanced-adapter #{version}"
|
37
|
-
rdoc.rdoc_files.include("README*")
|
38
|
-
rdoc.rdoc_files.include("lib/**/*.rb")
|
39
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.8.0.rc1
|
@@ -1,91 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = "activerecord-oracle_enhanced-adapter"
|
3
|
-
s.version = "1.8.0.rc1"
|
4
|
-
|
5
|
-
s.required_rubygems_version = ">= 1.8.11"
|
6
|
-
s.required_ruby_version = ">= 2.2.2"
|
7
|
-
s.license = "MIT"
|
8
|
-
s.authors = ["Raimonds Simanovskis"]
|
9
|
-
s.date = "2017-03-20"
|
10
|
-
s.description = 'Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
|
11
|
-
This adapter is superset of original ActiveRecord Oracle adapter.
|
12
|
-
'
|
13
|
-
s.email = "raimonds.simanovskis@gmail.com"
|
14
|
-
s.extra_rdoc_files = [
|
15
|
-
"README.md"
|
16
|
-
]
|
17
|
-
s.files = [
|
18
|
-
".rspec",
|
19
|
-
"Gemfile",
|
20
|
-
"History.md",
|
21
|
-
"License.txt",
|
22
|
-
"README.md",
|
23
|
-
"RUNNING_TESTS.md",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"activerecord-oracle_enhanced-adapter.gemspec",
|
27
|
-
"lib/active_record/connection_adapters/emulation/oracle_adapter.rb",
|
28
|
-
"lib/active_record/connection_adapters/oracle_enhanced_adapter.rb",
|
29
|
-
"lib/active_record/connection_adapters/oracle_enhanced/column.rb",
|
30
|
-
"lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb",
|
31
|
-
"lib/active_record/connection_adapters/oracle_enhanced/connection.rb",
|
32
|
-
"lib/active_record/connection_adapters/oracle_enhanced/context_index.rb",
|
33
|
-
"lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb",
|
34
|
-
"lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb",
|
35
|
-
"lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb",
|
36
|
-
"lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb",
|
37
|
-
"lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb",
|
38
|
-
"lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb",
|
39
|
-
"lib/active_record/connection_adapters/oracle_enhanced/procedures.rb",
|
40
|
-
"lib/active_record/connection_adapters/oracle_enhanced/quoting.rb",
|
41
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb",
|
42
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb",
|
43
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb",
|
44
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb",
|
45
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb",
|
46
|
-
"lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb",
|
47
|
-
"lib/active_record/connection_adapters/oracle_enhanced/version.rb",
|
48
|
-
"lib/active_record/oracle_enhanced/type/boolean.rb",
|
49
|
-
"lib/active_record/oracle_enhanced/type/integer.rb",
|
50
|
-
"lib/active_record/oracle_enhanced/type/json.rb",
|
51
|
-
"lib/active_record/oracle_enhanced/type/national_character_string.rb",
|
52
|
-
"lib/active_record/oracle_enhanced/type/raw.rb",
|
53
|
-
"lib/active_record/oracle_enhanced/type/string.rb",
|
54
|
-
"lib/active_record/oracle_enhanced/type/text.rb",
|
55
|
-
"lib/activerecord-oracle_enhanced-adapter.rb",
|
56
|
-
"spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
|
57
|
-
"spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb",
|
58
|
-
"spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb",
|
59
|
-
"spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb",
|
60
|
-
"spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb",
|
61
|
-
"spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb",
|
62
|
-
"spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb",
|
63
|
-
"spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb",
|
64
|
-
"spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb",
|
65
|
-
"spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb",
|
66
|
-
"spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb",
|
67
|
-
"spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb",
|
68
|
-
"spec/spec_helper.rb"
|
69
|
-
]
|
70
|
-
s.homepage = "http://github.com/rsim/oracle-enhanced"
|
71
|
-
s.require_paths = ["lib"]
|
72
|
-
s.summary = "Oracle enhanced adapter for ActiveRecord"
|
73
|
-
s.test_files = [
|
74
|
-
"spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
|
75
|
-
"spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb",
|
76
|
-
"spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb",
|
77
|
-
"spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb",
|
78
|
-
"spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb",
|
79
|
-
"spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb",
|
80
|
-
"spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb",
|
81
|
-
"spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb",
|
82
|
-
"spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb",
|
83
|
-
"spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb",
|
84
|
-
"spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb",
|
85
|
-
"spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb",
|
86
|
-
"spec/spec_helper.rb"
|
87
|
-
]
|
88
|
-
s.add_runtime_dependency("activerecord", ["~> 5.1.0.rc"])
|
89
|
-
s.add_runtime_dependency("arel", ["~> 8.0"])
|
90
|
-
s.add_runtime_dependency("ruby-plsql", [">= 0.6.0"])
|
91
|
-
end
|