![]() |
OPiQuotations
v.03.00.00 — April 5, 2019
|
Public Member Functions | |
| __construct ($host, $user, $password, $db_name) | |
| Open the connection to the database $db_name. More... | |
| __destruct () | |
| Close the connection to the database. More... | |
| is_connected () | |
| If connection is ok then return true else return false. More... | |
| escape ($s) | |
| Return the string with its special characters escaped for use in a SQL statement. More... | |
| list_to_assoc ($table) | |
| Return a associative table id => array(name, number of use) of elements of the table. More... | |
| nb ($is_maxim=null) | |
| Return the numbers of quotations and/or maxims. More... | |
| query_insert ($query) | |
| Execute the MySQL query INSERT. More... | |
| query_quotations ($where='', $order='', $limit=null, $offset=null) | |
| Return an array with all OPiQuotation that match with the SQL $where condition in order specified by $order. More... | |
| query_quotations_nb ($where='') | |
| Return the number of all OPiQuotation that match with the SQL $where condition. More... | |
| to_string ($x) | |
| Return escaped and quoted $x (converted to string). More... | |
| to_string_or_NULL ($x) | |
| If $x === null then return 'NULL' else return to_string($x). More... | |
Protected Attributes | |
| $connect | |
| Connection to the MySQL database. More... | |
| OPiQuotations\Db::__construct | ( | $host, | |
| $user, | |||
| $password, | |||
| $db_name | |||
| ) |
Open the connection to the database $db_name.
If connection fails then write a message in the errors log file.
See is_connected() function.
| string | $host | Host name or IP address of the server |
| string | $user | MySQL user name |
| string | $password | MySQL password |
| string | $db_name | Name of the database |
Definition at line 43 of file Db.inc.
References OPiQuotations\to_log().
| OPiQuotations\Db::__destruct | ( | ) |
| OPiQuotations\Db::escape | ( | $s | ) |
| OPiQuotations\Db::is_connected | ( | ) |
| OPiQuotations\Db::list_to_assoc | ( | $table | ) |
Return a associative table id => array(name, number of use) of elements of the table.
| string | $table | (must be 'author', 'nation', 'subject' or 'work') |
Definition at line 126 of file Db.inc.
References OPiQuotations\Db\list_to_assoc(), and OPiQuotations\to_log().
Referenced by OPiQuotations\Db\list_to_assoc().
| OPiQuotations\Db::nb | ( | $is_maxim = null | ) |
Return the numbers of quotations and/or maxims.
If $is_maxim === null then return the numbers of quotations/maxims,
if $is_maxim === false then return the numbers of quotations,
if $is_maxim === true then return the numbers of maxims.
| null | bool | $is_maxim |
Definition at line 192 of file Db.inc.
References $result, and OPiQuotations\to_log().
| OPiQuotations\Db::query_insert | ( | $query | ) |
Execute the MySQL query INSERT.
If insertion is ok then return true, else return false.
| string | $query | Valid MySQL query |
Definition at line 245 of file Db.inc.
References OPiQuotations\Db\query_insert(), and OPiQuotations\to_log().
Referenced by OPiQuotations\Db\query_insert().
| OPiQuotations\Db::query_quotations | ( | $where = '', |
|
$order = '', |
|||
$limit = null, |
|||
$offset = null |
|||
| ) |
Return an array with all OPiQuotation that match with the SQL $where condition in order specified by $order.
If $limit is not null then return only $limit OPiQuotation.
If $limit and $offset are not null then return only $limit OPiQuotation from $offset.
| string | $where | Valid WHERE clause of the SELECT MySQL command used (see http://dev.mysql.com/doc/refman/5.1/en/select.html ) |
| string | $order | Valid ORDER clause of the SELECT MySQL command used (see http://dev.mysql.com/doc/refman/5.1/en/select.html ) |
| null | int | $limit | (must be >= 0) |
| null | int | $offset | (must be >= 0) |
Definition at line 295 of file Db.inc.
References $id, $quot, $result, $selection, and OPiQuotations\to_log().
Referenced by OPiQuotations\Db\query_quotations_nb().
| OPiQuotations\Db::query_quotations_nb | ( | $where = '' | ) |
Return the number of all OPiQuotation that match with the SQL $where condition.
| string | $where | Valid WHERE clause of the SELECT MySQL command used (see http://dev.mysql.com/doc/refman/5.1/en/select.html ) |
Definition at line 468 of file Db.inc.
References OPiQuotations\Db\query_quotations(), and OPiQuotations\to_log().
| OPiQuotations\Db::to_string | ( | $x | ) |
| OPiQuotations\Db::to_string_or_NULL | ( | $x | ) |
|
protected |
1.8.13