activerecord-oracle_enhanced-adapter 1.6.9 → 1.7.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +10 -11
- data/History.md +126 -14
- data/README.md +9 -6
- data/RUNNING_TESTS.md +1 -1
- data/Rakefile +1 -16
- data/VERSION +1 -1
- data/activerecord-oracle_enhanced-adapter.gemspec +15 -52
- data/lib/active_record/connection_adapters/oracle_enhanced/column.rb +8 -22
- data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +53 -45
- data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +6 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +23 -62
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +46 -56
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +35 -0
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +34 -21
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb +36 -0
- data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +174 -0
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +17 -8
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +17 -11
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +160 -178
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +42 -94
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb +50 -54
- data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +15 -11
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +197 -301
- data/lib/active_record/oracle_enhanced/type/integer.rb +3 -2
- data/lib/active_record/oracle_enhanced/type/national_character_string.rb +25 -0
- data/lib/active_record/oracle_enhanced/type/raw.rb +14 -2
- data/lib/active_record/oracle_enhanced/type/string.rb +28 -0
- data/lib/active_record/oracle_enhanced/type/text.rb +32 -0
- data/lib/activerecord-oracle_enhanced-adapter.rb +12 -17
- data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +113 -135
- data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +51 -59
- data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +40 -41
- data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +6 -6
- data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +281 -233
- data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +7 -7
- data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +10 -10
- data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +22 -22
- data/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb +2 -2
- data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +36 -37
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +86 -46
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +194 -294
- data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +53 -39
- data/spec/spec_helper.rb +0 -6
- metadata +42 -143
- data/.travis.yml +0 -39
- data/.travis/oracle/download.sh +0 -14
- data/.travis/oracle/install.sh +0 -31
- data/.travis/setup_accounts.sh +0 -9
- data/lib/active_record/connection_adapters/oracle_enhanced/dirty.rb +0 -40
- data/lib/active_record/oracle_enhanced/type/timestamp.rb +0 -11
- data/spec/spec_config.yaml.template +0 -11
- data/spec/support/alter_system_user_password.sql +0 -2
- data/spec/support/create_oracle_enhanced_users.sql +0 -31
data/.travis.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
sudo: required
|
2
|
-
|
3
|
-
env:
|
4
|
-
global:
|
5
|
-
- ORACLE_COOKIE=sqldev
|
6
|
-
- ORACLE_FILE=oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip
|
7
|
-
- ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
|
8
|
-
- TNS_ADMIN=$ORACLE_HOME/network/admin
|
9
|
-
- NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
10
|
-
- ORACLE_BASE=/u01/app/oracle
|
11
|
-
- LD_LIBRARY_PATH=$ORACLE_HOME/lib
|
12
|
-
- PATH=$PATH:$ORACLE_HOME/jdbc/lib
|
13
|
-
- DATABASE_VERSION=11.2.0.2
|
14
|
-
- ORACLE_SID=XE
|
15
|
-
- DATABASE_NAME=XE
|
16
|
-
- ORA_SDTZ='Europe/Riga' #Needed as a client parameter
|
17
|
-
- TZ='Europe/Riga' #Needed as a DB Server parameter
|
18
|
-
- "JRUBY_OPTS='--debug --dev -J-Xmx1024M'"
|
19
|
-
|
20
|
-
before_install:
|
21
|
-
- chmod +x .travis/oracle/download.sh
|
22
|
-
- chmod +x .travis/oracle/install.sh
|
23
|
-
- chmod +x .travis/setup_accounts.sh
|
24
|
-
|
25
|
-
install:
|
26
|
-
- .travis/oracle/download.sh
|
27
|
-
- .travis/oracle/install.sh
|
28
|
-
- .travis/setup_accounts.sh
|
29
|
-
- bundle install
|
30
|
-
|
31
|
-
language: ruby
|
32
|
-
rvm:
|
33
|
-
- 2.2.6
|
34
|
-
- 2.3.3
|
35
|
-
- 2.4.0
|
36
|
-
- jruby-9.1.8.0
|
37
|
-
|
38
|
-
notifications:
|
39
|
-
email: false
|
data/.travis/oracle/download.sh
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
cd "$(dirname "$(readlink -f "$0")")"
|
4
|
-
|
5
|
-
deb_file=oracle-xe_11.2.0-1.0_amd64.deb
|
6
|
-
|
7
|
-
git clone https://github.com/wnameless/docker-oracle-xe-11g.git
|
8
|
-
|
9
|
-
cd docker-oracle-xe-11g/assets &&
|
10
|
-
cat "${deb_file}aa" "${deb_file}ab" "${deb_file}ac" > "${deb_file}"
|
11
|
-
|
12
|
-
pwd
|
13
|
-
|
14
|
-
ls -lAh "${deb_file}"
|
data/.travis/oracle/install.sh
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
[ -n "$ORACLE_FILE" ] || { echo "Missing ORACLE_FILE environment variable!"; exit 1; }
|
4
|
-
[ -n "$ORACLE_HOME" ] || { echo "Missing ORACLE_HOME environment variable!"; exit 1; }
|
5
|
-
|
6
|
-
cd "$(dirname "$(readlink -f "$0")")"
|
7
|
-
|
8
|
-
ORACLE_DEB=docker-oracle-xe-11g/assets/oracle-xe_11.2.0-1.0_amd64.deb
|
9
|
-
|
10
|
-
sudo apt-get -qq update
|
11
|
-
sudo apt-get --no-install-recommends -qq install bc libaio1
|
12
|
-
|
13
|
-
df -B1 /dev/shm | awk 'END { if ($1 != "shmfs" && $1 != "tmpfs" || $2 < 2147483648) exit 1 }' ||
|
14
|
-
( sudo rm -r /dev/shm && sudo mkdir /dev/shm && sudo mount -t tmpfs shmfs -o size=2G /dev/shm )
|
15
|
-
|
16
|
-
test -f /sbin/chkconfig ||
|
17
|
-
( echo '#!/bin/sh' | sudo tee /sbin/chkconfig > /dev/null && sudo chmod u+x /sbin/chkconfig )
|
18
|
-
|
19
|
-
test -d /var/lock/subsys || sudo mkdir /var/lock/subsys
|
20
|
-
|
21
|
-
sudo dpkg -i "${ORACLE_DEB}"
|
22
|
-
|
23
|
-
echo 'OS_AUTHENT_PREFIX=""' | sudo tee -a "$ORACLE_HOME/config/scripts/init.ora" > /dev/null
|
24
|
-
sudo usermod -aG dba $USER
|
25
|
-
|
26
|
-
( echo ; echo ; echo travis ; echo travis ; echo n ) | sudo AWK='/usr/bin/awk' /etc/init.d/oracle-xe configure
|
27
|
-
|
28
|
-
"$ORACLE_HOME/bin/sqlplus" -L -S / AS SYSDBA <<SQL
|
29
|
-
CREATE USER $USER IDENTIFIED EXTERNALLY;
|
30
|
-
GRANT CONNECT, RESOURCE TO $USER;
|
31
|
-
SQL
|
data/.travis/setup_accounts.sh
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
module ActiveRecord #:nodoc:
|
2
|
-
module ConnectionAdapters #:nodoc:
|
3
|
-
module OracleEnhancedDirty #:nodoc:
|
4
|
-
|
5
|
-
module InstanceMethods #:nodoc:
|
6
|
-
private
|
7
|
-
|
8
|
-
def _field_changed?(attr, old_value)
|
9
|
-
new_value = read_attribute(attr)
|
10
|
-
raw_value = read_attribute_before_type_cast(attr)
|
11
|
-
|
12
|
-
if self.class.columns_hash.include?(attr.to_s)
|
13
|
-
column = column_for_attribute(attr)
|
14
|
-
|
15
|
-
# Oracle stores empty string '' as NULL
|
16
|
-
# therefore need to convert empty string value to nil if old value is nil
|
17
|
-
if column.type == :string && column.null && old_value.nil?
|
18
|
-
new_value = nil if new_value == ''
|
19
|
-
end
|
20
|
-
column.changed?(old_value, new_value, raw_value)
|
21
|
-
else
|
22
|
-
new_value != old_value
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def non_zero?(value)
|
27
|
-
value !~ /\A0+(\.0+)?\z/
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
if ActiveRecord::Base.method_defined?(:changed?)
|
37
|
-
ActiveRecord::Base.class_eval do
|
38
|
-
include ActiveRecord::ConnectionAdapters::OracleEnhancedDirty::InstanceMethods
|
39
|
-
end
|
40
|
-
end
|
@@ -1,11 +0,0 @@
|
|
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'
|
@@ -1,31 +0,0 @@
|
|
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;
|