NAME

DBIO::DuckDB::DDL::Emit - Single source of DuckDB DDL statement shape

VERSION

version 0.900000

DESCRIPTION

The DuckDB DDL string templates -- column definitions, table/index/sequence statements, and the inline PK/UNIQUE/FK clauses -- live here so that the two producers of DDL agree on syntax char-for-char:

Each caller owns the field-extraction adapter for its own input shape (DBIO metadata vs introspected model) and feeds normalized pieces here. These functions are pure: identifiers are quoted via DBIO::SQL::Util, nothing else is interpreted. Clauses are returned without indentation; "create_table" indents the body uniformly.

column_def(name => $n, type => $t, not_null => $bool, default => $sql);

Renders "name" TYPE [NOT NULL] [DEFAULT $sql]. default is emitted verbatim -- the caller is responsible for quoting/escaping it (the two producers derive defaults very differently). Pass undef for no default.

pk_clause(@columns);
unique_clause(@columns);
fk_clause(from => \@local, to_table => $t, to => \@remote);
create_table($table_name, @clause_strings);

Wraps the clauses (column defs, PK, UNIQUE, FK -- all unindented) in a CREATE TABLE statement, indenting each clause by two spaces.

create_index(name => $n, table => $t, columns => \@cols, unique => $bool);
create_sequence(name => $n);
create_sequence(name => $n, start => 1000000);

AUTHOR

DBIO Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

7 POD Errors

The following errors were encountered while parsing the POD:

Around line 109:

Unknown directive: =func

Around line 117:

Unknown directive: =func

Around line 121:

Unknown directive: =func

Around line 125:

Unknown directive: =func

Around line 129:

Unknown directive: =func

Around line 136:

Unknown directive: =func

Around line 140:

Unknown directive: =func