in reply to DBD:CSV and creating a database
For what it's worth: I always build my SQL in a scalar before sending it to prepare(). Then I can print it out while debugging to make sure what you built is what you expected. Typically I code against Postgres and will simply copy and paste the "debug" statement into the DB's shell to make sure it does what I think, a luxury you don't have with DBD::CSV.
My code often looks like this when I am debugging it:
If your only inserting data to a CSV file (as opposed to doing selects, etc) you might consider just using Text::CSV_XS which eliminates a lot of complexity/overhead.my $sql = "create table x as (y text)"; #DEBUG (it's this output that I copy/paste) print "$sql\n"; #or perhaps die "$sql\n"; $dbh->do($sql) or die $dbh->errstr() ...
|
|---|