DboSource Class Reference

Public Member Functions | |
| _getJoins ($model) | |
| _matchRecords (&$model, $conditions=null) | |
| _prepareUpdateFields (&$model, $fields, $quoteValues=true, $alias=false) | |
| alterSchema ($compare, $table=null) | |
| begin (&$model) | |
| boolean ($data) | |
| buildColumn ($column) | |
| buildIndex ($indexes, $table=null) | |
| buildJoinStatement ($join) | |
| buildStatement ($query, $model) | |
| calculate (&$model, $func, $params=array()) | |
| close () | |
| commit (&$model) | |
| conditionKeysToString ($conditions, $quoteValues=true, $model=null) | |
| conditions ($conditions, $quoteValues=true, $where=true, $model=null) | |
| create (&$model, $fields=null, $values=null) | |
| createSchema ($schema, $tableName=null) | |
| defaultConditions (&$model, $conditions, $useAlias=true) | |
| delete (&$model, $conditions=null) | |
| dropSchema ($schema, $table=null) | |
| execute ($sql) | |
| expression ($expression) | |
| fetchAll ($sql, $cache=true, $modelName=null) | |
| fetchAssociated ($model, $query, $ids) | |
| fetchRow ($sql=null) | |
| field ($name, $sql) | |
| fields (&$model, $alias=null, $fields=array(), $quote=true) | |
| fullTableName ($model, $quote=true) | |
| generateAssociationQuery (&$model, &$linkModel, $type, $association=null, $assocData=array(), &$queryData, $external=false, &$resultSet) | |
| getConstraint ($type, $model, $linkModel, $alias, $assoc, $alias2=null) | |
| group ($group) | |
| hasAny (&$Model, $sql) | |
| hasResult () | |
| identifier ($identifier) | |
| index ($model) | |
| insertMulti ($table, $fields, $values) | |
| introspectType ($value) | |
| isConnected () | |
| length ($real) | |
| limit ($limit, $offset=null) | |
| logQuery ($sql) | |
| name ($data) | |
| order ($keys, $direction= 'ASC') | |
| query () | |
| queryAssociation (&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external=false, &$resultSet, $recursive, $stack) | |
| rawQuery ($sql) | |
| read (&$model, $queryData=array(), $recursive=null) | |
| reconnect ($config=null) | |
| renderJoinStatement ($data) | |
| renderStatement ($type, $data) | |
| resolveKey ($model, $key, $assoc=null) | |
| rollback (&$model) | |
| showLog ($sorted=false) | |
| showQuery ($sql) | |
| truncate ($table) | |
| update (&$model, $fields=array(), $values=null, $conditions=null) | |
| value ($data, $column=null) | |
Public Attributes | |
| $_commands | |
| $alias = 'AS ' | |
| $description = "Database Data Source" | |
| $endQuote = null | |
| $fieldCache = array() | |
| $index = array('PRI' => 'primary', 'MUL' => 'index', 'UNI' => 'unique') | |
| $startQuote = null | |
Detailed Description
Definition at line 39 of file dbo_source.php.
Member Function Documentation
| DboSource::_getJoins | ( | $ | model | ) |
Returns an array of SQL JOIN fragments from a model's associations
- Parameters:
-
object $model
- Returns:
- array
Definition at line 1460 of file dbo_source.php.
Referenced by DboMysql::delete(), and DboMysql::update().
| DboSource::_matchRecords | ( | &$ | model, | |
| $ | conditions = null | |||
| ) |
Gets a list of record IDs for the given conditions. Used for multi-record updates and deletes in databases that do not support aliases in UPDATE/DELETE queries.
- Parameters:
-
Model $model mixed $conditions
- Returns:
- array List of record IDs protected
Definition at line 1434 of file dbo_source.php.
References Set::extract().
| DboSource::_prepareUpdateFields | ( | &$ | model, | |
| $ | fields, | |||
| $ | quoteValues = true, |
|||
| $ | alias = false | |||
| ) |
Quotes and prepares fields and values for an SQL UPDATE statement
- Parameters:
-
Model $model array $fields boolean $quoteValues If values should be quoted, or treated as SQL snippets boolean $alias Include the model alias in the field name
- Returns:
- array Fields and values, quoted and preparted protected
Definition at line 1371 of file dbo_source.php.
Referenced by DboMysql::update().
| DboSource::alterSchema | ( | $ | compare, | |
| $ | table = null | |||
| ) |
Generate a alter syntax from CakeSchema::compare()
- Parameters:
-
unknown_type $schema
- Returns:
- unknown
Reimplemented in DboMysql, and DboOracle.
Definition at line 2257 of file dbo_source.php.
| DboSource::begin | ( | &$ | model | ) |
Begin a transaction
- Parameters:
-
model $model
- Returns:
- boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).
Reimplemented from DataSource.
Reimplemented in DboAdodb, DboDb2, DboMysqli, DboOdbc, and DboSybase.
Definition at line 1529 of file dbo_source.php.
| DboSource::boolean | ( | $ | data | ) |
Translates between PHP boolean values and Database (faked) boolean values
- Parameters:
-
mixed $data Value to be translated
- Returns:
- mixed Converted boolean value
Reimplemented in DboDb2, and DboOdbc.
Definition at line 2166 of file dbo_source.php.
Referenced by DboSybase::value(), DboSqlite::value(), DboMysqli::value(), DboMysql::value(), DboMssql::value(), and DboFirebird::value().
| DboSource::buildColumn | ( | $ | column | ) |
Generate a database-native column schema string
- Parameters:
-
array $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), where options can be 'default', 'length', or 'key'.
- Returns:
- string
Reimplemented in DboAdodb, DboMssql, DboPostgres, and DboSqlite.
Definition at line 2289 of file dbo_source.php.
Referenced by DboOracle::alterSchema(), and DboMysql::alterSchema().
| DboSource::buildIndex | ( | $ | indexes, | |
| $ | table = null | |||
| ) |
Format indexes for create table
- Parameters:
-
array $indexes string $table
- Returns:
- array
Reimplemented in DboMssql, DboPostgres, and DboSqlite.
Definition at line 2340 of file dbo_source.php.
| DboSource::buildJoinStatement | ( | $ | join | ) |
Builds and generates a JOIN statement from an array. Handles final clean-up before conversion.
- Parameters:
-
array $join An array defining a JOIN statement in a query
- Returns:
- string An SQL JOIN statement to be used in a query
Definition at line 1208 of file dbo_source.php.
| DboSource::buildStatement | ( | $ | query, | |
| $ | model | |||
| ) |
Builds and generates an SQL statement from an array. Handles final clean-up before conversion.
- Parameters:
-
array $query An array defining an SQL query object $model The model object which initiated the query
- Returns:
- string An executable SQL statement
- See also:
- DboSource::renderStatement()
Definition at line 1232 of file dbo_source.php.
References order.
| DboSource::calculate | ( | &$ | model, | |
| $ | func, | |||
| $ | params = array() | |||
| ) |
Returns the an SQL calculation, i.e. COUNT() or MAX()
- Parameters:
-
model $model string $func Lowercase name of SQL function, i.e. 'count' or 'max' array $params Function parameters (any values must be quoted manually)
- Returns:
- string An SQL calculation function public
Definition at line 1489 of file dbo_source.php.
| DboSource::close | ( | ) |
Disconnects database, kills the connection and says the connection is closed, and if DEBUG is turned on, the log for this object is shown.
Definition at line 2075 of file dbo_source.php.
| DboSource::commit | ( | &$ | model | ) |
Commit a transaction
- Parameters:
-
model $model
- Returns:
- boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).
Reimplemented from DataSource.
Reimplemented in DboAdodb, DboDb2, DboOdbc, and DboSybase.
Definition at line 1544 of file dbo_source.php.
| DboSource::conditionKeysToString | ( | $ | conditions, | |
| $ | quoteValues = true, |
|||
| $ | model = null | |||
| ) |
Creates a WHERE clause by parsing given conditions array. Used by DboSource::conditions().
- Parameters:
-
array $conditions Array or string of conditions boolean $quoteValues If true, values should be quoted Model $model A reference to the Model instance making the query
- Returns:
- string SQL fragment
Definition at line 1742 of file dbo_source.php.
References $out, and Model::query().
| DboSource::conditions | ( | $ | conditions, | |
| $ | quoteValues = true, |
|||
| $ | where = true, |
|||
| $ | model = null | |||
| ) |
Creates a WHERE clause by parsing given conditions data.
- Parameters:
-
mixed $conditions Array or string of conditions boolean $quoteValues If true, values should be quoted boolean $where If true, "WHERE " will be prepended to the return value Model $model A reference to the Model instance making the query
- Returns:
- string SQL fragment
Definition at line 1704 of file dbo_source.php.
References $out.
Referenced by DboMysql::delete(), and DboMysql::update().
| DboSource::create | ( | &$ | model, | |
| $ | fields = null, |
|||
| $ | values = null | |||
| ) |
The "C" in CRUD
- Parameters:
-
Model $model array $fields array $values
- Returns:
- boolean Success
Reimplemented from DataSource.
Reimplemented in DboMssql.
Definition at line 547 of file dbo_source.php.
References execute(), fullTableName(), DataSource::lastInsertId(), name(), and value().
| DboSource::createSchema | ( | $ | schema, | |
| $ | tableName = null | |||
| ) |
Generate a database-native schema for the given Schema object
- Parameters:
-
object $schema An instance of a subclass of CakeSchema string $tableName Optional. If specified only the table name given will be generated. Otherwise, all tables defined in the schema are generated.
- Returns:
- string
Definition at line 2211 of file dbo_source.php.
| DboSource::defaultConditions | ( | &$ | model, | |
| $ | conditions, | |||
| $ | useAlias = true | |||
| ) |
Creates a default set of conditions from the model if $conditions is null/empty.
- Parameters:
-
object $model mixed $conditions boolean $useAlias Use model aliases rather than table names when generating conditions
- Returns:
- mixed
Definition at line 1574 of file dbo_source.php.
Referenced by DboMysql::delete(), and DboMysql::update().
| DboSource::delete | ( | &$ | model, | |
| $ | conditions = null | |||
| ) |
Generates and executes an SQL DELETE statement. For databases that do not support aliases in UPDATE queries.
- Parameters:
-
Model $model mixed $conditions
- Returns:
- boolean Success
Reimplemented from DataSource.
Reimplemented in DboMysql.
Definition at line 1410 of file dbo_source.php.
| DboSource::dropSchema | ( | $ | schema, | |
| $ | table = null | |||
| ) |
Generate a "drop table" statement for the given Schema object
- Parameters:
-
object $schema An instance of a subclass of CakeSchema string $table Optional. If specified only the table name given will be generated. Otherwise, all tables defined in the schema are generated.
- Returns:
- string
Reimplemented in DboMysql.
Definition at line 2268 of file dbo_source.php.
| DboSource::execute | ( | $ | sql | ) |
Queries the database with given SQL statement, and obtains some metadata about the result (rows affected, timing, any errors, number of rows in resultset). The query is also logged. If DEBUG is set, the log is shown all the time, else it is only shown on errors.
- Parameters:
-
string $sql
- Returns:
- mixed Resource or object representing the result set, or false on failure
Reimplemented in DboSqlite.
Definition at line 189 of file dbo_source.php.
References DataSource::lastAffected(), DataSource::lastNumRows(), logQuery(), Configure::read(), and showQuery().
Referenced by DboSybase::begin(), DboMysqli::begin(), DboSybase::commit(), DboOracle::connect(), DboOracle::constraint(), create(), DboOracle::createSequence(), DboOracle::createTrigger(), DboMysql::delete(), DboOracle::describe(), fetchAll(), fetchRow(), DboAdodb::fetchRow(), DboOracle::getEncoding(), DboOracle::lastInsertId(), DboOracle::listSources(), rawQuery(), DboSybase::rollback(), DboOracle::sequenceExists(), DboOracle::setEncoding(), DboOracle::truncate(), and DboMysql::update().
| DboSource::expression | ( | $ | expression | ) |
Returns an object to represent a database expression in a query
- Parameters:
-
string $expression
- Returns:
- object An object representing a database expression to be used in a query
Definition at line 165 of file dbo_source.php.
| DboSource::fetchAll | ( | $ | sql, | |
| $ | cache = true, |
|||
| $ | modelName = null | |||
| ) |
Returns an array of all result rows for a given SQL query. Returns false if no rows matched.
- Parameters:
-
string $sql SQL statement boolean $cache Enables returning/storing cached query results
- Returns:
- array Array of resultset rows, or false if no rows matched
Definition at line 331 of file dbo_source.php.
References $out, execute(), fetchRow(), and hasResult().
Referenced by DboSqlite::describe(), DboPostgres::describe(), DboMssql::describe(), DboSqlite::listSources(), DboPostgres::listSources(), DboMssql::listSources(), query(), and DboOracle::queryAssociation().
| DboSource::fetchAssociated | ( | $ | model, | |
| $ | query, | |||
| $ | ids | |||
| ) |
A more efficient way to fetch associations. Woohoo!
- Parameters:
-
model $model Primary model object string $query Association query array $ids Array of IDs of associated records
- Returns:
- array Association results
Definition at line 871 of file dbo_source.php.
| DboSource::fetchRow | ( | $ | sql = null |
) |
Returns a row from current resultset as an array
- Returns:
- array The fetched row as an array
Reimplemented in DboAdodb.
Definition at line 308 of file dbo_source.php.
References execute(), and hasResult().
Referenced by fetchAll(), field(), DboSqlite::getEncoding(), DboSybase::lastInsertId(), DboOdbc::lastInsertId(), DboMysqli::lastInsertId(), DboMysql::lastInsertId(), DboMssql::lastInsertId(), and DboDb2::lastInsertId().
| DboSource::field | ( | $ | name, | |
| $ | sql | |||
| ) |
Returns a single field of the first of query results for a given SQL query, or false if empty.
- Parameters:
-
string $name Name of the field string $sql SQL query
- Returns:
- unknown
Definition at line 367 of file dbo_source.php.
References fetchRow().
| DboSource::fields | ( | &$ | model, | |
| $ | alias = null, |
|||
| $ | fields = array(), |
|||
| $ | quote = true | |||
| ) |
Generates the fields list of an SQL query.
- Parameters:
-
Model $model string $alias Alias tablename mixed $fields boolean $quote If false, returns fields array unquoted
- Returns:
- array
Reimplemented in DboAdodb, DboMssql, and DboPostgres.
Definition at line 1628 of file dbo_source.php.
References Set::numeric(), and String::tokenize().
Referenced by read(), and DboMysql::update().
| DboSource::fullTableName | ( | $ | model, | |
| $ | quote = true | |||
| ) |
Gets full table name including prefix
- Parameters:
-
mixed $model boolean $quote
- Returns:
- string Full quoted table name
Definition at line 526 of file dbo_source.php.
References config(), and name().
Referenced by DboOracle::alterSchema(), DboMysql::alterSchema(), create(), DboMssql::create(), DboMysql::delete(), DboSybase::describe(), DboSqlite::describe(), DboPostgres::describe(), DboOracle::describe(), DboOdbc::describe(), DboMysqli::describe(), DboMysql::describe(), DboMssql::describe(), DboFirebird::describe(), DboDb2::describe(), DboAdodb::describe(), DboMysql::dropSchema(), DboOracle::index(), DboMysql::index(), DboMysql::insertMulti(), DboSqlite::truncate(), DboOracle::truncate(), and DboMysql::update().
| DboSource::generateAssociationQuery | ( | &$ | model, | |
| &$ | linkModel, | |||
| $ | type, | |||
| $ | association = null, |
|||
| $ | assocData = array(), |
|||
| &$ | queryData, | |||
| $ | external = false, |
|||
| &$ | resultSet | |||
| ) |
Generates an array representing a query or part of a query from a single model or two associated models
- Parameters:
-
Model $model Model $linkModel string $type string $association array $assocData array $queryData boolean $external array $resultSet
- Returns:
- mixed
Definition at line 999 of file dbo_source.php.
References order.
Referenced by DboOracle::queryAssociation(), and read().
| DboSource::getConstraint | ( | $ | type, | |
| $ | model, | |||
| $ | linkModel, | |||
| $ | alias, | |||
| $ | assoc, | |||
| $ | alias2 = null | |||
| ) |
Returns a conditions array for the constraint between two models
- Parameters:
-
string $type Association type object $model Model object array $association Association array
- Returns:
- array Conditions array defining the constraint between $model and $association
Definition at line 1168 of file dbo_source.php.
| DboSource::group | ( | $ | group | ) |
Create a GROUP BY SQL clause
- Parameters:
-
string $group Group By Condition
- Returns:
- mixed string condition or null
Definition at line 2061 of file dbo_source.php.
| DboSource::hasAny | ( | &$ | Model, | |
| $ | sql | |||
| ) |
Checks if the specified table contains any record matching specified SQL
- Parameters:
-
Model $model Model to search string $sql SQL WHERE clause (condition only, not the "WHERE" part)
- Returns:
- boolean True if the table has a matching record, else false
Definition at line 2088 of file dbo_source.php.
| DboSource::hasResult | ( | ) |
Checks if the result is valid
- Returns:
- boolean True if the result is valid else false
Reimplemented in DboAdodb, and DboMysqli.
Definition at line 440 of file dbo_source.php.
Referenced by DboPostgres::disconnect(), fetchAll(), fetchRow(), DboFirebird::fetchRow(), DboSybase::lastNumRows(), and DboSqlite::lastNumRows().
| DboSource::identifier | ( | $ | identifier | ) |
Returns an object to represent a database identifier in a query
- Parameters:
-
string $identifier
- Returns:
- object An object representing a database identifier to be used in a query
Definition at line 153 of file dbo_source.php.
Referenced by value().
| DboSource::index | ( | $ | model | ) |
Returns an array of the indexes in given datasource name.
- Parameters:
-
string $model Name of model to inspect
- Returns:
- array Fields in table. Keys are column and unique
Reimplemented in DboMysql, and DboOracle.
Definition at line 2200 of file dbo_source.php.
Referenced by DboSqlite::describe(), and DboMysqli::describe().
| DboSource::insertMulti | ( | $ | table, | |
| $ | fields, | |||
| $ | values | |||
| ) |
Inserts multiple values into a table
- Parameters:
-
string $table string $fields array $values protected
Reimplemented in DboMysql.
Definition at line 2184 of file dbo_source.php.
| DboSource::introspectType | ( | $ | value | ) |
Guesses the data type of an array
- Parameters:
-
string $value
- Returns:
- void public
Definition at line 2368 of file dbo_source.php.
Referenced by DboMysql::value().
| DboSource::isConnected | ( | ) |
Checks if it's connected to the database
- Returns:
- boolean True if the database is connected, else false
Definition at line 432 of file dbo_source.php.
| DboSource::length | ( | $ | real | ) |
Gets the length of a database-native column description, or null if no length
- Parameters:
-
string $real Real database-layer column type (i.e. "varchar(255)")
- Returns:
- mixed An integer or string representing the length of the column
Reimplemented in DboMysqli, and DboPostgres.
Definition at line 2107 of file dbo_source.php.
Referenced by DboSqlite::buildColumn(), DboAdodb::buildColumn(), DboMysql::column(), DboSybase::describe(), DboSqlite::describe(), DboOracle::describe(), DboMysql::describe(), DboMssql::describe(), DboFirebird::describe(), DboDb2::describe(), and DboAdodb::describe().
| DboSource::limit | ( | $ | limit, | |
| $ | offset = null | |||
| ) |
Returns a limit statement in the correct format for the particular database.
- Parameters:
-
integer $limit Limit of results returned integer $offset Offset from which to start results
- Returns:
- string SQL limit/offset statement
Reimplemented in DboAdodb, DboDb2, DboFirebird, DboMssql, DboOracle, DboPostgres, and DboSqlite.
Definition at line 1947 of file dbo_source.php.
Referenced by DboSybase::column(), DboOdbc::column(), DboMysqli::column(), and DboMysql::column().
| DboSource::logQuery | ( | $ | sql | ) |
Log given SQL query.
- Parameters:
-
string $sql SQL statement
- Todo:
- : Add hook to log errors instead of returning false
Definition at line 481 of file dbo_source.php.
References query().
Referenced by execute().
| DboSource::name | ( | $ | data | ) |
Returns a quoted name of $data for use in an SQL statement. Strips fields out of SQL functions before quoting.
- Parameters:
-
string $data
- Returns:
- string SQL field
Reimplemented in DboDb2, DboFirebird, DboOdbc, DboOracle, and DboPostgres.
Definition at line 383 of file dbo_source.php.
References Set::extract().
Referenced by DboMysql::alterSchema(), DboSqlite::buildColumn(), DboMssql::buildColumn(), DboAdodb::buildColumn(), DboSqlite::buildIndex(), DboMssql::buildIndex(), DboSybase::column(), DboSqlite::column(), DboMysqli::column(), DboMysql::column(), DboMssql::column(), create(), DboMysql::delete(), DboSqlite::describe(), DboMssql::fields(), DboAdodb::fields(), fullTableName(), DboMysql::insertMulti(), DboSqlite::listSources(), DboMysqli::listSources(), DboMysql::listSources(), DboSybase::resultSet(), DboMysqli::resultSet(), DboMysql::resultSet(), DboMysql::update(), and value().
| DboSource::order | ( | $ | keys, | |
| $ | direction = 'ASC' | |||
| ) |
Returns an ORDER BY clause as a string.
- Parameters:
-
string $key Field reference, as a key (i.e. Post.title) string $direction Direction (ASC or DESC)
- Returns:
- string ORDER BY clause
Definition at line 1970 of file dbo_source.php.
| DboSource::query | ( | ) |
DataSource Query abstraction
- Returns:
- resource Result resource identifier
Definition at line 213 of file dbo_source.php.
References fetchAll(), String::insert(), Inflector::underscore(), and value().
Referenced by DboSybase::describe(), DboMysqli::describe(), DboMysql::describe(), DboOracle::index(), DboMysql::index(), DboMysql::insertMulti(), logQuery(), and showLog().
| DboSource::queryAssociation | ( | &$ | model, | |
| &$ | linkModel, | |||
| $ | type, | |||
| $ | association, | |||
| $ | assocData, | |||
| &$ | queryData, | |||
| $ | external = false, |
|||
| &$ | resultSet, | |||
| $ | recursive, | |||
| $ | stack | |||
| ) |
Enter description here...
- Parameters:
-
Model $model unknown_type $linkModel string $type Association type unknown_type $association unknown_type $assocData unknown_type $queryData unknown_type $external unknown_type $resultSet integer $recursive Number of levels of association array $stack
Reimplemented in DboOracle.
Definition at line 717 of file dbo_source.php.
References e(), ConnectionManager::getDataSource(), and Configure::read().
| DboSource::rawQuery | ( | $ | sql | ) |
Executes given SQL statement.
- Parameters:
-
string $sql SQL statement
- Returns:
- unknown
Definition at line 177 of file dbo_source.php.
References execute().
Referenced by DboFirebird::lastInsertId().
| DboSource::read | ( | &$ | model, | |
| $ | queryData = array(), |
|||
| $ | recursive = null | |||
| ) |
The "R" in CRUD
- Parameters:
-
Model $model array $queryData integer $recursive Number of levels of association
- Returns:
- unknown
Reimplemented in DboMssql.
Definition at line 587 of file dbo_source.php.
References fields(), and generateAssociationQuery().
| DboSource::reconnect | ( | $ | config = null |
) |
Reconnects to database server with optional new settings
- Parameters:
-
array $config An array defining the new configuration settings
- Returns:
- boolean True on success, false on failure
Definition at line 121 of file dbo_source.php.
References DataSource::$config, and config().
| DboSource::renderJoinStatement | ( | $ | data | ) |
Renders a final SQL JOIN statement
- Parameters:
-
array $data
- Returns:
- string
Definition at line 1258 of file dbo_source.php.
| DboSource::renderStatement | ( | $ | type, | |
| $ | data | |||
| ) |
Renders a final SQL statement by putting together the component parts in the correct order
- Parameters:
-
string $type array $data
- Returns:
- string
Reimplemented in DboFirebird, DboMssql, DboOracle, DboPostgres, and DboSqlite.
Definition at line 1269 of file dbo_source.php.
Referenced by DboMysql::delete(), and DboMysql::update().
| DboSource::resolveKey | ( | $ | model, | |
| $ | key, | |||
| $ | assoc = null | |||
| ) |
Returns a key formatted like a string Model.fieldname(i.e. Post.title, or Country.name)
- Parameters:
-
unknown_type $model unknown_type $key unknown_type $assoc
- Returns:
- string
Definition at line 1596 of file dbo_source.php.
| DboSource::rollback | ( | &$ | model | ) |
Rollback a transaction
- Parameters:
-
model $model
- Returns:
- boolean True on success, false on fail (i.e. if the database/model does not support transactions, or a transaction has not started).
Reimplemented from DataSource.
Reimplemented in DboAdodb, DboDb2, DboOdbc, and DboSybase.
Definition at line 1559 of file dbo_source.php.
| DboSource::showLog | ( | $ | sorted = false |
) |
Outputs the contents of the queries log.
- Parameters:
-
boolean $sorted
Definition at line 448 of file dbo_source.php.
References query().
| DboSource::showQuery | ( | $ | sql | ) |
Output information about an SQL query. The SQL statement, number of rows in resultset, and execution time in microseconds. If the query fails, an error is output instead.
- Parameters:
-
string $sql Query to show information on.
Definition at line 504 of file dbo_source.php.
References DataSource::$error, $out, e(), and Configure::read().
Referenced by execute().
| DboSource::truncate | ( | $ | table | ) |
Deletes all the records in a table and resets the count of the auto-incrementing primary key, where applicable.
- Parameters:
-
mixed $table A string or model class representing the table to be truncated
- Returns:
- boolean SQL TRUNCATE TABLE statement, false if not applicable. public
Reimplemented in DboSqlite.
Definition at line 1518 of file dbo_source.php.
| DboSource::update | ( |