| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPSynchro\Database; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class for a database table column data |
| 7 |
*/ |
| 8 |
class TableColumns |
| 9 |
{ |
| 10 |
public $string = []; |
| 11 |
public $numeric = []; |
| 12 |
public $bit = []; |
| 13 |
public $binary = []; |
| 14 |
public $unknown = []; |
| 15 |
public $generated = []; |
| 16 |
public $column_types_used = []; |
| 17 |
|
| 18 |
public function __construct() |
| 19 |
{ |
| 20 |
} |
| 21 |
|
| 22 |
public function addColumnTypeUsed($column_type) |
| 23 |
{ |
| 24 |
$this->column_types_used[strtolower($column_type)] = true; |
| 25 |
} |
| 26 |
|
| 27 |
public function isColumnTypeUsed($column_type) |
| 28 |
{ |
| 29 |
return isset($this->column_types_used[strtolower($column_type)]); |
| 30 |
} |
| 31 |
|
| 32 |
public function isString($column) |
| 33 |
{ |
| 34 |
return isset($this->string[$column]); |
| 35 |
} |
| 36 |
|
| 37 |
public function isNumeric($column) |
| 38 |
{ |
| 39 |
return isset($this->numeric[$column]); |
| 40 |
} |
| 41 |
|
| 42 |
public function isBit($column) |
| 43 |
{ |
| 44 |
return isset($this->bit[$column]); |
| 45 |
} |
| 46 |
|
| 47 |
public function isBinary($column) |
| 48 |
{ |
| 49 |
return isset($this->binary[$column]); |
| 50 |
} |
| 51 |
|
| 52 |
public function isGenerated($column) |
| 53 |
{ |
| 54 |
return isset($this->generated[$column]); |
| 55 |
} |
| 56 |
|
| 57 |
public function getAllColumnNames() |
| 58 |
{ |
| 59 |
return array_merge($this->string, $this->numeric, $this->bit, $this->binary, $this->unknown, $this->generated); |
| 60 |
} |
| 61 |
} |
| 62 |
|