Class: ActiveRecord::ConnectionAdapters::SQLite3Adapter

Inherits:
SQLiteAdapter show all
Defined in:
lib/active_record/connection_adapters/sqlite3_adapter.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#in_use, #last_use, #logger, #open_transactions, #pool, #schema_cache, #visitor

Attributes included from QueryCache

#query_cache, #query_cache_enabled

Instance Method Summary collapse

Methods inherited from SQLiteAdapter

#adapter_name, #add_column, #begin_db_transaction, #change_column, #change_column_default, #change_column_null, #clear_cache!, #columns, #commit_db_transaction, #create_savepoint, #delete_sql, #disconnect!, #empty_insert_statement_value, #exec_delete, #exec_query, #execute, #explain, #indexes, #initialize, #insert_sql, #last_inserted_id, #native_database_types, #primary_key, #quote_column_name, #quote_string, #quoted_date, #release_savepoint, #remove_column, #remove_index!, #rename_column, #rename_table, #requires_reloading?, #rollback_db_transaction, #rollback_to_savepoint, #select_rows, #supports_add_column?, #supports_autoincrement?, #supports_count_distinct?, #supports_ddl_transactions?, #supports_explain?, #supports_index_sort_order?, #supports_migrations?, #supports_primary_key?, #supports_savepoints?, #supports_statement_cache?, #table_exists?, #tables, #type_cast, #update_sql, #valid_alter_table_options

Methods inherited from AbstractAdapter

#active?, #adapter_name, #case_insensitive_comparison, #case_sensitive_modifier, #clear_cache!, #close, #create_savepoint, #current_savepoint_name, #decrement_open_transactions, #disable_referential_integrity, #disconnect!, #expire, #increment_open_transactions, #initialize, #lease, #prefetch_primary_key?, #quote_table_name, #raw_connection, #reconnect!, #release_savepoint, #requires_reloading?, #reset!, #rollback_to_savepoint, #substitute_at, #supports_bulk_alter?, #supports_count_distinct?, #supports_ddl_transactions?, #supports_explain?, #supports_index_sort_order?, #supports_migrations?, #supports_primary_key?, #supports_savepoints?, #transaction_joinable=, #verify!

Methods included from QueryCache

#cache, #clear_query_cache, dirties_query_cache, #disable_query_cache!, #enable_query_cache!, included, #select_all, #uncached

Methods included from DatabaseLimits

#column_name_length, #columns_per_multicolumn_index, #columns_per_table, #in_clause_length, #index_name_length, #indexes_per_table, #joins_per_query, #sql_query_length, #table_alias_length, #table_name_length

Methods included from Quoting

#quote_column_name, #quote_string, #quote_table_name, #quoted_date, #quoted_false, #quoted_true, #type_cast

Methods included from DatabaseStatements

#add_transaction_record, #begin_db_transaction, #case_sensitive_equality_operator, #commit_db_transaction, #default_sequence_name, #delete, #empty_insert_statement_value, #exec_delete, #exec_insert, #exec_query, #exec_update, #execute, #insert, #insert_fixture, #join_to_update, #limited_update_conditions, #outside_transaction?, #reset_sequence!, #rollback_db_transaction, #sanitize_limit, #select_all, #select_one, #select_rows, #select_value, #select_values, #supports_statement_cache?, #to_sql, #transaction, #update

Methods included from SchemaStatements

#add_column, #add_column_options!, #add_index, #add_timestamps, #assume_migrated_upto_version, #change_column, #change_column_default, #change_table, #column_exists?, #columns, #create_table, #distinct, #drop_table, #dump_schema_information, #index_exists?, #index_name, #index_name_exists?, #initialize_schema_migrations_table, #native_database_types, #remove_column, #remove_index, #remove_index!, #remove_timestamps, #rename_column, #rename_index, #rename_table, #structure_dump, #table_alias_for, #table_exists?, #type_to_sql

Constructor Details

This class inherits a constructor from ActiveRecord::ConnectionAdapters::SQLiteAdapter

Instance Method Details

#encodingObject

Returns the current database encoding format as a string, eg: ‘UTF-8’



49
50
51
# File 'lib/active_record/connection_adapters/sqlite3_adapter.rb', line 49

def encoding
  @connection.encoding.to_s
end

#quote(value, column = nil) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/active_record/connection_adapters/sqlite3_adapter.rb', line 39

def quote(value, column = nil)
  if value.kind_of?(String) && column && column.type == :binary && column.class.respond_to?(:string_to_binary)
    s = column.class.string_to_binary(value).unpack("H*")[0]
    "x'#{s}'"
  else
    super
  end
end