Index
Base class for data engines
Provides a common interface to access any data requested by TIP.
Start a transaction
If a transaction is yet started, simply returns true without starting a new transaction (nested transactions are not allowed).
End a transaction
End the current transaction. If there's no active transaction, raise an error and return false.
The transaction is really ended when the last started transaction is closed. For instance, if you call startTransaction() twice and endTransaction() once, the data will be never committed.
The error flag indicates if the transaction must be rolled back ($commit = true) of committed ($commit = false).
Prepare names for a query
Prepares one or more identifiers to be inserted in a query. The TIP_Mysql::preparedName() method, for example, backticks $name if $name does not start yet with a backtick.
If $name is an array, the preparedName() process is applied recursively for every item and a comma separated string of prepared names is returned.
The $domain value is a engine depended feature to identify the context where $name is significant. In SQL based engines, for instance, it is the table name.
Prepare values for a query
Prepares one or more values to be inserted in a query. The TIP_Mysql engine, for instance, escapes the values throught mysql_real_escape_string(). Also, if $value is null, 'NULL' is returned.
If $value is an array, a comma separated string of prepared values is returned.
Perform a query
This is the core function of a database engine. Any list of arguments should be accepted, usually imploding their string representation using a space as glue.
Fill the fields structure
Fills the $_fields internal property of the TIP_Data object: read the TIP_Data documentation for further details.
Read data
Gets the rows that satisfy the $filter conditions. Only the fields specified by $data->_fieldset must be read. If this fieldset is null, all the fields are assumed.
The result must be an empty array if there's no matching rows. The type of the field values is not important: the resulting array will be casted to the proper type in the TIP_Data object.
Insert new rows
Inserts new rows. The autoincrement value of the last row is returned. If the primary keys are specified in $rows and a row with any primary key yet exists, this function must fail.
The rows must be homogeneus: if the first row has five fields, all the other rows must have the same five fields (obviously, with different values).
Notice $rows can be an empty array, in which case a new empty row must be added without errors. In this case, the row must be filled with its default values.
Update data
Updates the rows that match the $filter conditions using the new $row contents. To leave the fields untouched, simply do not specify these fields in $row.
Delete data
Removes the rows that match the $filter conditions.
Dump a whole database content
Start a transaction
TIP_Data_Enginewas last modified by TiP on Mon 25 May 2009 06:22:25 PM CEST