Revision history for DBIx::Class
+ - Support for Firebird RDBMS with DBD::InterBase and ODBC
- DBIx::Class::InflateColumn::File entered deprecated state
- DBIx::Class::Optional::Dependencies left experimental state
- Add req_group_list to Opt::Deps (RT#55211)
# which is sadly understood only by MySQL. Change default behavior here,
# until SQLA2 comes with proper dialect support
if (! $_[0] or (ref $_[0] eq 'HASH' and !keys %{$_[0]} ) ) {
- return "INSERT INTO ${table} DEFAULT VALUES"
+ my $sql = "INSERT INTO ${table} DEFAULT VALUES";
+
+ if (my @returning = @{ ($_[1]||{})->{returning} || [] }) {
+ $sql .= ' RETURNING (' . (join ', ' => map $self->_quote($_), @returning)
+ . ')';
+ }
+
+ return $sql;
}
$self->SUPER::insert($table, @_);
plan skip_all => <<'EOF' unless $dsn || $dsn2;
Set $ENV{DBICTEST_FIREBIRD_DSN} and/or $ENV{DBICTEST_FIREBIRD_ODBC_DSN},
-_USER and _PASS to run these tests
+_USER and _PASS to run these tests.
+
+WARNING: this test creates and drops the tables "artist", "bindtype_test" and
+"sequence_test"; the generators "gen_artist_artistid", "pkid1_seq", "pkid2_seq"
+and "nonpkid_seq" and the trigger "artist_bi".
EOF
my @info = (
}
# test empty insert
+ lives_and {
+ my $row = $ars->create({});
+ ok $row->artistid;
+ } 'empty insert works';
+
+# test inferring the generator from the trigger source and using it with
+# auto_nextval
{
- local $ars->result_source->column_info('artistid')->{is_auto_increment} = 0;
+ local $ars->result_source->column_info('artistid')->{auto_nextval} = 1;
- lives_ok { $ars->create({}) }
- 'empty insert works';
+ lives_and {
+ my $row = $ars->create({ name => 'introspecting generator' });
+ ok $row->artistid;
+ } 'inferring generator from trigger source works';
}
# test blobs (stolen from 73oracle.t)