-
Notifications
You must be signed in to change notification settings - Fork 34
classes_essentials_model_driver_idatabasedriver.class
Interface for database drivers. Although ScavixWDF uses PDO each database has it's specialities so we need a driver interface. The actual database drivers must imeplement this to be compatible with ScavixWDF.
Create a table from an objects schema. We are not sure if we will ever implement this side as we prefer to create our tables in the database.
Definition: public function createTable($objSchema)
Returns: void
Parameters:
-
\ScavixWDF\Model\TableSchema $objSchema
Tableschema as specified by the Model
Creates a valid statement to delete the given model from the database.
Definition: public function getDeleteStatement($model, $args)
Returns: bool|\ScavixWDF\Model\ResultSet
SQL statement with argument placeholders to identify $model (see $args)
Parameters:
-
\ScavixWDF\Model\Model $model
Model to delete -
array $args
OUT:The values extracted from $model to uniquely identify it (the primary key values)
Create a pages statement from an unpaged one.
Definition: public function getPagedStatement($sql, $page, $items_per_page)
Returns: \ScavixWDF\Model\ResultSet
Paged SQL statement
Parameters:
-
string $sql
The original statement -
int $page
The one-based page index -
int $items_per_page
Items per page
Returns paging informaton about a query.
Definition: public function getPagingInfo($sql, $input_arguments=null)
Returns: array
An array containing: rows_per_page, current_page, total_pages, total_rows, offset
Parameters:
-
string $sql
SQL statement to get information for -
array $input_arguments
Input parameters for the SQL statement
Creates a valid save statement to store an object into the database.
Definition: public function getSaveStatement($model, $args, $columns_to_update=false)
Returns: string
SQL statement with argument placeholders for all change columns (see $args)
Parameters:
-
\ScavixWDF\Model\Model $model
The model to store -
array $args
OUT:The values extracted from $model that have changed wince last save (or all if new object) -
array $columns_to_update
If given only these fields will be updated. If not Model tries to detect changed columns automatically.
Returns the schema of a table.
Definition: public function getTableSchema($tablename)
Returns: \ScavixWDF\Model\TableSchema
The tables schema
Parameters:
-
string $tablename
The tables name
Initializes the driver.
Definition: public function initDriver($datasource, $pdo)
Returns: void
Parameters:
-
\ScavixWDF\Model\DataSource $datasource
The datasource object using this driver (it is called $this over there) -
\ScavixWDF\Model\PdoLayer $pdo
The PDO database connection
Returns a list of all column names in a table.
Definition: public function listColumns($tablename)
Returns: array
Array of column names
Parameters:
-
string $tablename
Name of table to query
Returns a list of all tables.
Definition: public function listTables()
Returns: array
List of tables
Returns an SQL query to get the current datetime.
Definition: public function Now($seconds_to_add)
Returns: string
Query to get now from the Db
Parameters:
-
int $seconds_to_add
Offset to now in seconds (can also be negative)
Preprocesses an SQL statement. Some drivers need to perform some extra parameter specifier processing or stuff. Can be implemented here as this will be called with every query.
Definition: public function PreprocessSql($sql)
Returns: string
Statement valid for this drivers database
Parameters:
-
string $sql
RAW SQL statement
Checks if a table exists.
Definition: public function tableExists($tablename)
Returns: bool
true or false
Parameters:
-
string $tablename
name of table to check for