Parse::Dia::SQL::Output::SQLite3fk - Create SQL for SQLite version 3, with foreign key support
use Parse::Dia::SQL; my $dia = Parse::Dia::SQL->new(file => 'foo.dia', db => 'sqlite3fk'); print $dia->get_sql();
This sub-class creates SQL for the SQLite database version 3.
The constructor.
Object names in SQLite have no inherent limit. 60 has been arbitrarily chosen.
Generate create table statement for a single table using SQLite syntax:
Includes class comments before the table definition.
Includes autoupdate triggers based on the class comment.
Includes foreign key support of the form
foreign key(thisColumn) references thatTable(thatColumn) {action}
Where {action} is the optional contraint condition, such as 'on delete cascade' exactly as entered in the diagram.
If the class comment includes a line like:
<autoupdate:foo/>
Then an 'after update' trigger is generated for this table which executes the statement foo for the updated row.
Examples of use include tracking record modification dates (<autoupdate:dtModified=datetime('now')/>) or deriving a value from another field (<autoupdate:sSoundex=soundex(sName)/>)
<autoupdate:dtModified=datetime('now')/
<autoupdate:sSoundex=soundex(sName)/
Override default functon to include foreign key clauses
Generate drop table statments for all tables using SQLite syntax:
drop table {foo} if exists
Generate drop view statments for all tables using SQLite syntax:
drop view {foo} if exists
Foreign key enforcement is embedded in the table definitions for SQLite, so no output is required here.
drop index statement using SQLite syntax:
drop index {foo} if exists
SQLite doesn't support permissions, so suppress this output.
Things that might get added in future versions:
Views haven't been tested. They might already work, but who knows...
Bugs etc
To install Parse::Dia::SQL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::Dia::SQL
CPAN shell
perl -MCPAN -e shell install Parse::Dia::SQL
For more information on module installation, please visit the detailed CPAN module installation guide.