@@ -18,129 +18,129 @@ class Table
1818 /**
1919 * Types of columns
2020 */
21- const TYPE_BOOLEAN = 'boolean ' ;
21+ public const TYPE_BOOLEAN = 'boolean ' ;
2222
23- const TYPE_SMALLINT = 'smallint ' ;
23+ public const TYPE_SMALLINT = 'smallint ' ;
2424
25- const TYPE_INTEGER = 'integer ' ;
25+ public const TYPE_INTEGER = 'integer ' ;
2626
27- const TYPE_BIGINT = 'bigint ' ;
27+ public const TYPE_BIGINT = 'bigint ' ;
2828
29- const TYPE_FLOAT = 'float ' ;
29+ public const TYPE_FLOAT = 'float ' ;
3030
31- const TYPE_NUMERIC = 'numeric ' ;
31+ public const TYPE_NUMERIC = 'numeric ' ;
3232
33- const TYPE_DECIMAL = 'decimal ' ;
33+ public const TYPE_DECIMAL = 'decimal ' ;
3434
35- const TYPE_DATE = 'date ' ;
35+ public const TYPE_DATE = 'date ' ;
3636
37- const TYPE_TIMESTAMP = 'timestamp ' ;
37+ public const TYPE_TIMESTAMP = 'timestamp ' ;
3838
3939 // Capable to support date-time from 1970 + auto-triggers in some RDBMS
40- const TYPE_DATETIME = 'datetime ' ;
40+ public const TYPE_DATETIME = 'datetime ' ;
4141
4242 // Capable to support long date-time before 1970
43- const TYPE_TEXT = 'text ' ;
43+ public const TYPE_TEXT = 'text ' ;
4444
4545 // A real blob, stored as binary inside DB
46- const TYPE_BLOB = 'blob ' ;
46+ public const TYPE_BLOB = 'blob ' ;
4747
4848 // Used for back compatibility, when query param can't use statement options
49- const TYPE_VARBINARY = 'varbinary ' ;
49+ public const TYPE_VARBINARY = 'varbinary ' ;
5050
5151 /**
5252 * Default and maximal TEXT and BLOB columns sizes we can support for different DB systems.
5353 */
54- const DEFAULT_TEXT_SIZE = 1024 ;
54+ public const DEFAULT_TEXT_SIZE = 1024 ;
5555
56- const MAX_TEXT_SIZE = 2147483648 ;
56+ public const MAX_TEXT_SIZE = 2147483648 ;
5757
58- const MAX_VARBINARY_SIZE = 2147483648 ;
58+ public const MAX_VARBINARY_SIZE = 2147483648 ;
5959
6060 /**
6161 * Default values for timestamps - fill with current timestamp on inserting record, on changing and both cases
6262 */
63- const TIMESTAMP_INIT_UPDATE = 'TIMESTAMP_INIT_UPDATE ' ;
63+ public const TIMESTAMP_INIT_UPDATE = 'TIMESTAMP_INIT_UPDATE ' ;
6464
65- const TIMESTAMP_INIT = 'TIMESTAMP_INIT ' ;
65+ public const TIMESTAMP_INIT = 'TIMESTAMP_INIT ' ;
6666
67- const TIMESTAMP_UPDATE = 'TIMESTAMP_UPDATE ' ;
67+ public const TIMESTAMP_UPDATE = 'TIMESTAMP_UPDATE ' ;
6868
6969 /**
7070 * Actions used for foreign keys
7171 */
72- const ACTION_CASCADE = 'CASCADE ' ;
72+ public const ACTION_CASCADE = 'CASCADE ' ;
7373
74- const ACTION_SET_NULL = 'SET NULL ' ;
74+ public const ACTION_SET_NULL = 'SET NULL ' ;
7575
76- const ACTION_NO_ACTION = 'NO ACTION ' ;
76+ public const ACTION_NO_ACTION = 'NO ACTION ' ;
7777
78- const ACTION_RESTRICT = 'RESTRICT ' ;
78+ public const ACTION_RESTRICT = 'RESTRICT ' ;
7979
80- const ACTION_SET_DEFAULT = 'SET DEFAULT ' ;
80+ public const ACTION_SET_DEFAULT = 'SET DEFAULT ' ;
8181
8282 /**
8383 * Column option 'default'
8484 *
8585 * @var string
8686 */
87- const OPTION_DEFAULT = 'default ' ;
87+ public const OPTION_DEFAULT = 'default ' ;
8888
8989 /**
9090 * Column option 'identity'
9191 *
9292 * @var string
9393 */
94- const OPTION_IDENTITY = 'identity ' ;
94+ public const OPTION_IDENTITY = 'identity ' ;
9595
9696 /**
9797 * Column option 'length'
9898 *
9999 * @var string
100100 */
101- const OPTION_LENGTH = 'length ' ;
101+ public const OPTION_LENGTH = 'length ' ;
102102
103103 /**
104104 * Column option 'nullable'
105105 *
106106 * @var string
107107 */
108- const OPTION_NULLABLE = 'nullable ' ;
108+ public const OPTION_NULLABLE = 'nullable ' ;
109109
110110 /**
111111 * Column option 'precision'
112112 *
113113 * @var string
114114 */
115- const OPTION_PRECISION = 'precision ' ;
115+ public const OPTION_PRECISION = 'precision ' ;
116116
117117 /**
118118 * Column option 'primary'
119119 *
120120 * @var string
121121 */
122- const OPTION_PRIMARY = 'primary ' ;
122+ public const OPTION_PRIMARY = 'primary ' ;
123123
124124 /**
125125 * Column option 'scale'
126126 *
127127 * @var string
128128 */
129- const OPTION_SCALE = 'scale ' ;
129+ public const OPTION_SCALE = 'scale ' ;
130130
131131 /**
132132 * Column option 'type'
133133 *
134134 * @var string
135135 */
136- const OPTION_TYPE = 'type ' ;
136+ public const OPTION_TYPE = 'type ' ;
137137
138138 /**
139139 * Column option 'unsigned'
140140 *
141141 * @var string
142142 */
143- const OPTION_UNSIGNED = 'unsigned ' ;
143+ public const OPTION_UNSIGNED = 'unsigned ' ;
144144
145145 /**
146146 * Name of table
@@ -150,8 +150,6 @@ class Table
150150 protected $ _tableName ;
151151
152152 /**
153- * Schema name
154- *
155153 * @var string
156154 */
157155 protected $ _schemaName ;
@@ -381,7 +379,7 @@ public function addColumn($name, $type, $size = null, $options = [], $comment =
381379 $ precision = $ size [0 ];
382380 $ scale = $ size [1 ];
383381 }
384- } elseif (preg_match ('#^(\d+),(\d+)$# ' , $ size , $ match )) {
382+ } elseif ($ size && preg_match ('#^(\d+),(\d+)$# ' , $ size , $ match )) {
385383 $ precision = $ match [1 ];
386384 $ scale = $ match [2 ];
387385 }
@@ -637,6 +635,7 @@ public function setOption($key, $value)
637635
638636 /**
639637 * Retrieve table option value by option name
638+ *
640639 * Return null if option does not exits
641640 *
642641 * @param string $key
@@ -673,7 +672,7 @@ protected function _sortIndexColumnPosition($a, $b)
673672 }
674673
675674 /**
676- * table column position comparison function
675+ * Table column position comparison function
677676 *
678677 * @param array $a
679678 * @param array $b
0 commit comments