1SQL::Translator::ParserU:s:eMrySCQoLn(t3r)ibuted Perl DoScQuLm:e:nTtraatnisolnator::Parser::MySQL(3)
2
3
4
6 SQL::Translator::Parser::MySQL - parser for MySQL
7
9 use SQL::Translator;
10 use SQL::Translator::Parser::MySQL;
11
12 my $translator = SQL::Translator->new;
13 $translator->parser("SQL::Translator::Parser::MySQL");
14
16 The grammar is influenced heavily by Tim Bunce's "mysql2ora" grammar.
17
18 Here's the word from the MySQL site (http://www.mysql.com/doc/en/CRE‐
19 ATE_TABLE.html):
20
21 CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)]
22 [table_options] [select_statement]
23
24 or
25
26 CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name LIKE old_table_name;
27
28 create_definition:
29 col_name type [NOT NULL ⎪ NULL] [DEFAULT default_value] [AUTO_INCREMENT]
30 [PRIMARY KEY] [reference_definition]
31 or PRIMARY KEY (index_col_name,...)
32 or KEY [index_name] (index_col_name,...)
33 or INDEX [index_name] (index_col_name,...)
34 or UNIQUE [INDEX] [index_name] (index_col_name,...)
35 or FULLTEXT [INDEX] [index_name] (index_col_name,...)
36 or [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
37 [reference_definition]
38 or CHECK (expr)
39
40 type:
41 TINYINT[(length)] [UNSIGNED] [ZEROFILL]
42 or SMALLINT[(length)] [UNSIGNED] [ZEROFILL]
43 or MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL]
44 or INT[(length)] [UNSIGNED] [ZEROFILL]
45 or INTEGER[(length)] [UNSIGNED] [ZEROFILL]
46 or BIGINT[(length)] [UNSIGNED] [ZEROFILL]
47 or REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
48 or DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]
49 or FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]
50 or DECIMAL(length,decimals) [UNSIGNED] [ZEROFILL]
51 or NUMERIC(length,decimals) [UNSIGNED] [ZEROFILL]
52 or CHAR(length) [BINARY]
53 or VARCHAR(length) [BINARY]
54 or DATE
55 or TIME
56 or TIMESTAMP
57 or DATETIME
58 or TINYBLOB
59 or BLOB
60 or MEDIUMBLOB
61 or LONGBLOB
62 or TINYTEXT
63 or TEXT
64 or MEDIUMTEXT
65 or LONGTEXT
66 or ENUM(value1,value2,value3,...)
67 or SET(value1,value2,value3,...)
68
69 index_col_name:
70 col_name [(length)]
71
72 reference_definition:
73 REFERENCES tbl_name [(index_col_name,...)]
74 [MATCH FULL ⎪ MATCH PARTIAL]
75 [ON DELETE reference_option]
76 [ON UPDATE reference_option]
77
78 reference_option:
79 RESTRICT ⎪ CASCADE ⎪ SET NULL ⎪ NO ACTION ⎪ SET DEFAULT
80
81 table_options:
82 TYPE = {BDB ⎪ HEAP ⎪ ISAM ⎪ InnoDB ⎪ MERGE ⎪ MRG_MYISAM ⎪ MYISAM }
83 or AUTO_INCREMENT = #
84 or AVG_ROW_LENGTH = #
85 or CHECKSUM = {0 ⎪ 1}
86 or COMMENT = "string"
87 or MAX_ROWS = #
88 or MIN_ROWS = #
89 or PACK_KEYS = {0 ⎪ 1 ⎪ DEFAULT}
90 or PASSWORD = "string"
91 or DELAY_KEY_WRITE = {0 ⎪ 1}
92 or ROW_FORMAT= { default ⎪ dynamic ⎪ fixed ⎪ compressed }
93 or RAID_TYPE= {1 ⎪ STRIPED ⎪ RAID0 } RAID_CHUNKS=# RAID_CHUNKSIZE=#
94 or UNION = (table_name,[table_name...])
95 or INSERT_METHOD= {NO ⎪ FIRST ⎪ LAST }
96 or DATA DIRECTORY="absolute path to directory"
97 or INDEX DIRECTORY="absolute path to directory"
98
99 A subset of the ALTER TABLE syntax that allows addition of foreign
100 keys:
101
102 ALTER [IGNORE] TABLE tbl_name alter_specification [, alter_specification] ...
103
104 alter_specification:
105 ADD [CONSTRAINT [symbol]]
106 FOREIGN KEY [index_name] (index_col_name,...)
107 [reference_definition]
108
109 A subset of INSERT that we ignore:
110
111 INSERT anything
112
114 Ken Youens-Clark <kclark@cpan.org>, Chris Mungall <cjm@fruitfly.org>.
115
117 Parse::RecDescent, SQL::Translator::Schema.
118
119
120
121perl v5.8.8 2007-10-24 SQL::Translator::Parser::MySQL(3)