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.



187
188
189
190
191
192
193
194
195
196
197
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 187

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)


180
181
182
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 180

def database_exists?(config)
  true
end

.new_clientObject



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

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

Instance Method Details

#configure_connectionObject



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

def configure_connection
end

#get_database_versionObject

15devel



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

def get_database_version = 150000 # 15devel

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



222
223
224
225
226
227
228
229
230
231
232
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
# File 'lib/active_record/connection_adapters/pglite_adapter.rb', line 222

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