[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/dao/ -> model.class.php (sommaire)

\defgroup DAO DAO stands for "Data Access Object" and represents a data model according to the MVC architecture.

Poids: 490 lignes (16 kb)
Inclus ou requis:0 fois
Référencé: 15 fois
Nécessite: 0 fichiers

Définit 1 class

Model:: (13 méthodes):
  Model()
  Execute()
  DbError()
  get()
  getAll()
  getSearchConditions()
  getMany()
  add()
  update()
  delete()
  getPrefix()
  getNumItems()
  _initializeDb()


Classe: Model  - X-Ref

\ingroup DAO

This class provides all the classes extending it with a database
connection so that classes don't have to
worry about that. Later on, the Model classes will be used by
the corresponding action object.
Model( $cacheEnabled = DATA_CACHE_ENABLED )   X-Ref
Basic constructor, setting up a cache for all classes extending Model

param: useCache Some object might not need a cache and can disable it by passing false

Execute( $query, $page = DEFAULT_PAGING_ENABLED, $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )   X-Ref
executes a query with certain limits (for paging, for ex.)

param: query The query to be executed
param: page enable paging, pass page number or -1 to disable paging
param: itemsPerPage number of items on a page
return: A ResultSet or false if errors

DbError( $driverError = false )   X-Ref
Returns the last error message from the database.

param: driverError Set this field to true if interested in getting the error message as reported by
return: A string containing the error message

get( $field, $value, $cacheId, $caches = null )   X-Ref
Retrieves one single row/object from the database

param: field
param: value
param: cacheId
param: caches
return:

getAll( $key, $cacheId, $itemCaches = null, $sorting = Array()   X-Ref
Retrieves all the rows from the given table

param: key
param: cacheId
param: itemCaches
param: sorting
param: searchTerms
param: page
param: itemsPerPage
return:

getSearchConditions( $searchTerms )   X-Ref
This method must be reimplemented by child classes wishing to provide
search functionalities

param: searchTerms
return: search string to be used in an SQL query

getMany( $key, $value, $cacheId, $itemCaches = null, $sorting = Array()   X-Ref
Retrieves a set of rows of the given table using the given (simple) conditions.

param: key
param: value
param: cacheId
param: itemCaches
param: sorting
param: searchTerms
param: page
param: itemsPerPage
return:

add( &$dbObject, $cacheId = null )   X-Ref
Adds a row to the current table

param: dbObject
param: cacheId
return: True if successful or false if error

update( &$dbObject )   X-Ref
Updates an object/row in the database

param: dbObject
return: True if successful or false if error

delete( $field, $value )   X-Ref
Deletes a row from the database, using the field and value parameters as the condition

param: field
param: value
return: True if successful or false otherwise

getPrefix()   X-Ref
returns the current database prefix

return: the current database prefix

getNumItems( $table, $cond = "", $pk = "id" )   X-Ref
retrieves the number of records in a table given an optional condition

param: table
param: cond
return: the number of items or 0 if none or error

_initializeDb()   X-Ref
Initialize the Db and set the table-prefix.




Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics