abstract class Granite::Adapter::Base
- Granite::Adapter::Base
- Reference
- Object
Overview
The Base Adapter specifies the interface that will be used by the model objects to perform actions against a specific database. Each adapter needs to implement these methods.
Direct Known Subclasses
Defined in:
adapter/base.crConstructors
Instance Method Summary
-
#clear(table_name : String)
remove all rows from a table and reset the counter on the id.
- #database : DB::Database
-
#delete(table_name : String, primary_name : String, value)
This will delete a row from the database.
-
#exists?(table_name : String, criteria : String, params = [] of Granite::Columns::Type) : Bool
Returns
true
if a record exists that matches criteria, otherwisefalse
. -
#import(table_name : String, primary_name : String, auto : Bool, fields, model_array, **options)
This will insert an array of models as one insert statement
-
#insert(table_name : String, fields, params, lastval) : Int64
This will insert a row in the database and return the id generated.
- #log(query : String, elapsed_time : Time::Span, params = [] of String) : Nil
- #name : String
- #open(&)
-
#select(query : Granite::Select::Container, clause = "", params = [] of DB::Any, &)
select performs a query against a table.
-
#update(table_name : String, primary_name : String, fields, params)
This will update a row in the database.
- #url : String
Constructor Detail
Instance Method Detail
remove all rows from a table and reset the counter on the id.
This will delete a row from the database.
Returns true
if a record exists that matches criteria, otherwise false
.
This will insert an array of models as one insert statement
This will insert a row in the database and return the id generated.
select performs a query against a table. The query object contains table_name, fields (configured using the sql_mapping directive in your model), and an optional raw query string. The clause and params is the query and params that is passed in via .all() method
This will update a row in the database.