class Pon::Adapter::Sqlite
- Pon::Adapter::Sqlite
 - Pon::Adapter::RDB
 - Pon::Adapter
 - Reference
 - Object
 
Overview
Sqlite implementation of the Adapter
Defined in:
pon/adapter/sqlite.crConstant Summary
- 
        BIND_TYPE = 
BindType::Question - 
        LAST_VAL = 
"SELECT LAST_INSERT_ROWID()" - 
        QUOTE = 
'"' - 
        RawTypes = 
{"AUTO_Int32" => "INTEGER NOT NULL PRIMARY KEY", "AUTO_Int64" => "INTEGER NOT NULL PRIMARY KEY", "Int32" => "INTEGER", "Int64" => "INTEGER", "Time::Span" => "VARCHAR", "created_at" => "VARCHAR", "updated_at" => "VARCHAR"} - 
        SETTING = 
"name = \"sqlite\"\n\nurl = \"sqlite3:test.sqlite3\"\ninit_pool_size = 1\nmax_pool_size = 5\ninit_connect = \"PRAGMA read_uncommitted = true;\"\n\n[query]\nshow_databases = \"PRAGMA database_list\"\nshow_tables = \"SELECT name FROM sqlite_master WHERE type = 'table'\"" 
Constructors
- 
        .new(klass, table_name : String, primary_name : String, setting : Pon::Setting | Nil = nil)
        
          
Sqlite implementation of the Adapter
 
Class Method Summary
- 
        .escape(name : String) : String
        
          
escapes the value by
QUOTE - 
        .quote(name : String) : String
        
          
ensures the value is quoted with idempotency returns the value itself when it already contains
QUOTEcrystal quote("foo") # => "`foo`" quote("`foo`") # => "`foo`" quote("`foo`.bar") # => "`foo`.bar" - 
        .raw_type?(key : String)
        
          
converts the crystal class to database type of this adapter
 - 
        .setting
        
          
Sqlite implementation of the Adapter
 
Instance Method Summary
- 
        #all(fields : Array(String), types, query_string = nil, **opts)
        
          
Sqlite implementation of the Adapter
 - 
        #all(fields : Array(String | Nil), types, query_string = nil, **opts)
        
          
Sqlite implementation of the Adapter
 - 
        #count : Int32
        
          
Sqlite implementation of the Adapter
 - 
        #database : DB::Database
        
          
#databaseabstracts unique connections and access to shared connections. - #databases : Array(String)
 - 
        #delete(key) : Nil
        
          
Sqlite implementation of the Adapter
 - 
        #delete : Nil
        
          
Sqlite implementation of the Adapter
 - 
        #exec(query : String, params = [] of String)
        
          
NOTE all "?" appeared in query part will be replaced when params exist
 - 
        #insert(fields, params)
        
          
Sqlite implementation of the Adapter
 - 
        #lastval : Int64
        
          
Sqlite implementation of the Adapter
 - 
        #one?(id, fields : Array(String), as types : Tuple)
        
          
Sqlite implementation of the Adapter
 - 
        #qp : String
        
          
Sqlite implementation of the Adapter
 - 
        #qt : String
        
          
Sqlite implementation of the Adapter
 - 
        #quote_field(name : String | Nil) : String
        
          
Sqlite implementation of the Adapter
 - 
        #reset! : Nil
        
          
Sqlite implementation of the Adapter
 - 
        #table_name : String
        
          
Sqlite implementation of the Adapter
 - 
        #tables : Array(String)
        
          
Sqlite implementation of the Adapter
 - 
        #transaction(&) : Nil
        
          
Sqlite implementation of the Adapter
 - 
        #truncate : Nil
        
          
Sqlite implementation of the Adapter
 - 
        #update(fields, params)
        
          
Sqlite implementation of the Adapter
 
Instance methods inherited from class Pon::Adapter::RDB
  
  
    
      all(fields : Array(String), types, query_string = nil, **opts)
    all, 
    
  
    
      count : Int32
    count, 
    
  
    
      databases : Array(String)
    databases, 
    
  
    
      delete(key) : Nildelete : Nil delete, exec(query : String, params = [] of String) exec, insert(fields, params) insert, lastval : Int64 lastval, one?(id, fields : Array(String), as types : Tuple) one?, query_all(*args, **options)
query_all(*args, **options, &) query_all, query_one?(*args, **options)
query_one?(*args, **options, &) query_one?, quote(*args, **options)
quote(*args, **options, &) quote, reset! : Nil reset!, scalar(*args, **options)
scalar(*args, **options, &) scalar, table_name : String table_name, tables : Array(String) tables, transaction(&) : Nil transaction, truncate : Nil truncate
Instance methods inherited from class Pon::Adapter
  
  
    
      query_log(sql, group)
    query_log
    
  
    
    
  Class methods inherited from class Pon::Adapter
  
  
    
      build_database(setting) : DB::Database
    build_database, 
    
  
    
      database(setting : Setting) : DB::Database
    database, 
    
  
    
      databases
    databases, 
    
  
    
      reset!(setting : Setting) : Nilreset! : Nil reset!, settings settings
Constructor Detail
Sqlite implementation of the Adapter
Class Method Detail
ensures the value is quoted with idempotency
returns the value itself when it already contains QUOTE
quote("foo")       # => "`foo`"
quote("`foo`")     # => "`foo`"
quote("`foo`.bar") # => "`foo`.bar"
        Instance Method Detail
Sqlite implementation of the Adapter
Sqlite implementation of the Adapter
#database abstracts unique connections and access to shared connections.
Querying each time accessing without caching slightly degrades performance,
but this mechanism is required when resetting shared connections.
NOTE all "?" appeared in query part will be replaced when params exist