NAME

Parse::Dia::SQL::Output::SQLite3fk - Create SQL for SQLite version 3, with foreign key support

SYNOPSIS

use Parse::Dia::SQL;
my $dia = Parse::Dia::SQL->new(file => 'foo.dia', db => 'sqlite3fk');
print $dia->get_sql();

DESCRIPTION

This sub-class creates SQL for the SQLite database version 3.

new

The constructor.

Object names in SQLite have no inherent limit. 60 has been arbitrarily chosen.

_get_create_table_sql

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

_create_pk_string

Override default function to include foreign key clauses

get_schema_drop

Generate drop table statements for all tables using SQLite syntax:

drop table {foo} if exists

get_view_drop

Generate drop view statements for all tables using SQLite syntax:

drop view {foo} if exists

_get_fk_drop

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

_get_drop_index_sql

drop index statement using SQLite syntax:

drop index {foo} if exists

get_permissions_create

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

get_permissions_drop

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

_get_create_association_sql

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

TODO

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