1 | <?php |
||
29 | abstract class DDL |
||
30 | { |
||
31 | /** |
||
32 | * Creates a new database table |
||
33 | * |
||
34 | * @param string $table Name of the database table |
||
35 | * @param array $columns Names of the database columns |
||
36 | * @param array $primary Columns to use for the primary key |
||
37 | * @param array $foreigns Foreign keys to apply to the table |
||
38 | * |
||
39 | * @throws \Exception |
||
40 | * |
||
41 | * @return array |
||
42 | **/ |
||
|
|||
43 | |||
44 | public static function create( |
||
73 | |||
74 | /** |
||
75 | * Creates the column parts for table creation |
||
76 | * |
||
77 | * @param array $columns Array with columns |
||
78 | * |
||
79 | * @throws \Exception |
||
80 | * |
||
81 | * @return string |
||
82 | **/ |
||
83 | |||
84 | private static function _createColumns(array $columns) |
||
110 | |||
111 | /** |
||
112 | * Creates the part of a single column |
||
113 | * |
||
114 | * @param array $column Array with column details |
||
115 | * |
||
116 | * @return string |
||
117 | **/ |
||
118 | |||
119 | private static function _createColumnPart(array $column) |
||
144 | |||
145 | /** |
||
146 | * Creates the foreign key parts for table creation |
||
147 | * |
||
148 | * @param array $foreigns Array with foreign keys |
||
149 | * |
||
150 | * @return string |
||
151 | **/ |
||
152 | |||
153 | private static function _createForeigns(array $foreigns) |
||
181 | |||
182 | /** |
||
183 | * Drops a database table |
||
184 | * |
||
185 | * @param string $table Name of the database table |
||
186 | * @param boolean $if_exists Defaults to true while ignoring not found errors |
||
187 | * |
||
188 | * @return array |
||
189 | **/ |
||
190 | |||
191 | public static function drop($table, $if_exists = true) |
||
202 | |||
203 | /** |
||
204 | * Creates a new index |
||
205 | * |
||
206 | * @param string $name Name for the index to create |
||
207 | * @param string $table Name of the database table |
||
208 | * @param array $columns Columns to use for the index |
||
209 | * @param boolean $unique Enforces combined column data to be unique |
||
210 | * |
||
211 | * @return array |
||
212 | **/ |
||
213 | |||
214 | public static function index($name, $table, array $columns, $unique = false) |
||
236 | |||
237 | /** |
||
238 | * Optimizes database tables |
||
239 | * |
||
240 | * @param array $tables Names of the database tables |
||
241 | * |
||
242 | * @return array |
||
243 | **/ |
||
244 | |||
245 | public static function optimize(array $tables) |
||
257 | } |
||
258 |