DboSource Class Info:

Class Declaration:

class DboSource extends DataSource

File name:
cake/libs/model/datasources/dbo_source.php
Description:

DboSource

Creates DBO-descendant objects from a given db connection configuration

Class Inheritance

DataSource Object

Properties:

Show/Hide parent properties
  • affected string

    String to hold how many rows were affected by the last SQL operation.

  • alias string

    Database keyword used to assign aliases to identifiers.

  • _baseConfig array

    The default configuration of a specific DataSource

  • cacheMethods boolean.

    Whether or not to cache the results of DboSource::name() and DboSource::conditions() into the memory cache. Set to false to disable the use of the memory cache.

  • cacheSources boolean

    Whether or not source data like available tables and schema descriptions should be cached

  • _commands array

    Index of basic SQL commands

  • config array

    The DataSource configuration

  • configKeyName string

    The DataSource configuration key name

  • connected boolean

    Are we connected to the DataSource?

  • connection array

    A reference to the physical connection of this DataSource

  • description string

    Description string for this Database Data Source.

  • endQuote string

    The ending character that this DataSource uses for quoted identifiers.

  • error unknown_type

    Error description of last query

  • fieldParameters array

    List of engine specific additional field parameters used on table creating

  • fullDebug boolean

    Print full query debug info?

  • index array

    index definition, standard cake, primary, index, unique

  • methodCache array

    Caches result from query parsing operations. Cached results for both DboSource::name() and DboSource::conditions() will be stored here. Method caching uses crc32() which is fast but can collisions more easily than other hashing algorithms. If you have problems with collisions, set DboSource::$cacheMethods to false.

  • numRows int

    Number of rows in current resultset

  • _queriesCnt int

    Queries count.

  • _queriesLog unknown_type

    Log of queries executed by this DataSource

  • _queriesLogMax int Maximum number of queries in the queries log.

    Maximum number of items in query log

    This is to prevent query log taking over too much memory.

  • _queriesTime unknown_type

    Total duration of all queries.

  • _queryCache array Maximum number of queries in the queries log.

    Caches serialzed results of executed queries

  • _result array

    Result

  • _sources array

    Holds a list of sources (tables) contained in the DataSource

  • startQuote string

    The starting character that this DataSource uses for quoted identifiers.

  • tableParameters array

    List of table engine specific parameters used on table creating

  • took int

    Time the last query took

  • _transactionStarted boolean

    Whether or not this DataSource is in the middle of a transaction

  • virtualFieldSeparator string

    Separator string for virtualField composition

Method Summary:

Show/Hide parent methods

alterSchema

top

Generate a alter syntax from CakeSchema::compare()

Parameters:
  • $compare required

  • $table optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2679
Return

boolean

begin

top

Begin a transaction

(i.e. if the database/model does not support transactions, or a transaction has not started).

Parameters:
  • model $model required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1808
Return

boolean True on success, false on fail

Access

public

boolean

top

Translates between PHP boolean values and Database (faked) boolean values

Parameters:
  • mixed $data required

    Value to be translated

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2580
Return

mixed Converted boolean value

Access

public

buildColumn

top

Generate a database-native column schema string

Parameters:
  • array $column required

    An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), where options can be 'default', 'length', or 'key'.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2715
Return

string

Access

public

_buildFieldParameters

top

Build the field parameters, in a position

Parameters:
  • string $columnString required

    The partially built column string

  • array $columnData required

    The array of column data.

  • string $position required

    The position type to use. 'beforeDefault' or 'afterDefault' are common

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2781
Return

string a built column with the field parameters added.

Access

public

buildIndex

top

Format indexes for create table

Parameters:
  • array $indexes required

  • string $table optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2805
Return

array

Access

public

buildJoinStatement

top

Builds and generates a JOIN statement from an array. Handles final clean-up before conversion.

Parameters:
  • array $join required

    An array defining a JOIN statement in a query

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1425
Return

string An SQL JOIN statement to be used in a query

Access

public

See

DboSource::renderJoinStatement()

DboSource::buildStatement()

buildStatement

top

Builds and generates an SQL statement from an array. Handles final clean-up before conversion.

Parameters:
  • array $query required

    An array defining an SQL query

  • object $model required

    The model object which initiated the query

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1451
Return

string An executable SQL statement

Access

public

See

DboSource::renderStatement()

buildTableParameters

top

Format parameters for create table

Parameters:
  • array $parameters required

  • string $table optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2857
Return

array

Access

public

cacheMethod

top

Cache a value into the methodCaches. Will respect the value of DboSource::$cacheMethods. Will retrieve a value from the cache if $value is null.

If caching is disabled and a write is attempted, the $value will be returned. A read will either return the value or null.

Parameters:
  • string $method required

    Name of the method being cached.

  • string $key required

    The keyname for the cache operation.

  • mixed $value optional NULL

    The value to cache into memory.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 504
Return

mixed Either null on failure, or the value if its set.

cakeError

top

Used to report user friendly errors. If there is a file app/error.php or app/app_error.php this file will be loaded error.php is the AppError class it should extend ErrorHandler class.

Parameters:
  • string $method required

    Method to be called in the error class (AppError or ErrorHandler classes)

  • array $messages optional array ( )

    Message that is to be displayed by the error class

Method defined in:
cake/libs/object.php on line 187
Return

error message

Access

public

calculate

top

Returns an SQL calculation, i.e. COUNT() or MAX()

Parameters:
  • model $model required

  • string $func required

    Lowercase name of SQL function, i.e. 'count' or 'max'

  • array $params optional array ( )

    Function parameters (any values must be quoted manually)

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1755
Return

string An SQL calculation function

Access

public

close

top

Disconnects database, kills the connection and says the connection is closed.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2485
Return

void

Access

public

column

top

Converts column types to basic types

Parameters:
  • string $real required

    Real column type (i.e. "varchar(255)")

Method defined in:
cake/libs/model/datasources/datasource.php on line 324
Return

string Abstract column type (i.e. "string")

Access

public

commit

top

Commit a transaction

(i.e. if the database/model does not support transactions, or a transaction has not started).

Parameters:
  • model $model required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1825
Return

boolean True on success, false on fail

Access

public

conditionKeysToString

top

Creates a WHERE clause by parsing given conditions array. Used by DboSource::conditions().

Parameters:
  • array $conditions required

    Array or string of conditions

  • boolean $quoteValues optional true

    If true, values should be quoted

  • Model $model optional NULL

    A reference to the Model instance making the query

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2134
Return

string SQL fragment

Access

public

conditions

top

Creates a WHERE clause by parsing given conditions data. If an array or string conditions are provided those conditions will be parsed and quoted. If a boolean is given it will be integer cast as condition. Null will return 1 = 1.

Results of this method are stored in a memory cache. This improves performance, but because the method uses a simple hashing algorithm it can infrequently have collisions. Setting DboSource::$cacheMethods to false will disable the memory cache.

Parameters:
  • mixed $conditions required

    Array or string of conditions, or any value.

  • boolean $quoteValues optional true

    If true, values should be quoted

  • boolean $where optional true

    If true, "WHERE " will be prepended to the return value

  • Model $model optional NULL

    A reference to the Model instance making the query

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2071
Return

string SQL fragment

Access

public

__construct

top

Constructor

Parameters:
  • array $config optional NULL

    Array of configuration information for the Datasource.

  • boolean $autoConnect optional true

    Whether or not the datasource should automatically connect.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 133
Access

public

_constructVirtualFields

top

Converts model virtual fields into sql expressions to be fetched later

Parameters:
  • Model $model required

  • string $alias required

    Alias tablename

  • mixed $fields required

    virtual fields to be used on query

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1926
Return

array

create

top

The "C" in CRUD

Creates new records in the database.

Parameters:
  • Model $model required

    Model object that the record is for.

  • array $fields optional NULL

    An array of field names to insert. If null, $model->data will be used to generate field names.

  • array $values optional NULL

    An array of values with keys matching the fields. If null, $model->data will be used to generate values.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 727
Return

boolean Success

Access

public

createSchema

top

Generate a database-native schema for the given Schema object

Parameters:
  • object $schema required

    An instance of a subclass of CakeSchema

  • string $tableName optional NULL

    Optional. If specified only the table name given will be generated. Otherwise, all tables defined in the schema are generated.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2630
Return

string

Access

public

defaultConditions

top

Creates a default set of conditions from the model if $conditions is null/empty. If conditions are supplied then they will be returned. If a model doesn't exist and no conditions were provided either null or false will be returned based on what was input.

Parameters:
  • object $model required

  • mixed $conditions required

    Array of conditions, conditions string, null or false. If an array of conditions, or string conditions those conditions will be returned. With other values the model's existance will be checked. If the model doesn't exist a null or false will be returned depending on the input value.

  • boolean $useAlias optional true

    Use model aliases rather than table names when generating conditions

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1865
Return

mixed Either null, false, $conditions or an array of default conditions to use.

See

DboSource::update()

DboSource::conditions()

Access

public

delete

top

Generates and executes an SQL DELETE statement. For databases that do not support aliases in UPDATE queries.

Parameters:
  • Model $model required

  • mixed $conditions optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1652
Return

boolean Success

Access

public

describe

top

Returns a Model description (metadata) or null if none found.

Parameters:
  • Model $model required

Method defined in:
cake/libs/model/datasources/datasource.php on line 269
Return

array Array of Metadata for the $model

Access

public

__destruct

top

Closes the current datasource.

Method defined in:
cake/libs/model/datasources/datasource.php on line 592
Return

void

Access

public

dispatchMethod

top

Calls a method on this object with the given parameters. Provides an OO wrapper for call_user_func_array

Parameters:
  • string $method required

    Name of the method to call

  • array $params optional array ( )

    Parameter list to use when calling $method

Method defined in:
cake/libs/object.php on line 107
Return

mixed Returns the result of the method call

Access

public

dropSchema

top

Generate a "drop table" statement for the given Schema object

Parameters:
  • object $schema required

    An instance of a subclass of CakeSchema

  • string $table optional NULL

    Optional. If specified only the table name given will be generated. Otherwise, all tables defined in the schema are generated.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2692
Return

string

Access

public

enabled

top

Check whether the conditions for the Datasource being available are satisfied. Often used from connect() to check for support before establishing a connection.

Method defined in:
cake/libs/model/datasources/datasource.php on line 428
Return

boolean Whether or not the Datasources conditions for use are met.

Access

public

execute

top

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 Configure::read('debug') is set, the log is shown all the time, else it is only shown on errors.

Options

  • stats - Collect meta data stats for this query. Stats include time take, rows affected, any errors, and number of rows returned. Defaults to true.
  • log - Whether or not the query should be logged to the memory log.

Parameters:
  • string $sql required

  • array $options optional array ( )

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 248
Return

mixed Resource or object representing the result set, or false on failure

Access

public

expression

top

Returns an object to represent a database expression in a query

Parameters:
  • string $expression required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 213
Return

object An object representing a database expression to be used in a query

Access

public

fetchAll

top

Returns an array of all result rows for a given SQL query. Returns false if no rows matched.

Parameters:
  • string $sql required

    SQL statement

  • boolean $cache optional true

    Enables returning/storing cached query results

  • $modelName optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 403
Return

array Array of resultset rows, or false if no rows matched

Access

public

fetchAssociated

top

A more efficient way to fetch associations. Woohoo!

Parameters:
  • model $model required

    Primary model object

  • string $query required

    Association query

  • array $ids required

    Array of IDs of associated records

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1075
Return

array Association results

Access

public

fetchRow

top

Returns a row from current resultset as an array

Parameters:
  • $sql optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 375
Return

array The fetched row as an array

Access

public

fetchVirtualField

top

Modifies $result array to place virtual fields in model entry where they belongs to

Parameters:
  • $result required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 442
Return

void

field

top

Returns a single field of the first of query results for a given SQL query, or false if empty.

Parameters:
  • string $name required

    Name of the field

  • string $sql required

    SQL query

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 473
Return

mixed Value of field read.

Access

public

fields

top

Generates the fields list of an SQL query.

Parameters:
  • Model $model required

  • string $alias optional NULL

    Alias tablename

  • mixed $fields optional array ( )

    Alias tablename

  • boolean $quote optional true

    If false, returns fields array unquoted

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1946
Return

array

Access

public

flushMethodCache

top

Empties the method caches. These caches are used by DboSource::name() and DboSource::conditions()

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 488
Return

void

fullTableName

top

Gets full table name including prefix

Parameters:
  • mixed $model required

    Either a Model object or a string table name.

  • boolean $quote optional true

    Whether you want the table name quoted.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 700
Return

string Full quoted table name

Access

public

generateAssociationQuery

top

Generates an array representing a query or part of a query from a single model or two associated models

Parameters:
  • Model $model required

  • Model $linkModel required

  • string $type required

  • string $association required

  • array $assocData required

  • array $queryData required

  • boolean $external required

  • array $resultSet required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1217
Return

mixed

Access

public

getConstraint

top

Returns a conditions array for the constraint between two models

Parameters:
  • string $type required

    Association type

  • object $model required

    Model object

  • $linkModel required

  • $alias required

  • $assoc required

  • $alias2 optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1383
Return

array Conditions array defining the constraint between $model and $association

Access

public

_getJoins

top

Returns an array of SQL JOIN fragments from a model's associations

Parameters:
  • object $model required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1725
Return

array

Access

protected

getLog

top

Get the query log as an array.

Parameters:
  • boolean $sorted optional false

    Get the queries sorted by time taken, defaults to false.

  • $clear optional true

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 607
Return

array Array of queries run as an array

Access

public

group

top

Create a GROUP BY SQL clause

Parameters:
  • string $group required

    Group By Condition

  • $model optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2463
Return

mixed string condition or null

Access

public

hasAny

top

Checks if the specified table contains any record matching specified SQL

Parameters:
  • $Model required

  • string $sql required

    SQL WHERE clause (condition only, not the "WHERE" part)

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2497
Return

boolean True if the table has a matching record, else false

Access

public

hasResult

top

Checks if the result is valid

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 596
Return

boolean True if the result is valid else false

Access

public

identifier

top

Returns an object to represent a database identifier in a query

Parameters:
  • string $identifier required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 199
Return

object An object representing a database identifier to be used in a query

Access

public

index

top

Returns an array of the indexes in given datasource name.

Parameters:
  • string $model required

    Name of model to inspect

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2617
Return

array Fields in table. Keys are column and unique

Access

public

insertMulti

top

Inserts multiple values into a table

Parameters:
  • string $table required

  • string $fields required

  • array $values required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2599
Access

protected

insertQueryData

top

Replaces {$cakeID$} and {$cakeForeignKey$} placeholders in query data.

Parameters:
  • string $query required

    Query string needing replacements done.

  • array $data required

    Array of data with values that will be inserted in placeholders.

  • string $association required

    Name of association model being replaced

  • unknown_type $assocData required

    Name of association model being replaced

  • Model $model required

    Instance of the model to replace $cakeID$

  • Model $linkModel required

    Instance of model to replace $cakeForeignKey$

  • array $stack required

    Instance of model to replace $cakeForeignKey$

Method defined in:
cake/libs/model/datasources/datasource.php on line 501
Return

string String of query data with placeholders replaced.

Access

public

Todo

Remove and refactor $assocData, ensure uses of the method have the param removed too.

introspectType

top

Guesses the data type of an array

Parameters:
  • string $value required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2877
Return

void

Access

public

isConnected

top

Checks if the source is connected to the database.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 586
Return

boolean True if the database is connected, else false

Access

public

isInterfaceSupported

top

Returns true if the DataSource supports the given interface (method)

Parameters:
  • string $interface required

    The name of the interface (method)

Method defined in:
cake/libs/model/datasources/datasource.php on line 439
Return

boolean True on success

Access

public

lastAffected

top

Returns the number of rows affected by last query.

Parameters:
  • unknown_type $source optional NULL

Method defined in:
cake/libs/model/datasources/datasource.php on line 416
Return

integer Number of rows affected by last query.

Access

public

lastInsertId

top

Returns the ID generated from the previous INSERT operation.

Parameters:
  • unknown_type $source optional NULL

Method defined in:
cake/libs/model/datasources/datasource.php on line 394
Return

mixed Last ID key generated in previous INSERT

Access

public

lastNumRows

top

Returns the number of rows returned by last operation.

Parameters:
  • unknown_type $source optional NULL

Method defined in:
cake/libs/model/datasources/datasource.php on line 405
Return

integer Number of rows returned by last operation

Access

public

length

top

Gets the length of a database-native column description, or null if no length

Parameters:
  • string $real required

    Real database-layer column type (i.e. "varchar(255)")

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2519
Return

mixed An integer or string representing the length of the column

Access

public

limit

top

Returns a limit statement in the correct format for the particular database.

Parameters:
  • integer $limit required

    Limit of results returned

  • integer $offset optional NULL

    Offset from which to start results

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2370
Return

string SQL limit/offset statement

Access

public

listSources

top

Caches/returns cached results for child instances

Parameters:
  • mixed $data optional NULL

Method defined in:
cake/libs/model/datasources/datasource.php on line 226
Return

array Array of sources available in this datasource.

Access

public

log

top

Convience method to write a message to CakeLog. See CakeLog::write() for more information on writing to logs.

Parameters:
  • string $msg required

    Log message

  • integer $type optional 2

    Error type constant. Defined in app/config/core.php.

Method defined in:
cake/libs/object.php on line 148
Return

boolean Success of log write

Access

public

logQuery

top

Log given SQL query.

Parameters:
  • string $sql required

    SQL statement

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 651
Todo

: Add hook to log errors instead of returning false

Access

public

_matchRecords

top

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 required

  • mixed $conditions optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1677
Return

array List of record IDs

Access

protected

__mergeHasMany

top

mergeHasMany - Merge the results of hasMany relations.

Parameters:
  • array $resultSet required

    Data to merge into

  • array $merge required

    Data to merge

  • string $association required

    Name of Model being Merged

  • object $model required

    Model being merged onto

  • object $linkModel required

    Model being merged

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1094
Return

void

name

top

Returns a quoted name of $data for use in an SQL statement. Strips fields out of SQL functions before quoting.

Results of this method are stored in a memory cache. This improves performance, but because the method uses a simple hashing algorithm it can infrequently have collisions. Setting DboSource::$cacheMethods to false will disable the memory cache.

Parameters:
Method defined in:
cake/libs/model/datasources/dbo_source.php on line 527
Return

string SQL field

Access

public

Object

top

A hack to support __construct() on PHP 4 Hint: descendant classes have no PHP4 class_name() constructors, so this constructor gets called first and calls the top-layer __construct() which (if present) should call parent::__construct()

Method defined in:
cake/libs/object.php on line 43
Return

Object

order

top

Returns an ORDER BY clause as a string.

Parameters:
  • $keys required

  • string $direction optional 'ASC'

    Direction (ASC or DESC)

  • object $model optional NULL

    model reference (used to look for virtual field)

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2396
Return

string ORDER BY clause

Access

public

_persist

top

Checks for a persistent class file, if found file is opened and true returned If file is not found a file is created and false returned If used in other locations of the model you should choose a unique name for the persistent file There are many uses for this method, see manual for examples

Parameters:
  • string $name required

    name of the class to persist

  • $return required

  • string $object required

    the object to persist

  • $type optional NULL

Method defined in:
cake/libs/object.php on line 218
Return

boolean Success

Access

protected

Todo

add examples to manual

_prepareUpdateFields

top

Quotes and prepares fields and values for an SQL UPDATE statement

Parameters:
  • Model $model required

  • array $fields required

  • boolean $quoteValues optional true

    If values should be quoted, or treated as SQL snippets

  • boolean $alias optional false

    Include the model alias in the field name

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1608
Return

array Fields and values, quoted and preparted

Access

protected

query

top

DataSource Query abstraction

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 278
Return

resource Result resource identifier.

Access

public

queryAssociation

top

Queries associations. Used to fetch results on recursive models.

Parameters:
  • Model $model required

    Primary Model object

  • Model $linkModel required

    Linked model that

  • string $type required

    Association type, one of the model association types ie. hasMany

  • unknown_type $association required

    Association type, one of the model association types ie. hasMany

  • unknown_type $assocData required

    Association type, one of the model association types ie. hasMany

  • array $queryData required

    Association type, one of the model association types ie. hasMany

  • boolean $external required

    Whether or not the association query is on an external datasource.

  • array $resultSet required

    Existing results

  • integer $recursive required

    Number of levels of association

  • array $stack required

    Number of levels of association

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 919

rawQuery

top

Executes given SQL statement.

Parameters:
  • string $sql required

    SQL statement

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 227
Return

boolean

Access

public

read

top

The "R" in CRUD

Reads record(s) from the database.

Parameters:
  • Model $model required

    A Model object that the query is for.

  • array $queryData optional array ( )

    An array of queryData information containing keys similar to Model::find()

  • integer $recursive optional NULL

    Number of levels of association

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 775
Return

mixed boolean false on error/failure. An array of results on success.

readTableParameters

top

Read additional table parameters

Parameters:
  • $name required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 2836
Return

array

Access

public

reconnect

top

Reconnects to database server with optional new settings

Parameters:
  • array $config optional array ( )

    An array defining the new configuration settings

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 156
Return

boolean True on success, false on failure

Access

public

renderJoinStatement

top

Renders a final SQL JOIN statement

Parameters:
  • array $data required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1480
Return

string

Access

public

renderStatement

top

Renders a final SQL statement by putting together the component parts in the correct order

Parameters:
  • string $type required

    type of query being run. e.g select, create, update, delete, schema, alter.

  • array $data required

    Array of data to insert into the query.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1493
Return

string Rendered SQL expression to be run.

Access

public

requestAction

top

Calls a controller's method from any location. Can be used to connect controllers together or tie plugins into a main application. requestAction can be used to return rendered views or fetch the return value from controller actions.

Parameters:
  • mixed $url required

    String or array-based url.

  • array $extra optional array ( )

    if array includes the key "return" it sets the AutoRender to true.

Method defined in:
cake/libs/object.php on line 80
Return

mixed Boolean true or false on success/failure, or contents of rendered action if 'return' is set in $extra.

Access

public

resolveKey

top

Returns a key formatted like a string Model.fieldname(i.e. Post.title, or Country.name)

Parameters:
  • unknown_type $model required

  • unknown_type $key required

  • unknown_type $assoc optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1892
Return

string

Access

public

rollback

top

Rollback a transaction

(i.e. if the database/model does not support transactions, or a transaction has not started).

Parameters:
  • model $model required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1842
Return

boolean True on success, false on fail

Access

public

_savePersistent

top

You should choose a unique name for the persistent file

There are many uses for this method, see manual for examples

Parameters:
  • string $name required

    name used for object to cache

  • object $object required

    the object to persist

Method defined in:
cake/libs/object.php on line 247
Return

boolean true on save, throws error if file can not be created

Access

protected

__scrubQueryData

top

Private helper method to remove query metadata in given data array.

Parameters:
  • array $data required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1909
Return

array

Access

public

_set

top

Allows setting of multiple properties of the object in a single line of code. Will only set properties that are part of a class declaration.

Parameters:
  • array $properties optional array ( )

    An associative array containing properties and corresponding values.

Method defined in:
cake/libs/object.php on line 166
Return

void

Access

protected

setConfig

top

Sets the configuration for the DataSource. Merges the $config information with the _baseConfig and the existing $config property.

Parameters:
  • array $config optional array ( )

    The configuration array

Method defined in:
cake/libs/model/datasources/datasource.php on line 455
Return

void

Access

public

showLog

top

Outputs the contents of the queries log. If in a non-CLI environment the sql_log element will be rendered and output. If in a CLI environment, a plain text log is generated.

Parameters:
  • boolean $sorted optional false

    Get the queries sorted by time taken, defaults to false.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 626
Return

void

showQuery

top

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 required

    Query to show information on.

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 676
Access

public

sources

top

Convenience method for DboSource::listSources(). Returns source names in lowercase.

Parameters:
  • boolean $reset optional false

    Whether or not the source list should be reset.

Method defined in:
cake/libs/model/datasources/datasource.php on line 255
Return

array Array of sources available in this datasource

Access

public

_stop

top

Stop execution of the current script. Wraps exit() making testing easier.

Parameters:
  • $status optional 0

Method defined in:
cake/libs/object.php on line 135
Return

void

Access

public

toString

top

Object-to-string conversion. Each class can override this method as necessary.

Method defined in:
cake/libs/object.php on line 64
Return

string The name of this class

Access

public

truncate

top

Deletes all the records in a table and resets the count of the auto-incrementing primary key, where applicable.

Parameters:
  • mixed $table required

    A string or model class representing the table to be truncated

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1795
Return

boolean SQL TRUNCATE TABLE statement, false if not applicable.

Access

public

update

top

Generates and executes an SQL UPDATE statement for given model, fields, and values. For databases that do not support aliases in UPDATE queries.

Parameters:
  • Model $model required

  • array $fields optional array ( )

  • array $values optional NULL

  • mixed $conditions optional NULL

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 1573
Return

boolean Success

Access

public

value

top

Prepares a value, or an array of values for database queries by quoting and escaping them.

Parameters:
  • mixed $data required

    A value or an array of values to prepare.

  • string $column optional NULL

    The column into which this data will be inserted

  • boolean $read optional true

    Value to be used in READ or WRITE context

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 173
Return

mixed Prepared value or array of values.

Access

public