1SQL::Translator::ParserU:s:eMrySCQoLn(t3r)ibuted Perl DoScQuLm:e:nTtraatnisolnator::Parser::MySQL(3)
2
3
4

NAME

6       SQL::Translator::Parser::MySQL - parser for MySQL
7

SYNOPSIS

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

DESCRIPTION

16       The grammar is influenced heavily by Tim Bunce's "mysql2ora" grammar.
17
18       Here's the word from the MySQL site
19       (http://www.mysql.com/doc/en/CREATE_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      ENGINE = {BDB | HEAP | ISAM | InnoDB | MERGE | MRG_MYISAM | MYISAM }
84         or      AUTO_INCREMENT = #
85         or      AVG_ROW_LENGTH = #
86         or      [ DEFAULT ] CHARACTER SET charset_name
87         or      CHECKSUM = {0 | 1}
88         or      COLLATE collation_name
89         or      COMMENT = "string"
90         or      MAX_ROWS = #
91         or      MIN_ROWS = #
92         or      PACK_KEYS = {0 | 1 | DEFAULT}
93         or      PASSWORD = "string"
94         or      DELAY_KEY_WRITE = {0 | 1}
95         or      ROW_FORMAT= { default | dynamic | fixed | compressed }
96         or      RAID_TYPE= {1 | STRIPED | RAID0 } RAID_CHUNKS=#  RAID_CHUNKSIZE=#
97         or      UNION = (table_name,[table_name...])
98         or      INSERT_METHOD= {NO | FIRST | LAST }
99         or      DATA DIRECTORY="absolute path to directory"
100         or      INDEX DIRECTORY="absolute path to directory"
101
102       A subset of the ALTER TABLE syntax that allows addition of foreign
103       keys:
104
105         ALTER [IGNORE] TABLE tbl_name alter_specification [, alter_specification] ...
106
107         alter_specification:
108                 ADD [CONSTRAINT [symbol]]
109                 FOREIGN KEY [index_name] (index_col_name,...)
110                    [reference_definition]
111
112       A subset of INSERT that we ignore:
113
114         INSERT anything
115

ARGUMENTS

117       This parser takes a single optional parser_arg "mysql_parser_version",
118       which provides the desired version for the target database. Any
119       statement in the processed dump file, that is commented with a version
120       higher than the one supplied, will be stripped.
121
122       The default "mysql_parser_version" is set to the conservative value of
123       40000 (MySQL 4.0)
124
125       Valid version specifiers for "mysql_parser_version" are listed here
126
127       More information about the MySQL comment-syntax:
128       <http://dev.mysql.com/doc/refman/5.0/en/comments.html>
129

AUTHOR

131       Ken Youens-Clark <kclark@cpan.org>, Chris Mungall <cjm@fruitfly.org>.
132

SEE ALSO

134       Parse::RecDescent, SQL::Translator::Schema.
135
136
137
138perl v5.36.0                      2023-02-27 SQL::Translator::Parser::MySQL(3)
Impressum