DOKK / manpages / debian 12 / libparse-dia-sql-perl / Parse::Dia::SQL::Output::SQLite3fk.3pm.en
Parse::Dia::SQL::Output::SQLite3fk(3pm) User Contributed Perl Documentation Parse::Dia::SQL::Output::SQLite3fk(3pm)

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.

autoupdate triggers

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)/">)

Override default function to include foreign key clauses

Generate drop table statements for all tables using SQLite syntax:

  drop table {foo} if exists

Generate drop view statements 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.

SQLite doesn't support permissions, so suppress this output.

Foreign key enforcement is embedded in the table definitions for SQLite, so no output is required here.

Things that might get added in future versions:

Views

Views haven't been tested. They might already work, but who knows...

Other stuff

Bugs etc

2022-11-19 perl v5.36.0