class Jennifer::Mysql::Adapter
- Jennifer::Mysql::Adapter
 - Jennifer::Adapter::Base
 - Reference
 - Object
 
Included Modules
Defined in:
jennifer/adapter/mysql.crConstant Summary
- 
        DEFAULT_SIZES = 
{:string => 254, :varchar => 254} - 
        TABLE_LOCK_TYPES = 
{"r" => "READ", "rl" => "READ LOCAL", "w" => "WRITE", "lpw" => "LOW_PRIORITY WRITE", "default" => "READ"} - 
        
NOTE ATM is not used
 - 
        TYPE_TRANSLATIONS = 
{:bool => "bool", :enum => "enum", :bigint => "bigint", :integer => "int", :short => "SMALLINT", :tinyint => "TINYINT", :float => "float", :double => "double", :decimal => "decimal", :string => "varchar", :varchar => "varchar", :text => "text", :timestamp => "datetime", :date_time => "datetime", :date => "date", :blob => "blob", :json => "json"} 
Class Method Summary
Instance Method Summary
- 
        #column_exists?(table, name)
        
          
Returns whether column of table with name exists.
 - #command_interface
 - #create_database
 - #database_exists? : Bool
 - #default_type_size(name)
 - #drop_database
 - #explain(q)
 - 
        #foreign_key_exists?(from_table, to_table = nil, column = nil, name : String? = nil) : Bool
        
          
Checks to see if a foreign key exists on a table for a given foreign key definition.
 - #index_exists?(table, name : String)
 - #read_column(rs, column : MySql::ColumnSpec)
 - #schema_processor
 - #sql_generator
 - #table_column_count(table)
 - 
        #table_exists?(table)
        
          
Returns where table with given table name exists.
 - #tables_column_count(tables)
 - 
        #translate_type(name)
        
          
Translates symbol data type name to database-specific data type.
 - 
        #view_exists?(name) : Bool
        
          
Check whether view with given name exists.
 - #with_table_lock(table : String, type : String = "default", &)
 
Instance methods inherited from module Jennifer::Adapter::RequestMethods
  
  
    
      insert(table, opts : Hash)insert(obj : Model::Base) insert, modify(q, modifications : Hash) modify, pluck(query, fields : Array)
pluck(query, field : String | Symbol) pluck, select(q, &) select, update(query, options : Hash)
update(obj : Model::Base) update
Instance methods inherited from class Jennifer::Adapter::Base
  
  
    
      bulk_insert(table : String, fields : Array(String), values : Array(ArgsType))bulk_insert(collection : Array(Model::Base)) bulk_insert, column_exists?(table, name) column_exists?, command_interface command_interface, config : Config config, connection_string(type : ConnectionType) connection_string, count(query : QueryBuilder::Query) count, create_database create_database, database_exists? database_exists?, db : DB::Database db, db_connection(&) db_connection, default_type_size(name) default_type_size, delete(query : QueryBuilder::Query) delete, drop_database drop_database, exec(query : String, args : ArgsType = [] of DBAny) : DB::ExecResult exec, exists?(query : QueryBuilder::Query) : Bool exists?, explain(q) explain, foreign_key_exists?(from_table, to_table = nil, column = nil, name : String? = nil) : Bool foreign_key_exists?, generate_schema generate_schema, index_exists?(table, fields : Array)
index_exists?(table, name : String) index_exists?, insert(obj : Model::Base) insert, load_schema load_schema, log_query(query : String, args : Enumerable, &)
log_query(query : String, &) log_query, max_bind_vars_count max_bind_vars_count, parse_query(q : String, args : ArgsType)
parse_query(q : String) parse_query, prepare prepare, query(query : String, args : ArgsType = [] of DBAny, &) query, query_array(_query : String, klass : T.class, field_count : Int32 = 1) forall T query_array, ready_to_migrate! ready_to_migrate!, refresh_materialized_view(name) refresh_materialized_view, scalar(query : String, args : ArgsType = [] of DBAny) scalar, schema_processor schema_processor, sql_generator sql_generator, table_column_count(table) table_column_count, table_exists?(table) table_exists?, tables_column_count(tables : Array(String)) tables_column_count, translate_type(name) translate_type, truncate(klass : Class)
truncate(table_name : String) truncate, upsert(table : String, fields : Array(String), values : Array(ArgsType), unique_fields : Array, on_conflict : Hash)
upsert(collection : Array(Model::Base), unique_fields : Array, definition : Hash = {} of Nil => Nil) upsert, view_exists?(name) : Bool view_exists?, with_table_lock(table : String, type : String = "default", &block : DB::Transaction -> Void) with_table_lock
Constructor methods inherited from class Jennifer::Adapter::Base
  
  
    
      new(config : Config)
    new
    
  
    
  Class methods inherited from class Jennifer::Adapter::Base
  
  
    
      foreign_key_name(from_table, to_table = nil, column = nil, name : String? = nil) : String
    foreign_key_name, 
    
  
    
      join_table_name(table1 : String | Symbol, table2 : String | Symbol)
    join_table_name, 
    
  
    
      t(field : Nil)t(field : String)
t(field) t
Instance methods inherited from module Jennifer::Adapter::ResultParsers
  
  
    
      read_column(rs, column)
    read_column, 
    
  
    
      result_to_array_by_names(rs, names : Array(String))
    result_to_array_by_names, 
    
  
    
      result_to_hash(rs)
    result_to_hash
    
  
    
    
  
    
  Instance methods inherited from module Jennifer::Adapter::Transactions
  
  
    
      begin_transaction
    begin_transaction, 
    
  
    
      current_transaction
    current_transaction, 
    
  
    
      rollback_transaction
    rollback_transaction, 
    
  
    
      subscribe_on_commit(block :  -> Bool)
    subscribe_on_commit, 
    
  
    
      subscribe_on_rollback(block :  -> Bool)
    subscribe_on_rollback, 
    
  
    
      transaction(&)
    transaction, 
    
  
    
      under_transaction?
    under_transaction?, 
    
  
    
      with_connection(&)
    with_connection, 
    
  
    
      with_manual_connection(&)
    with_manual_connection
    
  
    
    
  
    
    
    
  
    
    
    
  
Class Method Detail
Instance Method Detail
        
        def column_exists?(table, name)
        #
      
      
        
              Description copied from class Jennifer::Adapter::Base
            
          
          Returns whether column of table with name exists.
# Check a column exists
column_exists?(:suppliers, :name)
        
              Description copied from class Jennifer::Adapter::Base
            
          
          Checks to see if a foreign key exists on a table for a given foreign key definition.
# Checks to see if a foreign key exists.
adapter.foreign_key_exists?(:accounts, :branches)
# Checks to see if a foreign key on a specified column exists.
adapter.foreign_key_exists?(:accounts, column: :owner_id)
# Checks to see if a foreign key with a custom name exists.
adapter.foreign_key_exists?(:accounts, name: "special_fk_name")
        
        
        def table_exists?(table)
        #
      
      
        
              Description copied from class Jennifer::Adapter::Base
            
          
          Returns where table with given table name exists.
adapter.table_exists?(:developers)
        
        
        def translate_type(name)
        #
      
      
        
              Description copied from class Jennifer::Adapter::Base
            
          
          Translates symbol data type name to database-specific data type.
        
        def view_exists?(name) : Bool
        #
      
      
        
              Description copied from class Jennifer::Adapter::Base
            
          
          Check whether view with given name exists.
adapter.view_exists?(:youth_contacts)