|
@@ -35,7 +35,7 @@ discard block |
|
|
block discarded – undo |
|
35
|
35
|
* @param string $password This should be the password for the chosen database
|
|
36
|
36
|
* @param string $database This should be the database that you wish to connect to
|
|
37
|
37
|
* @param string|null $backuphost If you have a replication server set up put the hostname or IP address incase the primary server goes down
|
|
38
|
|
- * @return void
|
|
|
38
|
+ * @return Database
|
|
39
|
39
|
*/
|
|
40
|
40
|
public function __construct($hostname, $username, $password, $database, $backuphost = NULL){
|
|
41
|
41
|
try{
|
|
@@ -86,7 +86,7 @@ discard block |
|
|
block discarded – undo |
|
86
|
86
|
/**
|
|
87
|
87
|
* This outputs the SQL where query based on a given array
|
|
88
|
88
|
* @param array $where This should be an array that you wish to create the where query for in the for array('field1' => 'test') or array('field1' => array('>=', 0))
|
|
89
|
|
- * @return string|boolean If the where query is an array will return the where string and set the values else returns false if no array sent
|
|
|
89
|
+ * @return string|false If the where query is an array will return the where string and set the values else returns false if no array sent
|
|
90
|
90
|
*/
|
|
91
|
91
|
private function where($where){
|
|
92
|
92
|
if(is_array($where)){
|
|
@@ -115,7 +115,7 @@ discard block |
|
|
block discarded – undo |
|
115
|
115
|
/**
|
|
116
|
116
|
* Sets the order sting for the SQL query based on an array or string
|
|
117
|
117
|
* @param array|string $order This should be either set to array('fieldname' => 'ASC/DESC') or RAND()
|
|
118
|
|
- * @return string|boolean If the SQL query has an valid order by will return a string else returns false
|
|
|
118
|
+ * @return string|false If the SQL query has an valid order by will return a string else returns false
|
|
119
|
119
|
*/
|
|
120
|
120
|
private function orderBy($order){
|
|
121
|
121
|
if(is_array($order)){
|
|
@@ -131,8 +131,8 @@ discard block |
|
|
block discarded – undo |
|
131
|
131
|
|
|
132
|
132
|
/**
|
|
133
|
133
|
* Returns the limit SQL for the current query as a string
|
|
134
|
|
- * @param int|array $limit This should either be set as an integer or should be set as an array with a start and end value
|
|
135
|
|
- * @return string|boolean Will return the LIMIT string for the current query if it is valid else returns false
|
|
|
134
|
+ * @param integer $limit This should either be set as an integer or should be set as an array with a start and end value
|
|
|
135
|
+ * @return string|false Will return the LIMIT string for the current query if it is valid else returns false
|
|
136
|
136
|
*/
|
|
137
|
137
|
private function limit($limit = 0){
|
|
138
|
138
|
if(is_array($limit)){
|
|
@@ -171,7 +171,7 @@ discard block |
|
|
block discarded – undo |
|
171
|
171
|
* @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).
|
|
172
|
172
|
* @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).
|
|
173
|
173
|
* @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') so it can be done in both directions
|
|
174
|
|
- * @param int|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)
|
|
|
174
|
+ * @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)
|
|
175
|
175
|
*/
|
|
176
|
176
|
protected function buildSelectQuery($table, $where = '', $fields = '*', $order = '', $limit = 0){
|
|
177
|
177
|
if(is_array($fields)){
|
|
@@ -207,7 +207,7 @@ discard block |
|
|
block discarded – undo |
|
207
|
207
|
* @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).
|
|
208
|
208
|
* @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).
|
|
209
|
209
|
* @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') so it can be done in both directions
|
|
210
|
|
- * @param int|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)
|
|
|
210
|
+ * @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)
|
|
211
|
211
|
* @param boolean $cache If the query should be cached or loaded from cache set to true else set to false
|
|
212
|
212
|
* @return array Returns a multidimensional array with the chosen fields from the table
|
|
213
|
213
|
*/
|