DboSqlite Class Info:

Class Declaration:

class DboSqlite extends DboSource

File name:
cake/libs/model/datasources/dbo/dbo_sqlite.php
Description:

DBO implementation for the SQLite DBMS.

Long description for class

Class Inheritance

DboSource 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

    Base configuration settings for SQLite driver

  • __bypass boolean

    Bypass automatic adding of joined fields/associations.

  • 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

  • columns array

    SQLite column definition

  • _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

    Datasource Description

  • __descriptions array

    Holds references to descriptions loaded by the DataSource

  • endQuote string

    Closing quote 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

  • 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

  • _queryStats array

    Keeps the transaction statistics of CREATE/UPDATE/DELETE queries

  • _result array

    Result

  • _sources array

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

  • __sqlOps array

    The set of valid SQL operations usable in a WHERE statement

  • startQuote string

    Opening quote 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 2668
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 1791
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 2569
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/dbo_sqlite.php on line 487
Return

string

_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 2770
Return

string a built column with the field parameters added.

Access

public

buildIndex

top

Removes redundant primary key indexes, as they are handled in the column def of the key.

Parameters:
  • array $indexes required

  • string $table optional NULL

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 538
Return

string

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 1410
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 1436
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 2846
Return

array

Access

public

__cacheDescription

top

Cache the DataSource description

Parameters:
  • string $object required

    The name of the object (model) to cache

  • mixed $data optional NULL

    The description of the model, usually a string or array

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

mixed

Access

private

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 501
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 1738
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 2474
Return

void

Access

public

column

top

Converts database-layer column types to basic types

Parameters:
  • string $real required

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

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 379
Return

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

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 1808
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 2123
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.

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 2060
Return

string SQL fragment

Access

public

connect

top

Connects to the database using config['database'] as a filename.

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 126
Return

mixed

__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 130
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 1909
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 716
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 2619
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 1848
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 1637
Return

boolean Success

Access

public

describe

top

Returns an array of the fields in given table name.

Parameters:
  • $model required

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 221
Return

array Fields in table. Keys are name and type

__destruct

top

Closes the current datasource.

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

void

Access

public

disconnect

top

Disconnects from database.

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 155
Return

boolean True if the database could be disconnected, else false

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 2681
Return

string

Access

public

enabled

top

Check that SQLite is enabled/installed

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 147
Return

boolean

execute

top

Overrides DboSource::execute() to correctly handle query statistics

Parameters:
  • string $sql required

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 183
Return

unknown

_execute

top

Executes given SQL statement.

Parameters:
  • string $sql required

    SQL statement

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 167
Return

resource Result resource identifier

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 210
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 400
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 1060
Return

array Association results

Access

public

fetchResult

top

Fetches the next row from the current result set

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 438
Return

unknown

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 372
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 439
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 470
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 1929
Return

array

Access

public

__filterResults

top

Passes association results thru afterFind filters of corresponding model

Parameters:
  • array $results required

    Reference of resultset to be filtered

  • object $model required

    Instance of model to operate against

  • array $filtered optional array ( )

    List of classes already filtered, to be skipped

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

array Array of results that have been filtered through $model->afterFind

Access

private

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 485
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 689
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 1202
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 1368
Return

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

Access

public

getEncoding

top

Gets the database encoding

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 527
Return

string The database encoding

_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 1708
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 596
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 2452
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 2486
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 585
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 196
Return

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

Access

public

index

top

Overrides DboSource::index to handle SQLite indexe introspection Returns an array of the indexes in given table name.

Parameters:
  • string $model required

    Name of model to inspect

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 569
Return

array Fields in table. Keys are column and unique

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 2588
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 500
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 2866
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 575
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 438
Return

boolean True on success

Access

public

lastAffected

top

Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 340
Return

integer Number of affected rows

lastError

top

Returns a formatted error message from previous database operation.

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 327
Return

string Error message

lastInsertId

top

Returns the ID generated from the previous INSERT operation.

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 369
Return

int

lastNumRows

top

Returns number of rows in previous resultset. If no previous resultset exists, this returns false.

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 357
Return

integer Number of rows in resultset

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 2508
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/dbo_sqlite.php on line 465
Return

string SQL limit/offset statement

listSources

top

Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 194
Return

array Array of tablenames in the database

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 640
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 1662
Return

array List of record IDs

Access

protected

__mergeAssociation

top

Enter description here...

Parameters:
  • unknown_type $data required

  • unknown_type $merge required

  • unknown_type $association required

  • unknown_type $type required

  • boolean $selfJoin optional false

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

private

__mergeConditions

top

Merges a mixed set of string/array conditions

Parameters:
  • $query required

  • $assoc required

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

array

Access

private

__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 1079
Return

void

name

top

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

Parameters:
  • string $data required

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 519
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

__openPersistent

top

Open the persistent class file for reading Used by Object::_persist()

Parameters:
  • string $name required

    Name of persisted class

  • string $type optional NULL

    Type of persistance (e.g: registry)

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

void

Access

private

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 2385
Return

string ORDER BY clause

Access

public

__parseKey

top

Extracts a Model.field identifier and an SQL condition operator from a string, formats and inserts values, and composes them into an SQL snippet.

Parameters:
  • Model $model required

    Model object initiating the query

  • string $key required

    An SQL key snippet containing a field and optional SQL operator

  • mixed $value required

    The value(s) to be inserted in the string

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

string

Access

private

_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 1593
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 275
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 904

__quoteFields

top

Quotes Model.fields

Parameters:
  • string $conditions required

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

string or false if no match

Access

private

__quoteMatchedField

top

Auxiliary function to quote matches Model.fields from a preg_replace_callback call

Parameters:
  • $match required

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

string quoted strig

Access

private

rawQuery

top

Executes given SQL statement.

Parameters:
  • string $sql required

    SQL statement

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 224
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 764
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 2825
Return

array

Access

public

reconnect

top

Reconnects to database server with optional new settings

Parameters:
  • array $config optional NULL

    An array defining the new configuration settings

Method defined in:
cake/libs/model/datasources/dbo_source.php on line 153
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 1465
Return

string

Access

public

renderStatement

top

Overrides DboSource::renderStatement to handle schema generation with SQLite-style indexes

Parameters:
  • string $type required

  • array $data required

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 606
Return

string

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 1875
Return

string

Access

public

resultSet

top

Enter description here...

Parameters:
  • unknown_type $results required

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 414

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 1825
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 1892
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 454
Return

void

Access

public

setEncoding

top

Sets the database encoding

Parameters:
  • string $enc required

    Database encoding

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 515

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 615
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 665
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/dbo_sqlite.php on line 318
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.

Parameters:
  • Model $model required

  • array $fields optional array ( )

  • array $values optional NULL

  • mixed $conditions optional NULL

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 295
Return

array

value

top

Returns a quoted and escaped string of $data for use in an SQL statement.

Parameters:
  • string $data required

    String to be prepared for use in an SQL statement

  • $column optional NULL

  • $safe optional false

Method defined in:
cake/libs/model/datasources/dbo/dbo_sqlite.php on line 258
Return

string Quoted and escaped