Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^6: One Question about DBF

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


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

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()

Replies are listed 'Best First'.
Re^7: One Question about DBF
by jZed (Prior) on Oct 18, 2007 at 19:26 UTC
    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.

      Sorry to bug you so much :o)
      I did that this is like the code looks like
      use DBI; my $dbhX = DBI->connect("DBI:XBase:/proyecto"); my $dbhA = DBI->connect('dbi:AnyData(RaiseError=>1):'); $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);
      and I run it and it send a very long error message :
      SQL ERROR: Bad table or column name '?' has chars not alphanumeric or +underscore! DBD::AnyData::db do failed: SQL ERROR: Bad table or column name '?' ha +s chars not alphanumeric or underscore! Can't call method "execute" on an undefined value at C:/Perl/site/lib/ +SQL/Statement.pm line 254. [for Statement "SELECT * FROM ?"] at testdbf.pl line 8. DBD::AnyData::db do failed: SQL ERROR: Bad table or column name '?' ha +s chars not alphanumeric or underscore! Can't call method "execute" on an undefined value at C:/Perl/site/lib/ +SQL/Statement.pm line 254. [for Statement "SELECT * FROM ?"] at testdbf.pl line 8.

        > Sorry to bug you so much :o)

        Au contraire, I'm sorry to be supplying you with bad examples of my own modules. Please use the code in my updated original node, I tried it, it works. Let me know if this works for you, sorry for all the confusion.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2026-04-22 21:40 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.