[ Index ]
 

Code source de CakePHP 1.1.13.4450

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/cake/libs/model/datasources/ -> dbo_source.php (sommaire)

Short description for file. Long description for file

Copyright: Copyright 2005-2007, Cake Software Foundation, Inc.
License: http://www.opensource.org/licenses/mit-license.php The MIT License
Version: $Revision: 4424 $
Poids: 1591 lignes (45 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

DboSource:: (41 méthodes):
  __construct()
  reconnect()
  value()
  listSources()
  sources()
  query()
  rawQuery()
  execute()
  fetchRow()
  fetchArray()
  one()
  fetchAll()
  field()
  isConnected()
  showLog()
  logQuery()
  showQuery()
  fullTableName()
  create()
  read()
  __filterResults()
  queryAssociation()
  __mergeAssociation()
  generateSelfAssociationQuery()
  generateAssociationQuery()
  __mergeConditions()
  update()
  delete()
  resolveKey()
  getColumnType()
  __scrubQueryData()
  fields()
  conditions()
  conditionKeysToString()
  limit()
  order()
  close()
  buildSchemaQuery()
  __destruct()
  hasAny()
  boolean()


Classe: DboSource  - X-Ref

DboSource

Creates DBO-descendant objects from a given db connection configuration

__construct($config = null)   X-Ref
Constructor


reconnect($config = null)   X-Ref
Reconnects to database server with optional new settings

param: array $config An array defining the new configuration settings
return: boolean True on success, false on failure

value($data, $column = null)   X-Ref
Prepares a value, or an array of values for database queries by quoting and escaping them.

param: mixed $data A value or an array of values to prepare.
return: mixed Prepared value or array of values.

listSources($data = null)   X-Ref
Caches/returns cached results for child instances

return: array

sources()   X-Ref
Convenience method for DboSource::listSources().

return: array

query()   X-Ref
SQL Query abstraction

return: resource Result resource identifier

rawQuery($sql)   X-Ref
Executes given SQL statement.

param: string $sql SQL statement
return: unknown

execute($sql)   X-Ref
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.

param: string $sql
return: unknown

fetchRow($assoc = false)   X-Ref
Returns a row from given resultset as an array .

param: bool $assoc Associative array only, or both?
return: array The fetched row as an array

fetchArray($assoc = false)   X-Ref
Returns a single row of results from the _last_ SQL query.

param: resource $res
return: array A single row of results

one($sql)   X-Ref
Returns a single row of results for a _given_ SQL query.

param: string $sql SQL statement
return: array A single row of results

fetchAll($sql, $cache = true, $modelName = null)   X-Ref
Returns an array of all result rows for a given SQL query.
Returns false if no rows matched.

param: string $sql SQL statement
param: boolean $cache Enables returning/storing cached query results
return: array Array of resultset rows, or false if no rows matched

field($name, $sql)   X-Ref
Returns a single field of the first of query results for a given SQL query, or false if empty.

param: string $name Name of the field
param: string $sql SQL query
return: unknown

isConnected()   X-Ref
Checks if it's connected to the database

return: boolean True if the database is connected, else false

showLog($sorted = false)   X-Ref
Outputs the contents of the queries log.

param: boolean $sorted

logQuery($sql)   X-Ref
Log given SQL query.

param: string $sql SQL statement

showQuery($sql)   X-Ref
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.

param: string $sql Query to show information on.

fullTableName($model, $quote = true)   X-Ref
Gets full table name including prefix

param: mixed $model
param: boolean $quote
return: string Full quoted table name

create(&$model, $fields = null, $values = null)   X-Ref
The "C" in CRUD

param: Model $model
param: array $fields
param: array $values
return: boolean Success

read(&$model, $queryData = array()   X-Ref
The "R" in CRUD

param: Model $model
param: array $queryData
param: integer $recursive Number of levels of association
return: unknown

__filterResults(&$results, &$model, $filtered = array()   X-Ref
Private method.  Passes association results thru afterFind filter of corresponding model

param: unknown_type $results
param: unknown_type $model
param: unknown_type $filtered
return: unknown

queryAssociation(&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive, $stack)   X-Ref
Enter description here...

param: Model $model
param: unknown_type $linkModel
param: string $type Association type
param: unknown_type $association
param: unknown_type $assocData
param: unknown_type $queryData
param: unknown_type $external
param: unknown_type $resultSet
param: integer $recursive Number of levels of association
param: array $stack

__mergeAssociation(&$data, $merge, $association, $type)   X-Ref
Enter description here...

param: unknown_type $data
param: unknown_type $merge
param: unknown_type $association
param: unknown_type $type

generateSelfAssociationQuery(&$model, &$linkModel, $type, $association = null, $assocData = array()   X-Ref
Enter description here...

param: unknown_type $model
param: unknown_type $linkModel
param: unknown_type $type
param: unknown_type $association
param: unknown_type $assocData
param: unknown_type $queryData
param: unknown_type $external
param: unknown_type $resultSet
return: unknown

generateAssociationQuery(&$model, &$linkModel, $type, $association = null, $assocData = array()   X-Ref
Enter description here...

param: Model $model
param: unknown_type $linkModel
param: unknown_type $type
param: unknown_type $association
param: unknown_type $assocData
param: unknown_type $queryData
param: unknown_type $external
param: unknown_type $resultSet
return: unknown

__mergeConditions(&$queryData, $assocData)   X-Ref
Private method

return: array

update(&$model, $fields = array()   X-Ref
Generates and executes an SQL UPDATE statement for given model, fields, and values.

param: Model $model
param: array $fields
param: array $values
return: array

delete(&$model, $id = null)   X-Ref
Generates and executes an SQL DELETE statement for given id on given model.

param: Model $model
param: mixed $id Primary key id number to remove.
return: boolean Success

resolveKey($model, $key, $assoc = null)   X-Ref
Returns a key formatted like a string Model.fieldname(i.e. Post.title, or Country.name)

param: unknown_type $model
param: unknown_type $key
param: unknown_type $assoc
return: string

getColumnType(&$model, $field)   X-Ref
Returns the column type of a given

param: Model $model
param: string $field

__scrubQueryData(&$data)   X-Ref
Private helper method to remove query metadata in given data array.

param: array $data

fields(&$model, $alias, $fields)   X-Ref
Generates the fields list of an SQL query.

param: Model $model
param: string $alias Alias tablename
param: mixed $fields
return: array

conditions($conditions)   X-Ref
Creates a WHERE clause by parsing given conditions data.

param: mixed $conditions Array or string of conditions
return: string SQL fragment

conditionKeysToString($conditions)   X-Ref
Pas de description

limit($limit, $offset = null)   X-Ref
Returns a limit statement in the correct format for the particular database.

param: int $limit Limit of results returned
param: int $offset Offset from which to start results
return: string SQL limit/offset statement

order($keys, $direction = 'ASC')   X-Ref
Returns an ORDER BY clause as a string.

param: string $key Field reference, as a key (i.e. Post.title)
param: string $direction Direction (ASC or DESC)
return: string ORDER BY clause

close()   X-Ref
Disconnects database, kills the connection and says the connection is closed,
and if DEBUG is turned on, the log for this object is shown.


buildSchemaQuery($schema)   X-Ref
To-be-overridden in subclasses.


__destruct()   X-Ref
Destructor. Closes connection to the database.


hasAny($model, $sql)   X-Ref
Checks if the specified table contains any record matching specified SQL

param: Model $model Model to search
param: string $sql SQL WHERE clause (condition only, not the "WHERE" part)
return: boolean True if the table has a matching record, else false

boolean($data)   X-Ref
Translates between PHP boolean values and Database (faked) boolean values

param: mixed $data Value to be translated
return: mixed Converted boolean value



Généré le : Sun Feb 25 19:27:47 2007 par Balluche grâce à PHPXref 0.7