in reply to Re^3: One Question about DBF
in thread One Question about DBF

Hi jZed!
I added the line as you told me but it gave me these error
Can't locate object method "catalog" via package "DBI::db" at testdbf.pl line 5.
This is the code
use DBI; my $dbhX = DBI->connect("DBI:XBase:/proyecto"); my $dbhA = DBI->connect( 'dbi:AnyData:' ); $dbhA->catalog('etstx','CSV','etstx.csv'); my $sth = $dbhX->prepare("SELECT * FROM reg501"); $sth->execute(); $dbhA->do("CREATE TABLE etstx AS SELECT * FROM ?",{}, $sth);

Replies are listed 'Best First'.
Re^5: One Question about DBF
by jZed (Prior) on Oct 18, 2007 at 19:04 UTC
    Sorry again, not enough coffee this morning - should be $dbh->ad_catalog().
      Hi jZed!!!
      this is the code :
      use DBI; my $dbhX = DBI->connect("DBI:XBase:/proyecto"); my $dbhA = DBI->connect( 'dbi:AnyData:' ); $dbhA->ad_catalog('etstx','CSV','etstx.csv'); my $sth = $dbhX->prepare("SELECT * FROM reg501"); $sth->execute(); $dbhA->do("CREATE TABLE etstx AS SELECT * FROM ?",{}, $sth);
      So my cuestion is where do I put the $dbh->ad_catalog()
        It's in the right place, I just meant that you should replace $dbhA->catalog(...) with $dbhA->ad_catalog().

        you should probably also set $dbhA->{RaiseError} to 1 or trap errors on each call.