[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: database of maintainers



> 	The data collected by the ongoing effort to collect maintainer
>  information is gathered an kept in a | delimited flat text file,
>  which is working quite well, at the moment.
...
>   Cons: 
>    b) Adding new columns (fields) can be tricky; have to modify all
>       report scripts

If you make the first line of the database contain the column names, and refer 
to the data indirectly via an index of these names, then adding columns is not 
a problem.

If you need random access, then it is trivial to read a text database as you 
describe, and write a dbm file.

I have a little perl library for doing the column name stuff.  If there is any 
interest, I'll publish it.  Here is the documentation example:

;#  &get_top_line(top_line)
;#      This initialises the variables used for determining the column numbers
;#  &idx_val(name,type)
;#      This returns the column number for a named heading
;#
;#      They are used thus:
;#
;#            open(FILE,"<database_name") || die "open failed" ;
;#
;#            &get_top_line($tl=<FILE>) ;
;#            # set up index-no's
;#            $KEY = &idx_val("KEY") ;
;#            $NAME = &idx_val("NAME") ;
;#            $AGE = &idx_val("AGE", "optional") ;
;#
;#            while(<FILE>) {
;#              chop ;
;#              @fields = () ;
;#              @fields = split($;) ;
;#
;#              if ($AGE != -1) {
;#                printf "Key:%s --> %s (%s)\n",
;#                       $fields[$KEY], $fields[$NAME], $fields[$AGE] ;
;#              } else {
;#                printf "Key:%s --> %s\n",
;#                       $fields[$KEY], $fields[$NAME] ;
;#              }
;#            }
;#            close(FILE) ;
;#
;#   The functions assume that the data files have records delimited by <LF>'s
;#   (0x0A) and fields are delimited by perl's $; separator (default value <FS>
;#   (0x1C))

Cheers, Phil.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . Trouble? 
e-mail to templin@bucknell.edu .


Reply to: