| 1 | <?php |
||
| 12 | class TableConstructor |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Database connection |
||
| 16 | * @var PDO |
||
| 17 | */ |
||
| 18 | private $pdo; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Table name |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $table; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * TableConstructor constructor. |
||
| 28 | * |
||
| 29 | * @param PDO $pdo |
||
| 30 | * @param string $tableName |
||
| 31 | */ |
||
| 32 | public function __construct(PDO $pdo, $tableName) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Create table |
||
| 40 | * |
||
| 41 | * @param string $sql |
||
| 42 | * @param string $readme |
||
| 43 | * @return bool |
||
| 44 | * @throws SQLException |
||
| 45 | */ |
||
| 46 | public function create($sql, $readme) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Check if the table exists |
||
| 63 | * |
||
| 64 | * @return bool |
||
| 65 | */ |
||
| 66 | public function exists() |
||
| 75 | } |
||
| 76 |