summaryrefslogtreecommitdiffstats
path: root/tests/Utils/TableTest.php
diff options
context:
space:
mode:
authorDan Ungureanu <udan1107@gmail.com>2015-07-14 02:09:10 +0300
committerDan Ungureanu <udan1107@gmail.com>2015-07-14 02:09:10 +0300
commitce313ae23914d1a8a2dad2ae0039577ea738fffc (patch)
tree5ee144054cc0337eba278577eee443f9386576ac /tests/Utils/TableTest.php
parent68ad40b4f30c0ff55d662413729fec4a535a3fec (diff)
downloadsql-parser-ce313ae23914d1a8a2dad2ae0039577ea738fffc.zip
sql-parser-ce313ae23914d1a8a2dad2ae0039577ea738fffc.tar.gz
sql-parser-ce313ae23914d1a8a2dad2ae0039577ea738fffc.tar.bz2
Improved Table utilities.
Fixed coding style.
Diffstat (limited to 'tests/Utils/TableTest.php')
-rw-r--r--tests/Utils/TableTest.php44
1 files changed, 37 insertions, 7 deletions
diff --git a/tests/Utils/TableTest.php b/tests/Utils/TableTest.php
index bda6e78..9de7126 100644
--- a/tests/Utils/TableTest.php
+++ b/tests/Utils/TableTest.php
@@ -139,33 +139,33 @@ class TableTest extends TestCase
array(
'address_id' => array(
'type' => 'SMALLINT',
- 'timestamp_not_null' => null,
+ 'timestamp_not_null' => false,
),
'address' => array(
'type' => 'VARCHAR',
- 'timestamp_not_null' => null,
+ 'timestamp_not_null' => false,
),
'address2' => array(
'type' => 'VARCHAR',
- 'timestamp_not_null' => null,
+ 'timestamp_not_null' => false,
'default_value' => 'NULL',
),
'district' => array(
'type' => 'VARCHAR',
- 'timestamp_not_null' => null,
+ 'timestamp_not_null' => false,
),
'city_id' => array(
'type' => 'SMALLINT',
- 'timestamp_not_null' => null,
+ 'timestamp_not_null' => false,
),
'postal_code' => array(
'type' => 'VARCHAR',
- 'timestamp_not_null' => null,
+ 'timestamp_not_null' => false,
'default_value' => 'NULL',
),
'phone' => array(
'type' => 'VARCHAR',
- 'timestamp_not_null' => null,
+ 'timestamp_not_null' => false,
),
'last_update' => array(
'type' => 'TIMESTAMP',
@@ -176,6 +176,36 @@ class TableTest extends TestCase
)
)
),
+ array(
+ 'CREATE TABLE table1 (
+ a INT NOT NULL,
+ b VARCHAR(32),
+ c INT AS (a mod 10) VIRTUAL,
+ d VARCHAR(5) AS (left(b,5)) PERSISTENT
+ )',
+ array(
+ 'a' => array(
+ 'type' => 'INT',
+ 'timestamp_not_null' => false,
+ ),
+ 'b' => array(
+ 'type' => 'VARCHAR',
+ 'timestamp_not_null' => false,
+ ),
+ 'c' => array(
+ 'type' => 'INT',
+ 'timestamp_not_null' => false,
+ 'generated' => true,
+ 'expr' => '(a mod 10)',
+ ),
+ 'd' => array(
+ 'type' => 'VARCHAR',
+ 'timestamp_not_null' => false,
+ 'generated' => true,
+ 'expr' => '(left(b,5))',
+ ),
+ ),
+ ),
);
}
}