Inheritance diagram for DboSource:

Public Member Functions | |
| __construct ($config=null, $autoConnect=true) | |
| __filterResults (&$results, &$model, $filtered=array()) | |
| __mergeAssociation (&$data, $merge, $association, $type, $selfJoin=false) | |
| __mergeConditions ($query, $assoc) | |
| __mergeHasMany (&$resultSet, $merge, $association, &$model, &$linkModel) | |
| __parseKey ($model, $key, $value) | |
| __quoteFields ($conditions) | |
| __scrubQueryData ($data) | |
| _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, $options=array()) | |
| 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, $read=true) | |
Public Attributes | |
| $__bypass = false | |
| $__sqlOps = array('like', 'ilike', 'or', 'not', 'in', 'between', 'regexp', 'similar to') | |
| $_commands | |
| $alias = 'AS ' | |
| $description = "Database Data Source" | |
| $fieldCache = array() | |
| $index = array('PRI' => 'primary', 'MUL' => 'index', 'UNI' => 'unique') | |
Definition at line 37 of file dbo_source.php.
| DboSource::__construct | ( | $ | config = null, |
|
| $ | autoConnect = true | |||
| ) |
Constructor
Reimplemented in DboMssql.
Definition at line 88 of file dbo_source.php.
References DataSource::$config, __construct(), and Configure::read().
| DboSource::__filterResults | ( | &$ | results, | |
| &$ | model, | |||
| $ | filtered = array() | |||
| ) |
Private method. Passes association results thru afterFind filters of corresponding model
| array | $results Reference of resultset to be filtered | |
| object | $model Instance of model to operate against | |
| array | $filtered List of classes already filtered, to be skipped |
Definition at line 699 of file dbo_source.php.
Referenced by queryAssociation(), and read().
| DboSource::__mergeAssociation | ( | &$ | data, | |
| $ | merge, | |||
| $ | association, | |||
| $ | type, | |||
| $ | selfJoin = false | |||
| ) |
Enter description here...
| unknown_type | $data | |
| unknown_type | $merge | |
| unknown_type | $association | |
| unknown_type | $type | |
| boolean | $selfJoin |
Definition at line 950 of file dbo_source.php.
References Set::diff(), and pluralize().
Referenced by queryAssociation(), and DboOracle::queryAssociation().
| DboSource::__mergeConditions | ( | $ | query, | |
| $ | assoc | |||
| ) |
Merges a mixed set of string/array conditions
Definition at line 1341 of file dbo_source.php.
Referenced by generateAssociationQuery().
| DboSource::__mergeHasMany | ( | &$ | resultSet, | |
| $ | merge, | |||
| $ | association, | |||
| &$ | model, | |||
| &$ | linkModel | |||
| ) |
mergeHasMany - Merge the results of hasMany relations.
| array | $resultSet Data to merge into | |
| array | $merge Data to merge | |
| string | $association Name of Model being Merged | |
| object | $model Model being merged onto | |
| object | $linkModel Model being merged |
Definition at line 913 of file dbo_source.php.
References Set::pushDiff().
Referenced by queryAssociation(), and DboOracle::queryAssociation().
| DboSource::__parseKey | ( | $ | model, | |
| $ | key, | |||
| $ | value | |||
| ) |
Extracts a Model.field identifier and an SQL condition operator from a string, formats and inserts values, and composes them into an SQL snippet.
| Model | $model Model object initiating the query | |
| string | $key An SQL key snippet containing a field and optional SQL operator | |
| mixed | $value The value(s) to be inserted in the string |
Definition at line 1893 of file dbo_source.php.
References __quoteFields(), conditionKeysToString(), String::insert(), name(), and value().
Referenced by conditionKeysToString().
| DboSource::__quoteFields | ( | $ | conditions | ) |
Quotes Model.fields
| string | $conditions |
Definition at line 1973 of file dbo_source.php.
Referenced by __parseKey(), conditionKeysToString(), and conditions().
| DboSource::__scrubQueryData | ( | $ | data | ) |
Private helper method to remove query metadata in given data array.
| array | $data |
Definition at line 1648 of file dbo_source.php.
References group().
Referenced by generateAssociationQuery(), and read().
| DboSource::_getJoins | ( | $ | model | ) |
Returns an array of SQL JOIN fragments from a model's associations
| object | $model |
Definition at line 1497 of file dbo_source.php.
References buildJoinStatement(), conditions(), fullTableName(), and getConstraint().
Referenced by DboMysqlBase::delete(), and DboMysqlBase::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.
| Model | $model | |
| mixed | $conditions |
Definition at line 1471 of file dbo_source.php.
References conditions(), defaultConditions(), and Set::extract().
| DboSource::_prepareUpdateFields | ( | &$ | model, | |
| $ | fields, | |||
| $ | quoteValues = true, |
|||
| $ | alias = false | |||
| ) |
Quotes and prepares fields and values for an SQL UPDATE statement
| 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 |
Definition at line 1405 of file dbo_source.php.
References $alias, name(), and value().
Referenced by update(), and DboMysqlBase::update().
| DboSource::alterSchema | ( | $ | compare, | |
| $ | table = null | |||
| ) |
Generate a alter syntax from CakeSchema::compare()
| unknown_type | $schema |
Reimplemented in DboMysqlBase, DboOracle, and DboPostgres.
Definition at line 2292 of file dbo_source.php.
| DboSource::begin | ( | &$ | model | ) |
Begin a transaction
| model | $model |
Reimplemented from DataSource.
Reimplemented in DboAdodb, DboDb2, and DboSybase.
Definition at line 1566 of file dbo_source.php.
References execute().
| DboSource::boolean | ( | $ | data | ) |
Translates between PHP boolean values and Database (faked) boolean values
| mixed | $data Value to be translated |
Reimplemented in DboDb2.
Definition at line 2201 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
| array | $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), where options can be 'default', 'length', or 'key'. |
Reimplemented in DboAdodb, DboMssql, DboPostgres, and DboSqlite.
Definition at line 2324 of file dbo_source.php.
Referenced by DboOracle::alterSchema(), and DboMysqlBase::alterSchema().
| DboSource::buildIndex | ( | $ | indexes, | |
| $ | table = null | |||
| ) |
Format indexes for create table
| array | $indexes | |
| string | $table |
Reimplemented in DboMssql, DboPostgres, and DboSqlite.
Definition at line 2380 of file dbo_source.php.
| DboSource::buildJoinStatement | ( | $ | join | ) |
Builds and generates a JOIN statement from an array. Handles final clean-up before conversion.
| array | $join An array defining a JOIN statement in a query |
Definition at line 1236 of file dbo_source.php.
References conditions(), name(), and renderJoinStatement().
Referenced by _getJoins(), and buildStatement().
| DboSource::buildStatement | ( | $ | query, | |
| $ | model | |||
| ) |
Builds and generates an SQL statement from an array. Handles final clean-up before conversion.
| array | $query An array defining an SQL query | |
| object | $model The model object which initiated the query |
Definition at line 1260 of file dbo_source.php.
References buildJoinStatement(), conditions(), group(), limit(), name(), order(), and renderStatement().
Referenced by generateAssociationQuery().
| DboSource::calculate | ( | &$ | model, | |
| $ | func, | |||
| $ | params = array() | |||
| ) |
Returns an SQL calculation, i.e. COUNT() or MAX()
| model | $model | |
| string | $func Lowercase name of SQL function, i.e. 'count' or 'max' | |
| array | $params Function parameters (any values must be quoted manually) |
Definition at line 1526 of file dbo_source.php.
References name().
| 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 2109 of file dbo_source.php.
| DboSource::commit | ( | &$ | model | ) |
Commit a transaction
| model | $model |
Reimplemented from DataSource.
Reimplemented in DboAdodb, DboDb2, and DboSybase.
Definition at line 1581 of file dbo_source.php.
References execute().
| DboSource::conditionKeysToString | ( | $ | conditions, | |
| $ | quoteValues = true, |
|||
| $ | model = null | |||
| ) |
Creates a WHERE clause by parsing given conditions array. Used by DboSource::conditions().
| 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 |
Definition at line 1784 of file dbo_source.php.
References $out, __parseKey(), __quoteFields(), expression(), identifier(), name(), and value().
Referenced by __parseKey(), and conditions().
| DboSource::conditions | ( | $ | conditions, | |
| $ | quoteValues = true, |
|||
| $ | where = true, |
|||
| $ | model = null | |||
| ) |
Creates a WHERE clause by parsing given conditions data.
| 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 |
Definition at line 1745 of file dbo_source.php.
References $out, __quoteFields(), and conditionKeysToString().
Referenced by _getJoins(), _matchRecords(), buildJoinStatement(), buildStatement(), DboMysqlBase::delete(), generateAssociationQuery(), query(), and DboMysqlBase::update().
| DboSource::create | ( | &$ | model, | |
| $ | fields = null, |
|||
| $ | values = null | |||
| ) |
The "C" in CRUD
| Model | $model | |
| array | $fields | |
| array | $values |
Reimplemented from DataSource.
Reimplemented in DboMssql.
Definition at line 559 of file dbo_source.php.
References $id, execute(), fields(), fullTableName(), DataSource::lastInsertId(), name(), renderStatement(), and value().
Referenced by renderStatement(), and DboOracle::renderStatement().
| DboSource::createSchema | ( | $ | schema, | |
| $ | tableName = null | |||
| ) |
Generate a database-native schema for the given Schema object
| 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. |
Definition at line 2246 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.
| object | $model | |
| mixed | $conditions | |
| boolean | $useAlias Use model aliases rather than table names when generating conditions |
Definition at line 1611 of file dbo_source.php.
References $alias, exists(), and fullTableName().
Referenced by _matchRecords(), DboMysqlBase::delete(), and DboMysqlBase::update().
| DboSource::delete | ( | &$ | model, | |
| $ | conditions = null | |||
| ) |
Generates and executes an SQL DELETE statement. For databases that do not support aliases in UPDATE queries.
| Model | $model | |
| mixed | $conditions |
Reimplemented from DataSource.
Reimplemented in DboMysqlBase.
Definition at line 1447 of file dbo_source.php.
References $alias, _matchRecords(), execute(), fullTableName(), and renderStatement().
| DboSource::dropSchema | ( | $ | schema, | |
| $ | table = null | |||
| ) |
Generate a "drop table" statement for the given Schema object
| 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. |
Reimplemented in DboMysqlBase, and DboOracle.
Definition at line 2303 of file dbo_source.php.
| DboSource::execute | ( | $ | sql, | |
| $ | options = array() | |||
| ) |
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.
| string | $sql | |
| array | $options |
Definition at line 183 of file dbo_source.php.
References error(), DataSource::lastAffected(), DataSource::lastNumRows(), Object::log(), logQuery(), and showQuery().
Referenced by begin(), DboSybase::begin(), commit(), DboSybase::commit(), DboOracle::connect(), DboOracle::constraint(), create(), DboOracle::createSequence(), DboOracle::createTrigger(), delete(), DboMysqlBase::delete(), DboOracle::describe(), fetchAll(), fetchRow(), DboAdodb::fetchRow(), DboOracle::getEncoding(), DboOracle::lastInsertId(), DboOracle::listSources(), rawQuery(), rollback(), DboSybase::rollback(), DboOracle::sequenceExists(), DboOracle::setEncoding(), truncate(), DboOracle::truncate(), update(), and DboMysqlBase::update().
| DboSource::expression | ( | $ | expression | ) |
Returns an object to represent a database expression in a query
| string | $expression |
Definition at line 158 of file dbo_source.php.
Referenced by conditionKeysToString(), and value().
| 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.
| string | $sql SQL statement | |
| boolean | $cache Enables returning/storing cached query results |
Definition at line 329 of file dbo_source.php.
References $out, execute(), fetchRow(), and hasResult().
Referenced by DboSqlite::describe(), DboPostgres::describe(), DboMssql::describe(), fetchAssociated(), DboSqlite::listSources(), DboPostgres::listSources(), DboMssql::listSources(), query(), queryAssociation(), DboOracle::queryAssociation(), and read().
| DboSource::fetchAssociated | ( | $ | model, | |
| $ | query, | |||
| $ | ids | |||
| ) |
A more efficient way to fetch associations. Woohoo!
| model | $model Primary model object | |
| string | $query Association query | |
| array | $ids Array of IDs of associated records |
Definition at line 894 of file dbo_source.php.
References fetchAll().
Referenced by queryAssociation().
| DboSource::fetchRow | ( | $ | sql = null |
) |
Returns a row from current resultset as an array
Reimplemented in DboAdodb.
Definition at line 306 of file dbo_source.php.
References execute(), and hasResult().
Referenced by fetchAll(), field(), DboSqlite::getEncoding(), DboSybase::lastInsertId(), DboOdbc::lastInsertId(), DboMysqli::lastInsertId(), DboMysql::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.
| string | $name Name of the field | |
| string | $sql SQL query |
Definition at line 365 of file dbo_source.php.
References fetchRow().
| DboSource::fields | ( | &$ | model, | |
| $ | alias = null, |
|||
| $ | fields = array(), |
|||
| $ | quote = true | |||
| ) |
Generates the fields list of an SQL query.
| Model | $model | |
| string | $alias Alias tablename | |
| mixed | $fields | |
| boolean | $quote If false, returns fields array unquoted |
Reimplemented in DboAdodb, DboMssql, DboOdbc, and DboPostgres.
Definition at line 1665 of file dbo_source.php.
References $alias, false, name(), Set::numeric(), and String::tokenize().
Referenced by create(), generateAssociationQuery(), query(), read(), and DboMysqlBase::update().
| DboSource::fullTableName | ( | $ | model, | |
| $ | quote = true | |||
| ) |
Gets full table name including prefix
| mixed | $model | |
| boolean | $quote |
Definition at line 538 of file dbo_source.php.
References config(), and name().
Referenced by _getJoins(), DboPostgres::alterSchema(), DboOracle::alterSchema(), DboMysqlBase::alterSchema(), create(), defaultConditions(), delete(), DboMysqlBase::delete(), DboSybase::describe(), DboSqlite::describe(), DboPostgres::describe(), DboOracle::describe(), DboOdbc::describe(), DboMysqli::describe(), DboMysql::describe(), DboMssql::describe(), DboFirebird::describe(), DboDb2::describe(), DboAdodb::describe(), DboOracle::dropSchema(), DboMysqlBase::dropSchema(), generateAssociationQuery(), DboSqlite::index(), DboPostgres::index(), DboOracle::index(), DboMysqlBase::index(), DboMysqlBase::insertMulti(), truncate(), DboSqlite::truncate(), DboOracle::truncate(), update(), and DboMysqlBase::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
| Model | $model | |
| Model | $linkModel | |
| string | $type | |
| string | $association | |
| array | $assocData | |
| array | $queryData | |
| boolean | $external | |
| array | $resultSet |
Definition at line 1032 of file dbo_source.php.
References $alias, __mergeConditions(), __scrubQueryData(), buildStatement(), conditions(), fields(), fullTableName(), getConstraint(), group(), limit(), offset(), and order().
Referenced by queryAssociation(), DboOracle::queryAssociation(), and read().
| DboSource::getConstraint | ( | $ | type, | |
| $ | model, | |||
| $ | linkModel, | |||
| $ | alias, | |||
| $ | assoc, | |||
| $ | alias2 = null | |||
| ) |
Returns a conditions array for the constraint between two models
| string | $type Association type | |
| object | $model Model object | |
| array | $association Association array |
Definition at line 1196 of file dbo_source.php.
References identifier().
Referenced by _getJoins(), and generateAssociationQuery().
| DboSource::group | ( | $ | group | ) |
Create a GROUP BY SQL clause
| string | $group Group By Condition |
Definition at line 2095 of file dbo_source.php.
Referenced by __scrubQueryData(), buildStatement(), and generateAssociationQuery().
| DboSource::hasAny | ( | &$ | Model, | |
| $ | sql | |||
| ) |
Checks if the specified table contains any record matching specified SQL
| Model | $model Model to search | |
| string | $sql SQL WHERE clause (condition only, not the "WHERE" part) |
Definition at line 2122 of file dbo_source.php.
| DboSource::hasResult | ( | ) |
Checks if the result is valid
Reimplemented in DboAdodb, and DboMysqli.
Definition at line 452 of file dbo_source.php.
Referenced by DboPostgres::disconnect(), fetchAll(), fetchRow(), DboFirebird::fetchRow(), DboOdbc::lastAffected(), DboSybase::lastNumRows(), DboSqlite::lastNumRows(), DboOdbc::lastNumRows(), and DboMysql::lastNumRows().
| DboSource::identifier | ( | $ | identifier | ) |
Returns an object to represent a database identifier in a query
| string | $identifier |
Definition at line 146 of file dbo_source.php.
Referenced by conditionKeysToString(), getConstraint(), and value().
| DboSource::index | ( | $ | model | ) |
Returns an array of the indexes in given datasource name.
| string | $model Name of model to inspect |
Reimplemented in DboMysqlBase, DboOracle, and DboPostgres.
Definition at line 2235 of file dbo_source.php.
| DboSource::insertMulti | ( | $ | table, | |
| $ | fields, | |||
| $ | values | |||
| ) |
Inserts multiple values into a table
| string | $table | |
| string | $fields | |
| array | $values protected |
Reimplemented in DboMssql, and DboMysqlBase.
Definition at line 2219 of file dbo_source.php.
| DboSource::introspectType | ( | $ | value | ) |
Guesses the data type of an array
| string | $value |
Definition at line 2409 of file dbo_source.php.
Referenced by DboMysqli::value(), and DboMysql::value().
| DboSource::isConnected | ( | ) |
Checks if it's connected to the database
Definition at line 444 of file dbo_source.php.
| DboSource::length | ( | $ | real | ) |
Gets the length of a database-native column description, or null if no length
| string | $real Real database-layer column type (i.e. "varchar(255)") |
Reimplemented in DboMysqli, and DboPostgres.
Definition at line 2142 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.
| integer | $limit Limit of results returned | |
| integer | $offset Offset from which to start results |
Reimplemented in DboAdodb, DboDb2, DboFirebird, DboMssql, DboOracle, DboPostgres, and DboSqlite.
Definition at line 2005 of file dbo_source.php.
Referenced by buildStatement(), DboSybase::column(), DboOdbc::column(), DboMysqli::column(), DboMysql::column(), generateAssociationQuery(), query(), and queryAssociation().
| DboSource::logQuery | ( | $ | sql | ) |
| DboSource::name | ( | $ | data | ) |
Returns a quoted name of $data for use in an SQL statement. Strips fields out of SQL functions before quoting.
| string | $data |
Reimplemented in DboDb2, DboFirebird, DboOracle, and DboPostgres.
Definition at line 381 of file dbo_source.php.
References Set::extract().
Referenced by __parseKey(), DboMysqlBase::_alterIndexes(), _prepareUpdateFields(), DboMysqlBase::alterSchema(), DboSqlite::buildColumn(), DboAdodb::buildColumn(), DboSqlite::buildIndex(), buildJoinStatement(), buildStatement(), calculate(), DboSybase::column(), DboSqlite::column(), DboOdbc::column(), DboMysqli::column(), DboMysql::column(), conditionKeysToString(), create(), DboMysqlBase::delete(), DboSqlite::describe(), fields(), DboOdbc::fields(), DboMssql::fields(), DboAdodb::fields(), fullTableName(), DboSqlite::index(), DboMysqlBase::insertMulti(), DboSqlite::listSources(), DboMysqli::listSources(), DboMysql::listSources(), queryAssociation(), resolveKey(), DboSybase::resultSet(), DboMysqli::resultSet(), DboMysql::resultSet(), DboMysqlBase::update(), and value().
| DboSource::order | ( | $ | keys, | |
| $ | direction = 'ASC' | |||
| ) |
Returns an ORDER BY clause as a string.
| string | $key Field reference, as a key (i.e. Post.title) | |
| string | $direction Direction (ASC or DESC) |
Definition at line 2028 of file dbo_source.php.
Referenced by buildStatement(), generateAssociationQuery(), and query().
| DboSource::query | ( | ) |
DataSource Query abstraction
Definition at line 211 of file dbo_source.php.
References conditions(), fetchAll(), fields(), String::insert(), limit(), order(), underscore(), and value().
Referenced by DboSybase::describe(), DboMysqli::describe(), DboMysql::describe(), DboSqlite::index(), DboPostgres::index(), DboOracle::index(), DboMysqlBase::index(), DboMysqlBase::insertMulti(), logQuery(), and showLog().
| DboSource::queryAssociation | ( | &$ | model, | |
| &$ | linkModel, | |||
| $ | type, | |||
| $ | association, | |||
| $ | assocData, | |||
| &$ | queryData, | |||
| $ | external = false, |
|||
| &$ | resultSet, | |||
| $ | recursive, | |||
| $ | stack | |||
| ) |
Enter description here...
| 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 741 of file dbo_source.php.
References __(), __filterResults(), __mergeAssociation(), __mergeHasMany(), error(), fetchAll(), fetchAssociated(), generateAssociationQuery(), ConnectionManager::getDataSource(), DataSource::insertQueryData(), limit(), name(), and Configure::read().
| DboSource::rawQuery | ( | $ | sql | ) |
Executes given SQL statement.
| string | $sql SQL statement |
Definition at line 170 of file dbo_source.php.
References error(), and execute().
Referenced by DboFirebird::lastInsertId().
| DboSource::read | ( | &$ | model, | |
| $ | queryData = array(), |
|||
| $ | recursive = null | |||
| ) |
The "R" in CRUD
| Model | $model | |
| array | $queryData | |
| integer | $recursive Number of levels of association |
Reimplemented in DboMssql.
Definition at line 604 of file dbo_source.php.
References __filterResults(), __scrubQueryData(), fetchAll(), fields(), generateAssociationQuery(), and ConnectionManager::getDataSource().
| DboSource::reconnect | ( | $ | config = null |
) |
Reconnects to database server with optional new settings
| array | $config An array defining the new configuration settings |
Definition at line 107 of file dbo_source.php.
References DataSource::$config, and DataSource::setConfig().
| DboSource::renderJoinStatement | ( | $ | data | ) |
Renders a final SQL JOIN statement
| array | $data |
Definition at line 1287 of file dbo_source.php.
Referenced by buildJoinStatement().
| DboSource::renderStatement | ( | $ | type, | |
| $ | data | |||
| ) |
Renders a final SQL statement by putting together the component parts in the correct order
| string | $type | |
| array | $data |
Reimplemented in DboFirebird, DboMssql, DboOracle, DboPostgres, and DboSqlite.
Definition at line 1298 of file dbo_source.php.
References $alias, create(), and update().
Referenced by buildStatement(), create(), delete(), DboMysqlBase::delete(), update(), and DboMysqlBase::update().
| DboSource::resolveKey | ( | $ | model, | |
| $ | key, | |||
| $ | assoc = null | |||
| ) |
Returns a key formatted like a string Model.fieldname(i.e. Post.title, or Country.name)
| unknown_type | $model | |
| unknown_type | $key | |
| unknown_type | $assoc |
Definition at line 1633 of file dbo_source.php.
References name().
| DboSource::rollback | ( | &$ | model | ) |
Rollback a transaction
| model | $model |
Reimplemented from DataSource.
Reimplemented in DboAdodb, DboDb2, and DboSybase.
Definition at line 1596 of file dbo_source.php.
References execute().
| DboSource::showLog | ( | $ | sorted = false |
) |
Outputs the contents of the queries log.
| boolean | $sorted |
Definition at line 460 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.
| string | $sql Query to show information on. |
Definition at line 516 of file dbo_source.php.
References DataSource::$error, $out, error(), pr(), 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.
| mixed | $table A string or model class representing the table to be truncated |
Reimplemented in DboSqlite.
Definition at line 1555 of file dbo_source.php.
References execute(), and fullTableName().
| DboSource::update | ( | &$ | model, | |
| $ | fields = array(), |
|||
| $ | values = null, |
|||
| $ | conditions = null | |||
| ) |
Generates and executes an SQL UPDATE statement for given model, fields, and values. For databases that do not support aliases in UPDATE queries.
| Model | $model | |
| array | $fields | |
| array | $values | |
| mixed | $conditions |
Reimplemented in DboMssql, DboMysqlBase, and DboSqlite.
Definition at line 1372 of file dbo_source.php.
References $alias, _matchRecords(), _prepareUpdateFields(), execute(), fullTableName(), and renderStatement().
Referenced by renderStatement(), and DboOracle::renderStatement().
| DboSource::value | ( | $ | data, | |
| $ | column = null, |
|||
| $ | read = true | |||
| ) |
Prepares a value, or an array of values for database queries by quoting and escaping them.
| mixed | $data A value or an array of values to prepare. | |
| string | $column The column into which this data will be inserted | |
| boolean | $read Value to be used in READ or WRITE context |
Reimplemented in DboAdodb, DboDb2, DboFirebird, DboMssql, DboMysql, DboMysqli, DboOracle, DboPostgres, DboSqlite, and DboSybase.
Definition at line 122 of file dbo_source.php.
References expression(), identifier(), and name().
Referenced by __parseKey(), _prepareUpdateFields(), conditionKeysToString(), create(), and query().
| DboSource::$__bypass = false |
Definition at line 67 of file dbo_source.php.
| DboSource::$__sqlOps = array('like', 'ilike', 'or', 'not', 'in', 'between', 'regexp', 'similar to') |
Definition at line 73 of file dbo_source.php.
| DboSource::$_commands |
Initial value:
Reimplemented in DboFirebird, DboMssql, DboMysqlBase, DboPostgres, and DboSqlite.
Definition at line 80 of file dbo_source.php.
| DboSource::$alias = 'AS ' |
Reimplemented in DboFirebird, and DboOracle.
Definition at line 55 of file dbo_source.php.
Referenced by _prepareUpdateFields(), defaultConditions(), delete(), DboMysqlBase::delete(), fields(), DboPostgres::fields(), DboOdbc::fields(), DboMssql::fields(), DboAdodb::fields(), generateAssociationQuery(), hasAny(), renderStatement(), update(), and DboMysqlBase::update().
| DboSource::$description = "Database Data Source" |
Reimplemented in DboAdodb, DboDb2, DboFirebird, DboMssql, DboMysqlBase, DboMysql, DboMysqli, DboOdbc, DboPostgres, DboSqlite, and DboSybase.
Definition at line 43 of file dbo_source.php.
| DboSource::$fieldCache = array() |
Definition at line 61 of file dbo_source.php.
| DboSource::$index = array('PRI' => 'primary', 'MUL' => 'index', 'UNI' => 'unique') |
Definition at line 49 of file dbo_source.php.
Referenced by DboDb2::_execute(), DboSybase::fetchResult(), DboSqlite::fetchResult(), DboPostgres::fetchResult(), DboMysqli::fetchResult(), DboMysql::fetchResult(), DboFirebird::fetchResult(), DboDb2::fetchResult(), DboOracle::fetchRow(), DboSqlite::index(), DboPostgres::index(), DboOracle::index(), DboMysqlBase::index(), DboPostgres::renderStatement(), DboSybase::resultSet(), DboSqlite::resultSet(), DboPostgres::resultSet(), DboOdbc::resultSet(), DboMysqli::resultSet(), DboMysql::resultSet(), DboFirebird::resultSet(), and DboAdodb::resultSet().
1.4.7