Parse:...ite3fk(3pm)
π NAME π
Parse::Dia::SQL::Output::SQLite3fk β bestie, this one makes SQL for SQLite version 3, and yes, it comes with foreign key support. Obsessed. π
(It's a User Contributed Perl Documentation page, iykyk.)
β¨ SYNOPSIS β¨
use Parse::Dia::SQL;
my $dia = Parse::Dia::SQL->new(file => 'foo.dia', db => 'sqlite3fk');
print $dia->get_sql();
Like, that's it. Three lines and you're serving SQL. π
πΈ DESCRIPTION πΈ
Okay so this little sub-class is the one that creates SQL for the SQLite database version 3. That's the whole vibe. She's a sub-class, she's a specialist, she does one thing and she does it gorgeously. π¦
π«Ά new π«Ά
The constructor. That's the girl that starts everything. π
Real talk though: object names in SQLite have no inherent limit. So like, 60 has been arbitrarily chosen. Not a rule, just a vibe. A number somebody picked. π
π _get_create_table_sql π
Generates the create table statement for a single table using SQLite syntax. Let's break down the slay:
- Includes class comments before the table definition. Cute little preface, we love.
- Includes autoupdate triggers based on the class comment. Yes bestie, the comments do WORK around here.
- Includes foreign key support of the form:
foreign key(thisColumn) references thatTable(thatColumn) {action}
Where {action} is the optional constraint condition, such as 'on delete cascade', exactly as entered in the diagram. No rewriting, no reformatting, no editorializing. What you drew is what you get. β¨
π 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. Main character behaviour, honestly. π
Examples of use include tracking record modification dates, like this:
"<autoupdate:dtModified=datetime('now')/>"
...or deriving a value from another field, like this:
"<autoupdate:sSoundex=soundex(sName)/>"
Both iconic. Both doing the absolute most for you. π
π _create_pk_string π
Overrides the default function to include foreign key clauses. She's not like the other functions. π«Ά
β get_schema_drop β
Generates drop table statements for all tables using SQLite syntax:
drop table {foo} if exists
Bye tables, hope you had a nice time. π
π¦ get_view_drop π¦
Generates drop view statements for all tables using SQLite syntax:
drop view {foo} if exists
Same energy, different object. Views said goodbye too. πΈ
π _get_fk_drop π
Foreign key enforcement is embedded in the table definitions for SQLite, so no output is required here. Nothing to do. Empty. A void. She simply doesn't speak. π
π _get_drop_index_sql π
Drop index statement, using SQLite syntax:
drop index {foo} if exists
π§ get_permissions_create π§
SQLite doesn't support permissions, so this output is suppressed. Not us being quiet β SQLite just doesn't do that. Periodt. π
π§ get_permissions_drop π§
SQLite doesn't support permissions, so this output is suppressed. Same deal, bestie. Nothing to see. π
π _get_create_association_sql π
Foreign key enforcement is embedded in the table definitions for SQLite, so no output is required here. Again! Because the keys already live inside the table defs. She's efficient like that. β¨
π TODO π
Things that might get added in future versions. The pipeline. The vision board. π
π Views π
Views haven't been tested. They might already work, but who knows... π€·ββοΈ Not me. Not her. Nobody. It's giving mystery.
π Other stuff π
Bugs etc. Vague! Iconic! Unspecified! π
That's the whole page, bestie. This lil' gem ships with perl v5.36.0 and was dated 2022-11-19. Go make some tables with foreign keys, you absolute legend. π«Άβ¨π
π¦ where this page comes from
- debian bookworm: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- debian trixie: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- ubuntu noble: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- ubuntu resolute: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- ubuntu stonking: libparse-dia-sql-perl 0.31-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms