%global_names = (); #reset
+
+ my $head = (header_comment() . "\n") unless $no_comments;
+
my @create = ();
- push @create, header_comment unless ($no_comments);
- $create[0] .= "\n\nBEGIN TRANSACTION" unless $no_txn;
+
+ push @create, "BEGIN TRANSACTION" unless $no_txn;
for my $table ( $schema->get_tables ) {
push @create, create_table($table, { no_comments => $no_comments,
});
}
+ push @create, "COMMIT" unless $no_txn;
+
if (wantarray) {
- push @create, "COMMIT" unless $no_txn;
- return @create;
+ return ($head||(), @create);
} else {
- push @create, "COMMIT;\n" unless $no_txn;
- return join(";\n\n", @create );
+ return join ('',
+ $head||(),
+ join(";\n\n", @create ),
+ ";\n",
+ );
}
}
) or die $sqlt->error;
eq_or_diff($sql, << "SQL");
-
-
BEGIN TRANSACTION;
DROP TABLE Basic;
eq_or_diff(\@sql,
[
- "\n\nBEGIN TRANSACTION",
+ 'BEGIN TRANSACTION',
'DROP TABLE Basic',
'CREATE TABLE Basic (
id INTEGER PRIMARY KEY NOT NULL,