Gossamer Forum
Home : Products : DBMan : Customization :

add record delimiter?

Quote Reply
add record delimiter?
Is there a way to change the database format so that one could read in any data text files (e.g. records separated by commas while fields are separated by semicolons)?
Since my database file is being dynamically updated by another script it seems awkward to have to read in the file and then write it out to another file in a format that DBMan can accept (i.e. records separated by newlines).

Ziggy Fish

Quote Reply
Re: add record delimiter? In reply to
Using semicolons is not a good idea for delimiters...what you could do is switch your delimiter character, which is controlled by the $db_delim variable in the default.cfg file to something like a tab delimited character \t.

Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: add record delimiter? In reply to
You are of course referring to the field delimiter. But what I would like is a <b>record delimiter</b>. DBMan is essentially using newline by reading in the database file into an array of lines (and parsing the line into the fields). i.e.
" @lines = <DB>;"
and then:
" LINE: foreach $line (@lines) {
if ($line =~ /^$/) { next LINE; }
..."

What I would like is something like:
>>read from file until you hit $rec_delim<< (instead of read until EOL)
For example by reading in the file and assigning it to an array via split along the hypothetical $rec_delim.
@entries = split($rec_delim, <DB>);

Makes sense?
Ziggy Fish


Quote Reply
Re: add record delimiter? In reply to
Have you by any chance checked out the FAQ noted below under the section "Files / Records"?

Under the subsection "SSI & External Files" you may find just want you are looking for. There's alot of hidden tips and tricks within referenced threads. I know I have seen a modification to work with external files formatted for instance on separate lines.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/