leegold wrote (off list):

So, something like:

$dbh->{csv_sep_char}='###';

would work, you think?

Hi,


First, please respond to the list rather than to an individual. The individual might be busy :-). Also, if the answer is on the list, then everyone can learn from it.

The {csv_sep_char} is a *character* so it could accept '#', but not '###'. DBD::AnyData allows you to create your own formats though. If you don't have embedded '###' in your data, then this simple three line module will allow DBD::AnyData to parse files with '###' as a field separator. Just Save this file under the name 'ThreeSharp.pm' in the AnyData/Format directory where your copy of AnyData is located:

    package AnyData::Format::ThreeSharp;
    use base 'AnyData::Format::Base';
    sub write_fields  { shift; sprintf "%s\n",join '###',@_ }
    sub read_fields   { split '###', $_[1] }
    1;

Then in your perl script do this:

    use DBI;
    my $dbh = DBI->connect('dbi:AnyData(RaiseError=1):');
    $dbh->ad_catalog( $table_name, 'ThreeSharp', $file_name);
    #
    # you can now use any SQL you want to access/modify $table_name
    # results will be stored in $file_name with '###' as a field
    # separator

--
Jeff




Reply via email to