Skip to content

Commit 489e67f

Browse files
committed
allow special table classes in meta
This has two use-cases: 1) See dbi-dev@ mail from 2015/01/27 - "Table Capabilities / Data Access API" 2) Allow one $dbh (e.g. a DBD::CSV) can deal with tables from another $dbh (e.g. a DBD::DBM) by copying the meta using new_sql_engine_meta and adding the table class to use (undocumented until we found a sane test case)
1 parent 71dc73b commit 489e67f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/DBI/DBD/SqlEngine.pm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,15 +1456,18 @@ sub open_table ($$$$$)
14561456
};
14571457
$self->{command} eq "DROP" and $flags->{dropMode} = 1;
14581458

1459+
my ( $tblnm, $table_meta ) = $class->get_table_meta( $data->{Database}, $table, 1 )
1460+
or croak "Cannot find appropriate meta for table '$table'";
1461+
1462+
defined $table_meta->{sql_table_class} and $class = $table_meta->{sql_table_class};
1463+
14591464
# because column name mapping is initialized in constructor ...
14601465
# and therefore specific opening operations might be done before
14611466
# reaching DBI::DBD::SqlEngine::Table->new(), we need to intercept
14621467
# ReadOnly here
14631468
my $write_op = $createMode || $lockMode || $flags->{dropMode};
14641469
if ($write_op)
14651470
{
1466-
my ( $tblnm, $table_meta ) = $class->get_table_meta( $data->{Database}, $table, 1 )
1467-
or croak "Cannot find appropriate file for table '$table'";
14681471
$table_meta->{readonly}
14691472
and croak "Table '$table' is marked readonly - "
14701473
. $self->{command}

0 commit comments

Comments
 (0)