Class: ActiveRecord::ConnectionAdapters::PGliteAdapter

Inherits:
PostgreSQLAdapter
  • Object
show all
Defined in:
lib/active_record/connection_adapters/pglite_adapter.rb

Defined Under Namespace

Modules: Type Classes: ExternalInterface

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePGliteAdapter

Returns a new instance of PGliteAdapter.



198
199
200
201
202
203
204
205
206
207
208
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 198

def initialize(...)
  AbstractAdapter.instance_method(:initialize).bind_call(self, ...)
  @connection_parameters = @config.compact

  @max_identifier_length = nil
  @type_map = ActiveRecord::Type::HashLookupTypeMap.new
  @raw_connection = nil
  @notice_receiver_sql_warnings = []

  @use_insert_returning = true
end

Class Method Details

.database_exists?(config) ⇒ Boolean

Returns:

  • (Boolean)


191
192
193
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 191

def database_exists?(config)
  true
end

.new_clientObject



195
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 195

def new_client(...) = ExternalInterface.new(...)

Instance Method Details

#configure_connectionObject



212
213
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 212

def configure_connection
end

#get_database_versionObject

15devel



210
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 210

def get_database_version = 150000 # 15devel

#get_oid_type(oid, fmod, column_name, sql_type = "") ⇒ Object



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 233

def get_oid_type(oid, fmod, column_name, sql_type = "")
  # https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat
  oid = oid.to_i
  ty = case oid
  when 16
    ActiveRecord::Type::Boolean.new
  when 20
    ActiveRecord::Type::Integer.new(limit: 8)
  when 21
    ActiveRecord::Type::Integer.new
  when 23
    ActiveRecord::Type::Integer.new
  when 25
    ActiveRecord::Type::String.new
  when 114
    ActiveRecord::Type::String.new
  when 700, 701
    ActiveRecord::Type::Float.new
  when 1015
    ActiveRecord::Type::String.new
  when 1016 # bigint[]
    Type::BigintArray.new
  when 1043
    ActiveRecord::Type::String.new
  when 1082
    ActiveRecord::Type::Date.new
  when 1083
    ActiveRecord::Type::Time.new
  when 1114
    ActiveRecord::Type::DateTime.new
  when 1184
    ActiveRecord::Type::DateTime.new
  when 1700
    ActiveRecord::Type::Decimal.new
  when 3802
    ActiveRecord::Type::Json.new
  else
    ActiveRecord::Type.default_value
  end
  @type_map.register_type(oid, ty)
  ty
end