aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorkares <self@kares.org>2014-05-14 12:04:14 +0200
committerkares <self@kares.org>2014-05-14 12:04:14 +0200
commit6822dfad31786d6c297e749e422e66b195cc70d1 (patch)
tree6fa3c317be3a64dde5f37200dfbfb1c6b3e3c30e /activerecord/lib/active_record/connection_adapters
parentdd16a1029ac34c09ce66fe7b088431bba920c1ba (diff)
downloadrails-6822dfad31786d6c297e749e422e66b195cc70d1.tar.gz
rails-6822dfad31786d6c297e749e422e66b195cc70d1.tar.bz2
rails-6822dfad31786d6c297e749e422e66b195cc70d1.zip
introduce AR::ConnectionAdapters::PostgreSQL for sharing modules (with AR-JDBC)
... 'shared' OID, ArrayParser and Cast helpers, also re-arranged Column's dependencies
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/array_parser.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/cast.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/column.rb7
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/oid.rb4
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb17
7 files changed, 21 insertions, 15 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/array_parser.rb b/activerecord/lib/active_record/connection_adapters/postgresql/array_parser.rb
index 5394ea0b7c..d3b05fb4af 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/array_parser.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/array_parser.rb
@@ -1,6 +1,6 @@
module ActiveRecord
module ConnectionAdapters
- class PostgreSQLColumn < Column
+ module PostgreSQL
module ArrayParser
DOUBLE_QUOTE = '"'
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
index 551a9289c3..17fb971ea8 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb
@@ -1,6 +1,6 @@
module ActiveRecord
module ConnectionAdapters
- class PostgreSQLColumn < Column
+ module PostgreSQL
module Cast
def point_to_string(point)
"(#{point[0]},#{point[1]})"
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb
index 82785825e5..22ea49b697 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb
@@ -1,7 +1,10 @@
+require 'active_record/connection_adapters/postgresql/cast'
+
module ActiveRecord
module ConnectionAdapters
# PostgreSQL-specific extensions to column definitions in a table.
class PostgreSQLColumn < Column #:nodoc:
+
attr_accessor :array
def initialize(name, default, oid_type, sql_type = nil, null = true)
@@ -29,7 +32,7 @@ module ActiveRecord
# :stopdoc:
class << self
- include PostgreSQLColumn::Cast
+ include PostgreSQL::Cast
# Loads pg_array_parser if available. String parsing can be
# performed quicker by a native extension, which will not create
@@ -40,7 +43,7 @@ module ActiveRecord
include PgArrayParser
rescue LoadError
require 'active_record/connection_adapters/postgresql/array_parser'
- include PostgreSQLColumn::ArrayParser
+ include PostgreSQL::ArrayParser
end
attr_accessor :money_precision
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
index 1e89f8cfd6..cf6a375704 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
@@ -1,8 +1,6 @@
-require 'active_record/connection_adapters/abstract_adapter'
-
module ActiveRecord
module ConnectionAdapters
- class PostgreSQLAdapter < AbstractAdapter
+ module PostgreSQL
module OID
class Type
def type; end
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
index fa458d0243..0883b02a35 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb
@@ -1,6 +1,6 @@
module ActiveRecord
module ConnectionAdapters
- class PostgreSQLAdapter < AbstractAdapter
+ module PostgreSQL
module Quoting
# Escapes binary strings for bytea input to the database.
def escape_bytea(value)
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb b/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
index bc775394a6..98dcf441ff 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
@@ -1,6 +1,6 @@
module ActiveRecord
module ConnectionAdapters
- class PostgreSQLAdapter < AbstractAdapter
+ module PostgreSQL
module ReferentialIntegrity
def supports_disable_referential_integrity? #:nodoc:
true
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 4908c5a47f..bf76b5ace6 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -1,13 +1,14 @@
require 'active_record/connection_adapters/abstract_adapter'
require 'active_record/connection_adapters/statement_pool'
+
+require 'active_record/connection_adapters/postgresql/column'
require 'active_record/connection_adapters/postgresql/oid'
-require 'active_record/connection_adapters/postgresql/cast'
-require 'active_record/connection_adapters/postgresql/array_parser'
require 'active_record/connection_adapters/postgresql/quoting'
+require 'active_record/connection_adapters/postgresql/referential_integrity'
+
require 'active_record/connection_adapters/postgresql/schema_statements'
require 'active_record/connection_adapters/postgresql/database_statements'
-require 'active_record/connection_adapters/postgresql/referential_integrity'
-require 'active_record/connection_adapters/postgresql/column'
+
require 'arel/visitors/bind_visitor'
# Make sure we're using pg high enough for PGResult#values
@@ -44,6 +45,7 @@ module ActiveRecord
end
module ConnectionAdapters
+
# The PostgreSQL adapter works with the native C (https://bitbucket.org/ged/ruby-pg) driver.
#
# Options:
@@ -72,6 +74,7 @@ module ActiveRecord
# In addition, default connection parameters of libpq can be set per environment variables.
# See http://www.postgresql.org/docs/9.1/static/libpq-envars.html .
class PostgreSQLAdapter < AbstractAdapter
+
class ColumnDefinition < ActiveRecord::ConnectionAdapters::ColumnDefinition
attr_accessor :array
end
@@ -238,8 +241,10 @@ module ActiveRecord
citext: { name: "citext" }
}
- include Quoting
- include ReferentialIntegrity
+ OID = PostgreSQL::OID #:nodoc:
+
+ include PostgreSQL::Quoting
+ include PostgreSQL::ReferentialIntegrity
include SchemaStatements
include DatabaseStatements
include Savepoints