Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: One Question about DBF

by padawan_linuxero (Scribe)
on Oct 18, 2007 at 18:43 UTC ( [id://645807]=note: print w/replies, xml ) Need Help??


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

Hello jZed
I try you code and put what a like to think are the correct parameters and did not work :o(
Ok I am going very level with you I just need to get all data from a DBF table and put it in a CSV file
here you can look at my code and please tell me what is wrong
thanks
use DBI; my $dbhX = DBI->connect("DBI:XBase:/proyecto"); my $dbhA = DBI->connect( 'dbi:AnyData:' ); my $sth = $dbhX->prepare("SELECT * FROM reg501"); $sth->execute(); $dbhA->do("CREATE TABLE etstx AS SELECT * FROM ?",{}, $sth);
TIA

Replies are listed 'Best First'.
Re^3: One Question about DBF
by jZed (Prior) on Oct 18, 2007 at 18:48 UTC
    Oh, sorry, yeah, after the $dbhA line put this:
    $dbhA->ad_catalog('etstx','CSV','etstx.csv');
    The first param is the table name to use in your SQL, the second the format of the file the table will be stored in, the third the path/filename of the file.

    update : added the missing ad_

      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);
        Sorry again, not enough coffee this morning - should be $dbh->ad_catalog().

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://645807]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2026-04-22 21:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.