|
@@ -47,7 +47,7 @@ discard block |
|
|
block discarded – undo |
47
|
47
|
* @param string $password This should be the password for the chosen database
|
48
|
48
|
* @param string $database This should be the database that you wish to connect to
|
49
|
49
|
* @param string|false $backuphost If you have a replication server set up put the hostname or IP address incase the primary server goes down
|
50
|
|
- * @param object|false $cache If you want to cache the queries with Memcache(d)/Redis/APC/Xcache This should be the object else set to false
|
|
50
|
+ * @param boolean $cache If you want to cache the queries with Memcache(d)/Redis/APC/Xcache This should be the object else set to false
|
51
|
51
|
* @param boolean $persistent If you want a persistent database connection set to true
|
52
|
52
|
* @param string $type The type of connection that you wish to make can be 'mysql', 'cubrid', 'dblib', 'mssql', 'odbc', 'pgsql, or 'sqlite'
|
53
|
53
|
* @param int $port This should be the port number of the MySQL database connection
|
|
@@ -113,7 +113,7 @@ discard block |
|
|
block discarded – undo |
113
|
113
|
/**
|
114
|
114
|
* This query function is used for more advanced SQL queries for which non of the other methods fit
|
115
|
115
|
* @param string $sql This should be the SQL query which you wish to run
|
116
|
|
- * @param array $variables This should be an array of values to execute as the values in a prepared statement
|
|
116
|
+ * @param integer[] $variables This should be an array of values to execute as the values in a prepared statement
|
117
|
117
|
* @return array Returns array of results for the query that has just been run
|
118
|
118
|
*/
|
119
|
119
|
public function query($sql, $variables = array(), $cache = true) {
|
|
@@ -134,7 +134,7 @@ discard block |
|
|
block discarded – undo |
134
|
134
|
* Returns a single record for a select query for the chosen table
|
135
|
135
|
* @param string $table This should be the table you wish to select the values from
|
136
|
136
|
* @param array $where Should be the field names and values you wish to use as the where query e.g. array('fieldname' => 'value', 'fieldname2' => 'value2', etc).
|
137
|
|
- * @param string|array $fields This should be the records you wis to select from the table. It should be either set as '*' which is the default or set as an array in the following format array('field', 'field2', 'field3', etc).
|
|
137
|
+ * @param string $fields This should be the records you wis to select from the table. It should be either set as '*' which is the default or set as an array in the following format array('field', 'field2', 'field3', etc).
|
138
|
138
|
* @param array|string $order This is the order you wish the results to be ordered in should be formatted as follows array('fieldname' => 'ASC') or array("'fieldname', 'fieldname2'" => 'DESC')
|
139
|
139
|
* @param boolean $cache If the query should be cached or loaded from cache set to true else set to false
|
140
|
140
|
* @return array Returns a single table record as the standard array when running SQL queries
|
|
@@ -149,9 +149,9 @@ discard block |
|
|
block discarded – undo |
149
|
149
|
* @param array $where Should be the field names and values you wish to use as the where query e.g. array('fieldname' => 'value', 'fieldname2' => 'value2', etc).
|
150
|
150
|
* @param string|array $fields This should be the records you wis to select from the table. It should be either set as '*' which is the default or set as an array in the following format array('field', 'field2', 'field3', etc).
|
151
|
151
|
* @param array $order This is the order you wish the results to be ordered in should be formatted as follows array('fieldname' => 'ASC') or array("'fieldname', 'fieldname2'" => 'DESC')
|
152
|
|
- * @param integer|array $limit The number of results you want to return 0 is default and returns all results, else should be formated either as a standard integer or as an array as the start and end values e.g. array(0 => 150)
|
|
152
|
+ * @param integer $limit The number of results you want to return 0 is default and returns all results, else should be formated either as a standard integer or as an array as the start and end values e.g. array(0 => 150)
|
153
|
153
|
* @param boolean $cache If the query should be cached or loaded from cache set to true else set to false
|
154
|
|
- * @return array Returns a multidimensional array with the chosen fields from the table
|
|
154
|
+ * @return boolean Returns a multidimensional array with the chosen fields from the table
|
155
|
155
|
*/
|
156
|
156
|
public function selectAll($table, $where = array(), $fields = '*', $order = array(), $limit = 0, $cache = true) {
|
157
|
157
|
$this->buildSelectQuery(SafeString::makeSafe($table), $where, $fields, $order, $limit);
|
|
@@ -357,7 +357,7 @@ discard block |
|
|
block discarded – undo |
357
|
357
|
* @param array $where Should be the field names and values you wish to use as the where query e.g. array('fieldname' => 'value', 'fieldname2' => 'value2', etc).
|
358
|
358
|
* @param string|array $fields This should be the records you wis to select from the table. It should be either set as '*' which is the default or set as an array in the following format array('field', 'field2', 'field3', etc).
|
359
|
359
|
* @param array $order This is the order you wish the results to be ordered in should be formatted as follows array('fieldname' => 'ASC') or array("'fieldname', 'fieldname2'" => 'DESC') so it can be done in both directions
|
360
|
|
- * @param integer|array $limit The number of results you want to return 0 is default and returns all results, else should be formated either as a standard integer or as an array as the start and end values e.g. array(0 => 150)
|
|
360
|
+ * @param integer $limit The number of results you want to return 0 is default and returns all results, else should be formated either as a standard integer or as an array as the start and end values e.g. array(0 => 150)
|
361
|
361
|
*/
|
362
|
362
|
protected function buildSelectQuery($table, $where = array(), $fields = '*', $order = array(), $limit = 0) {
|
363
|
363
|
if(is_array($fields)) {
|
|
@@ -461,7 +461,7 @@ discard block |
|
|
block discarded – undo |
461
|
461
|
|
462
|
462
|
/**
|
463
|
463
|
* Returns the limit SQL for the current query as a string
|
464
|
|
- * @param integer|array $limit This should either be set as an integer or should be set as an array with a start and end value
|
|
464
|
+ * @param integer $limit This should either be set as an integer or should be set as an array with a start and end value
|
465
|
465
|
* @return string|false Will return the LIMIT string for the current query if it is valid else returns false
|
466
|
466
|
*/
|
467
|
467
|
private function limit($limit = 0) {
|