[packages/perl-DBD-AnyData] Rel 2: port to current DBI::DBD::SqlEngine table API

arekm arekm at pld-linux.org
Thu Nov 19 14:01:47 CET 2026


commit 9c62c99304641d1ce43f11ee572703cbf6bb0b36
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Nov 19 12:46:28 2026 +0100

    Rel 2: port to current DBI::DBD::SqlEngine table API

 perl-DBD-AnyData-sqlengine-api.patch | 110 +++++++++++++++++++++++++++++++++++
 perl-DBD-AnyData.spec                |   4 +-
 2 files changed, 113 insertions(+), 1 deletion(-)
---
diff --git a/perl-DBD-AnyData.spec b/perl-DBD-AnyData.spec
index 2deb10c..8f232ce 100644
--- a/perl-DBD-AnyData.spec
+++ b/perl-DBD-AnyData.spec
@@ -8,12 +8,13 @@ Summary:	DBD::AnyData - DBI access to XML, CSV and other formats
 Summary(pl.UTF-8):	DBD::AnyData - dostęp DBI do XML-a, CSV i innych formatów
 Name:		perl-DBD-AnyData
 Version:	0.110
-Release:	1
+Release:	2
 # same as perl
 License:	GPL v1+ or Artistic
 Group:		Development/Languages/Perl
 Source0:	https://www.cpan.org/modules/by-authors/id/R/RE/REHSACK/%{pdir}-%{pnam}-%{version}.tar.gz
 # Source0-md5:	cfb6e286ddc1ff06fc40f8e2053ff66f
+Patch0:		%{name}-sqlengine-api.patch
 URL:		http://search.cpan.org/dist/DBD-AnyData/
 %if %{with tests}
 BuildRequires:	perl-AnyData
@@ -50,6 +51,7 @@ dostępne przez DBI.
 
 %prep
 %setup -q -n %{pdir}-%{pnam}-%{version}
+%patch -P0 -p1
 
 %build
 %{__perl} Makefile.PL \
diff --git a/perl-DBD-AnyData-sqlengine-api.patch b/perl-DBD-AnyData-sqlengine-api.patch
new file mode 100644
index 0000000..0b87eab
--- /dev/null
+++ b/perl-DBD-AnyData-sqlengine-api.patch
@@ -0,0 +1,110 @@
+# DBI::DBD::SqlEngine table API: sql_data_source and Table->new($data,$attrs,$flags)
+--- DBD-AnyData-0.110.orig/lib/DBD/AnyData.pm
++++ DBD-AnyData-0.110/lib/DBD/AnyData.pm
+@@ -492,6 +492,16 @@
+ 
+ # sub finish ($) {}
+ 
++package DBD::AnyData::DataSource;
++
++use strict;
++use warnings;
++
++ at DBD::AnyData::DataSource::ISA = qw(DBI::DBD::SqlEngine::DataSource);
++
++# the table is looked up in the AnyData catalog by open_table
++sub complete_table_name { 1 }
++
+ package DBD::AnyData::Statement;
+ 
+ use strict;
+@@ -499,10 +509,30 @@
+ 
+ @DBD::AnyData::Statement::ISA = qw(DBI::DBD::SqlEngine::Statement);
+ 
+-sub open_table ($$$$$)
++package DBD::AnyData::Table;
++
++use strict;
++use warnings;
++
++use Params::Util qw(_HASH0);
++
++ at DBD::AnyData::Table::ISA = qw(DBI::DBD::SqlEngine::Table);
++
++sub bootstrap_table_meta
+ {
+-    my ( $self, $data, $tname, $createMode, $lockMode ) = @_;
+-    my $dbh = $data->{Database};
++    my ( $self, $dbh, $meta, @other ) = @_;
++    $meta->{sql_data_source} ||= 'DBD::AnyData::DataSource';
++    return $self->SUPER::bootstrap_table_meta( $dbh, $meta, @other );
++}
++
++sub new
++{
++    my ( $class, $data, $attrs, $flags ) = @_;
++    my $dbh   = $data->{Database};
++    my $tname = $attrs->{table};
++    my $createMode = $flags->{createMode};
++    my $lockMode   = $flags->{lockMode};
++
+     my $catalog = $dbh->func( $tname, 'ad_get_catalog' );
+     if ( !$catalog )
+     {
+@@ -514,22 +544,13 @@
+     my $format = $catalog->{format};
+     my $file   = $catalog->{file_name};
+     my $ad     = $catalog->{ad}
+-      #################################################################
+-      # Patch from Wes Hardaker
+-      #################################################################
+-      #    || AnyData::adTable( $format, $file, $createMode, $lockMode,
+-      #                         $catalog );
+       || AnyData::adTable( $format, $file, $createMode, $lockMode, $catalog, $tname );
+-    #print join("\n", $format,@$file,$createMode), "\n";
+-    #use Data::Dumper; print Dumper $catalog;
+-    #################################################################
+     my $table = $ad->prep_dbd_table( $tname, $createMode );
+-    my $cols = $table->{col_names};
++    my $cols  = $table->{col_names};
+     if ( $cols and ref $cols ne 'ARRAY' )
+     {
+-        #$dbh->DBI::set_err(99, "\n  $cols\n ");
+-        print "\n  $cols\n ";
+-        exit;
++        $dbh->set_err( $DBI::stderr, $cols );
++        return;
+     }
+     if (    'Base XML HTMLtable' =~ /$catalog->{format}/
+          or $file =~ /http:|ftp:/
+@@ -539,25 +560,10 @@
+         $dbh->func( $tname, 'ad', $ad, 'ad_mod_catalog' );
+     }
+ 
+-    return DBD::AnyData::Table->new($table);
+-}
+-
+-package DBD::AnyData::Table;
+-
+-use strict;
+-use warnings;
+-
+-use Params::Util qw(_HASH0);
+-
+- at DBD::AnyData::Table::ISA = qw(DBI::DBD::SqlEngine::Table);
+-
+-sub new
+-{
+-    my ( $proto, $attr ) = @_;
+-    $attr->{col_names} = $attr->{ad}->{storage}->{col_names};
+-    $attr->{col_nums}  = $attr->{ad}->{storage}->{col_nums};
+-    delete $attr->{col_nums} unless ( defined( $attr->{col_nums} ) and defined( _HASH0( $attr->{col_nums} ) ) );
+-    return $proto->SUPER::new($attr);
++    $table->{col_names} = $ad->{storage}->{col_names};
++    $table->{col_nums}  = $ad->{storage}->{col_nums};
++    delete $table->{col_nums} unless ( defined( $table->{col_nums} ) and defined( _HASH0( $table->{col_nums} ) ) );
++    return $class->SQL::Eval::Table::new($table);
+ }
+ 
+ sub trim
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/perl-DBD-AnyData.git/commitdiff/9c62c99304641d1ce43f11ee572703cbf6bb0b36



More information about the pld-cvs-commit mailing list