class

Granite::Adapter::Base

Inherits Reference < Object

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.

Constructors

new(name : String, url : String)
Source

Instance methods

clear(table_name : String)

remove all rows from a table and reset the counter on the id.

Source
database
Source
delete(table_name : String, primary_name : String, value)

This will delete a row from the database.

Source
exists?(table_name : String, criteria : String, params = [] of Granite::Columns::Type) : Bool

Returns true if a record exists that matches criteria, otherwise false.

Source
import(table_name : String, primary_name : String, auto : Bool, fields, model_array, **options)

This will insert an array of models as one insert statement

Source
insert(table_name : String, fields, params, lastval) : Int64

This will insert a row in the database and return the id generated.

Source
log(query : String, elapsed_time : Time::Span, params = [] of String) : Nil
Source
name
Source
open
Source
select(query : Granite::Select::Container, clause = "", params = [] of DB::Any, &)

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

Source
update(table_name : String, primary_name : String, fields, params)

This will update a row in the database.

Source

Nested types