1 | <?php |
||
29 | abstract class DML |
||
30 | { |
||
31 | /** |
||
32 | * Generate sorting parts of queries |
||
33 | * |
||
34 | * @param array $sort Sort by column names |
||
35 | * |
||
36 | * @return string |
||
37 | **/ |
||
|
|||
38 | |||
39 | private static function _sort(array $sort) |
||
66 | |||
67 | /** |
||
68 | * Generate join parts of queries |
||
69 | * |
||
70 | * @param array $joins Joins to other tables |
||
71 | * |
||
72 | * @return string |
||
73 | **/ |
||
74 | |||
75 | private static function _joins(array $joins) |
||
101 | |||
102 | /** |
||
103 | * Selects database entries from tables |
||
104 | * |
||
105 | * @param string $table Name of the database table |
||
106 | * @param mixed $joins Joins to other tables as an array |
||
107 | * @param mixed $columns Column names as string or array |
||
108 | * @param array $conditions Conditions with column, operation and value |
||
109 | * @param array $sort Sort by column names |
||
110 | * @param array $group Group by column names as string or array |
||
111 | * @param array $having Having clauses with conditions array structure |
||
112 | * |
||
113 | * @return array |
||
114 | **/ |
||
115 | |||
116 | public static function select( |
||
174 | |||
175 | /** |
||
176 | * Removes database entries from a table |
||
177 | * |
||
178 | * @param string $table Name of the database table |
||
179 | * @param array $conditions Conditions with column, operation and value |
||
180 | * @param mixed $joins Joins to other tables as an array |
||
181 | * |
||
182 | * @return array |
||
183 | **/ |
||
184 | public static function delete($table, array $conditions = [], $joins = '') |
||
208 | |||
209 | /** |
||
210 | * Inserts new entries into a database table |
||
211 | * |
||
212 | * @param string $table Name of the database table |
||
213 | * @param array $assoc Array with columns and values |
||
214 | * |
||
215 | * @return array |
||
216 | **/ |
||
217 | |||
218 | public static function insert($table, array $assoc) |
||
237 | |||
238 | /** |
||
239 | * Updates entries inside a database table |
||
240 | * |
||
241 | * @param string $table Name of the database table |
||
242 | * @param array $assoc Array with columns and values |
||
243 | * @param string $where_column Name of the target database column |
||
244 | * @param string $where_value Value of the target database column |
||
245 | * |
||
246 | * @return array |
||
247 | **/ |
||
248 | |||
249 | public static function update($table, array $assoc, $where_column, $where_value) |
||
269 | } |
||
270 |