Class: ActiveRecord::ConnectionAdapters::PeasysAdapter
Constant Summary
collapse
- ADAPTER_NAME =
"Peasys"
- NATIVE_DATABASE_TYPES =
{
primary_key: "INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY",
string: { name: "VARCHAR", limit: 255 },
text: { name: "CLOB" },
integer: { name: "INTEGER" },
bigint: { name: "BIGINT" },
float: { name: "DOUBLE" },
decimal: { name: "DECIMAL" },
datetime: { name: "TIMESTAMP" },
timestamp: { name: "TIMESTAMP" },
time: { name: "TIME" },
date: { name: "DATE" },
binary: { name: "BLOB" },
boolean: { name: "SMALLINT" },
json: { name: "CLOB" },
}.freeze
- TYPE_MAP =
Type::TypeMap.new.tap { |m| initialize_type_map(m) }
ActiveRecord::ConnectionAdapters::Peasys::Quoting::QUOTED_COLUMN_NAMES, ActiveRecord::ConnectionAdapters::Peasys::Quoting::QUOTED_TABLE_NAMES
Class Method Summary
collapse
Instance Method Summary
collapse
#add_index, #change_column, #change_column_default, #change_column_null, #create_internal_metadata_table, #create_schema_migrations_table, #create_table_definition, #drop_table, #foreign_keys, #indexes, #primary_keys, #remove_index, #rename_column, #rename_table, #schema_creation, #schema_dumper_class, #table_exists?, #tables, #type_to_sql, #view_exists?, #views
#begin_db_transaction, #commit_db_transaction, #default_sequence_name, #exec_delete, #exec_rollback_db_transaction, #execute, #internal_exec_query, #write_query?
#quote_string, #quote_table_name_for_assignment, #quoted_date, #quoted_false, #quoted_true, #unquoted_false, #unquoted_true
Constructor Details
Returns a new instance of PeasysAdapter.
44
45
46
47
48
49
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 44
def initialize(...)
super
@connection_parameters = @config
@config[:schema] ||= @config[:username]&.upcase
end
|
Class Method Details
.database_exists?(config) ⇒ Boolean
79
80
81
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 79
def self.database_exists?(config)
true end
|
.new_client(config) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 24
def new_client(config)
PeaClient.new(
config[:ip_address].to_s,
config[:partition_name].to_s,
config[:port].to_i,
config[:username].to_s,
config[:password].to_s,
config[:id_client].to_s,
config.fetch(:online_version, true),
config.fetch(:retrieve_statistics, false)
)
rescue PeaConnexionError => e
raise ActiveRecord::ConnectionNotEstablished, e.message
rescue PeaInvalidCredentialsError => e
raise ActiveRecord::ConnectionNotEstablished, e.message
rescue PeaInvalidLicenseKeyError => e
raise ActiveRecord::ConnectionNotEstablished, e.message
end
|
Instance Method Details
#active? ⇒ Boolean
– Connection management –
85
86
87
88
89
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 85
def active?
@raw_connection&.connexion_status == 1
rescue
false
end
|
#adapter_name ⇒ Object
– Adapter identification –
53
54
55
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 53
def adapter_name
ADAPTER_NAME
end
|
#disconnect! ⇒ Object
91
92
93
94
95
96
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 91
def disconnect!
super
@raw_connection&.disconnect
rescue
nil
end
|
#native_database_types ⇒ Object
117
118
119
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 117
def native_database_types
NATIVE_DATABASE_TYPES
end
|
#supports_check_constraints? ⇒ Boolean
72
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 72
def supports_check_constraints?; true end
|
73
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 73
def ; true end
|
#supports_common_table_expressions? ⇒ Boolean
70
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 70
def supports_common_table_expressions?; true end
|
#supports_datetime_with_precision? ⇒ Boolean
63
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 63
def supports_datetime_with_precision?; true end
|
#supports_ddl_transactions? ⇒ Boolean
64
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 64
def supports_ddl_transactions?; false end
|
#supports_explain? ⇒ Boolean
67
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 67
def supports_explain?; false end
|
#supports_foreign_keys? ⇒ Boolean
61
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 61
def supports_foreign_keys?; true end
|
#supports_index_sort_order? ⇒ Boolean
68
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 68
def supports_index_sort_order?; true end
|
#supports_insert_on_duplicate_skip? ⇒ Boolean
74
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 74
def supports_insert_on_duplicate_skip?; false end
|
#supports_insert_on_duplicate_update? ⇒ Boolean
75
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 75
def supports_insert_on_duplicate_update?; false end
|
#supports_insert_returning? ⇒ Boolean
69
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 69
def supports_insert_returning?; false end
|
#supports_lazy_transactions? ⇒ Boolean
71
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 71
def supports_lazy_transactions?; true end
|
#supports_migrations? ⇒ Boolean
59
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 59
def supports_migrations?; true end
|
#supports_primary_key? ⇒ Boolean
60
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 60
def supports_primary_key?; true end
|
#supports_savepoints? ⇒ Boolean
65
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 65
def supports_savepoints?; false end
|
#supports_transaction_isolation? ⇒ Boolean
66
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 66
def supports_transaction_isolation?; false end
|
#supports_views? ⇒ Boolean
62
|
# File 'lib/active_record/connection_adapters/peasys_adapter.rb', line 62
def supports_views?; true end
|