abstract class Sandstone::Adapter::Base

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.cr

Constant Summary

DATABASE_YML = "config/database.yml"

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(adapter : String) #

[View source]

Class Method Detail

def self.env(url) #

class level method so we can test it


[View source]

Instance Method Detail

abstract def clear(table_name) #

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


[View source]
def database : DB::Database #

[View source]
def database=(database : DB::Database) #

[View source]
abstract def delete(table_name, primary_name, value) #

This will delete a row from the database.


[View source]
abstract def insert(table_name, fields, params) : Int64 #

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


[View source]
def log(query : String, params = [] of String) : Nil #

[View source]
def open(&) #

[View source]
abstract def select(table_name, fields, clause = "", params = [] of DB::Any, &block : DB::ResultSet -> ) #

select performs a query against a table. The table_name and fields are configured using the sql_mapping directive in your model. The clause and params is the query and params that is passed in via .all() method


[View source]
def settings(adapter : String) #

[View source]
abstract def update(table_name, primary_name, fields, params) #

This will update a row in the database.


[View source]