NAME

SQL::Translator::Parser::SQLite - parser for SQLite

SYNOPSIS

use SQL::Translator;
use SQL::Translator::Parser::SQLite;

my $translator = SQL::Translator->new;
$translator->parser("SQL::Translator::Parser::SQLite");

DESCRIPTION

This is a grammar for parsing CREATE statements for SQLite as described here:

http://www.sqlite.org/lang.html

CREATE INDEX

sql-statement ::= CREATE [TEMP | TEMPORARY] [UNIQUE] INDEX index-name ON [database-name .] table-name ( column-name [, column-name]* ) [ ON CONFLICT conflict-algorithm ]

column-name ::= name [ ASC | DESC ]

CREATE TABLE

sql-command ::= CREATE [TEMP | TEMPORARY] TABLE table-name ( column-def [, column-def]* [, constraint]* )

sql-command ::= CREATE [TEMP | TEMPORARY] TABLE table-name AS select-statement

column-def ::= name [type] [[CONSTRAINT name] column-constraint]*

type ::= typename | typename ( number ) | typename ( number , number )

column-constraint ::= NOT NULL [ conflict-clause ] | PRIMARY KEY [sort-order] [ conflict-clause ] | UNIQUE [ conflict-clause ] | CHECK ( expr ) [ conflict-clause ] | DEFAULT value

constraint ::= PRIMARY KEY ( name [, name]* ) [ conflict-clause ]| UNIQUE ( name [, name]* ) [ conflict-clause ] | CHECK ( expr ) [ conflict-clause ]

conflict-clause ::= ON CONFLICT conflict-algorithm

CREATE TRIGGER

sql-statement ::= CREATE [TEMP | TEMPORARY] TRIGGER trigger-name [ BEFORE | AFTER ] database-event ON [database-name .] table-name trigger-action

sql-statement ::= CREATE [TEMP | TEMPORARY] TRIGGER trigger-name INSTEAD OF database-event ON [database-name .] view-name trigger-action

database-event ::= DELETE | INSERT | UPDATE | UPDATE OF column-list

trigger-action ::= [ FOR EACH ROW | FOR EACH STATEMENT ] [ WHEN expression ] BEGIN trigger-step ; [ trigger-step ; ]* END

trigger-step ::= update-statement | insert-statement | delete-statement | select-statement

CREATE VIEW

sql-command ::= CREATE [TEMP | TEMPORARY] VIEW view-name AS select-statement

ON CONFLICT clause

conflict-clause ::=
ON CONFLICT conflict-algorithm

conflict-algorithm ::=
ROLLBACK | ABORT | FAIL | IGNORE | REPLACE

expression

expr ::= expr binary-op expr | expr like-op expr | unary-op expr | ( expr ) | column-name | table-name . column-name | database-name . table-name . column-name | literal-value | function-name ( expr-list | * ) | expr (+) | expr ISNULL | expr NOTNULL | expr [NOT] BETWEEN expr AND expr | expr [NOT] IN ( value-list ) | expr [NOT] IN ( select-statement ) | ( select-statement ) | CASE [expr] ( WHEN expr THEN expr )+ [ELSE expr] END

like-op::= LIKE | GLOB | NOT LIKE | NOT GLOB

AUTHOR

Ken Youens-Clark <kclark@cpan.org>.

SEE ALSO

perl(1), Parse::RecDescent, SQL::Translator::Schema.