Abstract class db classes
Definition at line 10 of file db/abstract.class.php.
◆ __sleep()
◆ _beginTransaction()
◆ _commit()
◆ _connect()
Creates a connection to the database.
◆ _rollBack()
◆ afterInit()
Call just after the configuration initialisation
Definition at line 40 of file object.class.php.
◆ beforeInit()
Call just before the configuration initialisation
Definition at line 35 of file object.class.php.
◆ beginTransaction()
Leave autocommit mode and begin a transaction.
- Returns
- bool True
Definition at line 58 of file db/abstract.class.php.
◆ closeConnection()
Force the connection to close.
- Returns
- void
◆ commit()
Commit a transaction and return to autocommit mode.
- Returns
- bool True
Definition at line 69 of file db/abstract.class.php.
◆ count()
◆ delete()
Deletes table rows based on a WHERE clause.
- Parameters
-
array | $prm | The parameter for the replace query :
- string table (required) : The table to work in
- db_where|array|string where : The where clause. If array, they are used with AND. (default: none)
- string whereOp : The operator for the where clause if it's an array (default: AND)
- bool optim : Make an optimization after the delete (default: true)
|
- Returns
- int Deleted rows
Definition at line 180 of file db/abstract.class.php.
◆ fetchAssoc()
Fetches all SQL result rows as an associative array. Same parameter as select.
The first column is the key, the entire row array is the value. You should construct the query to be sure that the first column contains unique values, or else rows with duplicate values in the first column will overwrite previous data.
- Parameters
-
- Returns
- array
- See also
- select
Definition at line 487 of file db/abstract.class.php.
◆ fetchPairs()
Fetches all SQL result rows as an array of key-value pairs.
The first column is the key, the second column is the value.
- Parameters
-
array | $prm, | same as select. |
- Returns
- array
- See also
- select
Definition at line 502 of file db/abstract.class.php.
◆ fetchRow()
Fetches the first row of the SQL result. Uses the current fetchMode for the adapter.
- Parameters
-
array | $prm, | same as select. |
- Returns
- array
- See also
- select
Definition at line 515 of file db/abstract.class.php.
◆ fields()
Returns the fields
- Parameters
-
- Returns
- array
◆ getAttr()
Get an attribute
- Parameters
-
string | $name | Attribute name |
- Returns
- mixed|null The attribute or null if not set
Definition at line 48 of file object.class.php.
◆ getCache()
◆ getCfg()
Get the configuration object
- Returns
- config
Definition at line 67 of file object.class.php.
◆ getConnection()
Returns the connection object, ressource. Initialize the connection if need.
- Returns
- object|resource|null
Definition at line 34 of file db/abstract.class.php.
◆ getFetchMode()
◆ getI18nTable()
Get the i18n tablename
- Parameters
-
- Returns
- string|null The i18n tablename or null if not found
Definition at line 594 of file db/abstract.class.php.
◆ getInstanceCfg()
Get the configuration parameter used to create this object
- Returns
- string|array
Definition at line 24 of file db/abstract.class.php.
◆ getTables()
getTables |
( |
|
$unPrefix = true | ) |
|
|
abstract |
Abstract Methods Returns a list of the tables in the database.
- Parameters
-
boolean | $unPrefix | Indicate if the table name shold remove paramettred prefix |
- Returns
- array
◆ getTablesWith()
getTablesWith |
( |
array |
$prm | ) |
|
Returns a list of the tables with the parameters provided
- Parameters
-
array | $prm | The parameters for the search:
- string start
- string contains
- string end
|
- Returns
- array
Definition at line 570 of file db/abstract.class.php.
◆ getWhere()
getWhere |
( |
array |
$prm = array() | ) |
|
◆ insert()
Insert on the database
- Parameters
-
array | $prm | The parameter for the insert query :
- string table (required) : The table to work in
- array values (required) : The values to insert. The key are the identifier
|
- Returns
- mixed the inserted id
Definition at line 94 of file db/abstract.class.php.
◆ lastInsertId()
Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.
- Returns
- string
◆ makeWhere()
makeWhere |
( |
|
$where, |
|
|
|
$whereOp = 'AND' , |
|
|
|
$incWhere = true |
|
) |
| |
Make a where clause from a where parameter (select, update or delete)
- Parameters
-
string | array | $where | |
string | $whereOp | Operator (AND or OR) |
bool | $incWhere | Indicates if the WHERE keywords should be included at the beginning |
- Returns
- null|string the where string, starting with WHERE
Definition at line 210 of file db/abstract.class.php.
◆ optimize()
◆ prefixTable()
Add a prefix that was previsouly removed for a table name
- Parameters
-
- Returns
- string Table name with it's prefix, if existing
◆ prepare()
Prepare a statement and return a PDOStatement.
- Parameters
-
string | Zend_Db_Select | $sql | SQL query |
- Returns
- PDOStatement
◆ query()
query |
( |
|
$sql, |
|
|
array |
$bind = array() |
|
) |
| |
Prepare and execute a query, with binding if provided
- Parameters
-
string | $sql | The query to execute |
- Returns
- PDOStatement
Definition at line 45 of file db/abstract.class.php.
◆ quoteIdentifier()
quoteIdentifier |
( |
|
$ident | ) |
|
Quotes an identifier.
- Parameters
-
string | $ident | The identifier. |
- Returns
- string The quoted identifier.
Definition at line 527 of file db/abstract.class.php.
◆ quoteValue()
◆ replace()
Replace on the database
- Parameters
-
array | $prm | The parameter for the replace query :
- string table (required) : The table to work in
- array values (required) : The values to replace. The key are the identifier
|
- Returns
- mixed the inserted id
Definition at line 120 of file db/abstract.class.php.
◆ rollBack()
Roll back a transaction and return to autocommit mode.
- Returns
- bool True
Definition at line 80 of file db/abstract.class.php.
◆ select()
Create a Select Query
- Parameters
-
array | string | $prm | Query as string or array: The parameter for the select query ( |
- See also
- selectQuery) and plus:
- int result : The result type MYSQL_ASSOC, MYSQL_NUM or MYSQL_BOTH (default: MYSQL_BOTH)
- Returns
- array Numeric array. Each line is one result
Definition at line 422 of file db/abstract.class.php.
◆ selectQuery()
selectQuery |
( |
array |
$prm | ) |
|
Create a Select Query
- Parameters
-
array | $prm | The parameter for the select query :
- array|string fields : The fields to select (default: *)
- string table (required) : The table to work in
- string moreTables : More table to select (string or array, if array, keys will be used as alias if non numeric)
- array join : tables to join. Keys are:
- string table (required) : table to join
- string dir: how to join (default: 'left')
- string on: on Clause to join the table (default: 1)
- string alias: table alias (default: none)
- array bind : Data to bind
- bool bindData : Bind the data inside the query
- db_where|array|string where : The where clause. If array, they are used with AND. (default: none)
- string whereOp : The operator for the where clause if it's an array (default: AND)
- string order : The order clause (default: none)
- int start : The select start (default: 0)
- int nb : The select limit (default: unlimited)
- string group : The group clause (default: none)
- string groupAfter : The group clause to be done after everything else (useful for order grouping queries) (default: none)
- string having : The having clause (default: none)
|
- Returns
- string The select query
- Exceptions
-
Definition at line 274 of file db/abstract.class.php.
◆ setAttr()
setAttr |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
|
inherited |
Set an attribute
- Parameters
-
string | $name | Attribute name |
mixed | $value | Attribute value |
Definition at line 58 of file object.class.php.
◆ setFetchMode()
◆ tableAlias()
tableAlias |
( |
|
$query, |
|
|
array |
$tblAlias |
|
) |
| |
|
protected |
Apply the table alias to a query
- Parameters
-
string | $query | The query |
array | $tblAlias | The alias (keys: tablenames, values: aliases) |
- Returns
- string The query with the aliases applied
Definition at line 397 of file db/abstract.class.php.
◆ update()
Update on the database
- Parameters
-
array | $prm | The parameter for the replace query :
- string table (required) : The table to work in
- array values (required) : The values to update. A string index array: index are the field
- db_where|array|string where : The where clause. If array, they are used with AND. (default: none)
- string whereOp : The operator for the where clause if it's an array (default: AND)
|
- Returns
- int Affected rows (Can return 0 if no change)
- Exceptions
-
Definition at line 149 of file db/abstract.class.php.
◆ $cfg
◆ $connection
The documentation for this class was generated from the following file: