DBD-XMLSimple
view release on metacpan or search on metacpan
lib/DBD/XMLSimple.pm view on Meta::CPAN
package DBD::XMLSimple::Statement;
use strict;
use warnings;
use XML::Twig;
use Carp;
@DBD::XMLSimple::Statement::ISA = qw(DBI::DBD::SqlEngine::Statement);
sub open_table($$$$$)
{
my($self, $data, $tname, $createMode, $lockMode) = @_;
my $dbh = $data->{Database};
my $twig = XML::Twig->new();
my $source = $dbh->{filename};
if(ref($source) eq 'ARRAY') {
$twig->parse(join('', @{$source}));
} else {
$twig->parsefile($source);
lib/DBD/XMLSimple.pm view on Meta::CPAN
$attr->{readonly} = 1;
$attr->{cursor} = 0;
my $rc = $class->SUPER::new($data, $attr, $flags);
$rc->{col_names} = $attr->{col_names};
$rc->{col_nums} = $attr->{col_nums};
return $rc;
}
sub fetch_row($$)
{
my($self, $data) = @_;
if($self->{'cursor'} >= $data->{'rows'}) {
return;
}
$self->{'cursor'}++;
my @fields = map { $self->{'data'}->{$self->{'cursor'}}->{$_ } } @{$self->{'col_names'}};
$self->{'row'} = \@fields;
return $self->{'row'};
}
sub seek($$$$)
{
my($self, $data, $pos, $whence) = @_;
print "seek $pos $whence, not yet implemented\n";
}
sub complete_table_name($$$$)
{
my($self, $meta, $file, $respect_case, $file_is_table) = @_;
}
sub open_data
{
# my($className, $meta, $attrs, $flags) = @_;
}
sub bootstrap_table_meta
{
my($class, $dbh, $meta, $table, @other) = @_;
$class->SUPER::bootstrap_table_meta($dbh, $meta, $table, @other);
$meta->{table} = $table;
$meta->{sql_data_source} ||= __PACKAGE__;
}
sub get_table_meta($$$$;$)
{
my($class, $dbh, $table, $file_is_table, $respect_case) = @_;
my $meta = $class->SUPER::get_table_meta($dbh, $table, $respect_case, $file_is_table);
$table = $meta->{table};
return unless $table;
return($table, $meta);
( run in 0.335 second using v1.01-cache-2.11-cpan-1f129e94a17 )