Bmdfilelist.pm functions
- new
- Creates an empty new table object.
- Not meant for public usage:
$bmd->{"tablefiles"} = new Bmdfilelist; # From Bmd->readindexfile()
- destroy
- Removes specified group or file from the filelist data structures.
- Not meant for public usage:
# I don't think I ever used this. I use &wipeout() instead. Oh well.
$bmd->{"tablefiles"}->destroy($bmd,"tablename","tblfile"); # destroy a .tbl file listing
$bmd->{"tablefiles"}->destroy($bmd,"tablename"); # destroy all file listings for a table
$bmd->{"schemafiles"}->destroy($bmd,"schfile","tablename"); # destroy a schema listing
$bmd->{"schemafiles"}->destroy($bmd,"schfile"); # destroy all listings in a .sch file
- wipeout
- This is the way I delete file listings. &wipeout() just zeros out the line
boundary listings on table listings and marks every dirty bit as modified.
- Not meant for public usage:
# Bmdschema->destroy()
uses it like this:
$bmd->{"schemafiles"}->wipeout("schfile", "tablename"); # destroy a schema listing
# Bmdtable->destroy() uses it
like this:
$bmd->{"tablefiles"}->wipeout("tablename"); # destroy all file listings for a table
- add
- Inserts new file listings under a given group name.
- Not meant for public usage:
# Bmd->readindexfile() uses
it like this:
$bmd->{"tablefiles"}->add("tablename, "tblfilename1", "tblfilename2", ...);
#
Bmdschema->readschemafiles() uses it like this:
$bmd->{"schemafiles"}->add("schfilename", "tablename");
- exists
- Returns a one or zero indicating the existence of a give group name and/or file
name listing.
- Not meant for public usage:
# Bmdschema->destroy()
uses it like this:
if ($bmd->{"schemafiles"}->exists("schfilename", "tablename")) {blahblah;}
# This works too:
$trueorfalse = $bmd->{"tablefiles"}->exists("tablename");
- listfiles
- Returns an array containing the first element slice of the Bmdfilelist double
array data structure. For $bmd->{"tablefiles"}, that is a list of file names.
For $bmd->{"schemafiles"}, it's really a list of table names.
- Usage (Through Bmd->listtablefiles wrapper):
my @tablefilenames = $bmd->listtablefiles("tablename");
# Bmdtable->readtablefiles()
uses it like this:
foreach $filename ($bmd->{"tablefiles"}->listfiles("tablename")) {readfile;}
- listgroups
- Returns an array containing all the group names in the Bmdfilelist double
array data structure. For $bmd->{"tablefiles"}, that is a list of table names.
For $bmd->{"schemafiles"}, it's really a list of schema file names.
- Usage (Through Bmd->listschemafiles wrapper):
my @schemafilenames = $bmd->listschemafiles();
# Bmdschema->savetest()
uses it like this:
foreach $file ($bmd->{"schemafiles"}->listgroups()) {checkpermissions;}
- touch
- Marks the dirty bit on a file listing as modified. You can specify the file
by name or by which line a table was modified if you don't know the name.
- Not meant for public usage:
# Bmdschema->destroy()
uses it like this:
$bmd->{"schemafiles"}->touch("schfilename", "tablename");
# Bmdtable->update() uses
it like this:
$bmd->{"tablefiles"}->touch("tablename", undef, $modified_record_number);
- addlines
- Used to shift the line number boundaries on a table file listing when a new
record is inserted. You must specify the record number of the new record.
You could handle the inserting of several lines starting at that recnum by
also supplying a record count.
- Not meant for public usage:
# Bmdtable->insert_pos()
uses it like this:
$bmd->{"tablefiles"}->addlines("tablename", $newrecnum);
# This works too.
$bmd->{"tablefiles"}->addlines("tablename", $newrecnum, 1);
- deletelines
- Used to shift the line number boundaries on a table file listing when a record
is deleted. You must specify the record number of the offending record. You could
handle the deletion of several lines starting at that recnum by also supplying a
record count.
- Not meant for public usage:
# Bmdtable->delete_pos()
uses it like this:
$bmd->{"tablefiles"}->deletelines("tablename", $deadrecnum);
# This works too.
$bmd->{"tablefiles"}->deletelines("tablename", $deadrecnum, 1);
- ismodified
- Returns the value of the dirty bit for a file listing specified by group name
and/or file name. If just a group is given, then &ismodified returns true if
any of that group's file listing are modified.
- Not meant for public usage:
# Bmdschema->saveallfiles()
uses it like this:
if ($bmd->{"schemafiles"}->ismodified("schfilename")) {savefile;}
# This works too:
if ($bmd->{"tablefiles"}->ismodified("tablename", "tblfilename")) {savefile;}
- listmodified
- Returns an array of modified file names from a given group name. For Bmdschema,
this would really return a list of table names whose schemas were modified.
- Not meant for public usage:
# Bmdtable->saveallfiles()
uses it like this:
foreach $file ($bmd->{"tablefiles"}->listmodified("tablename")) {savefile;}
# This works too:
my @modifiedschemas = $bmd->{"schemafiles"}->listmodified("schfilename");
- getbounds
- Returns the record number boundaries for a given tablename and table filename.
You have to include the tablename. For Bmdschema, this does nothing since the
boundary numbers are not used. The two bounds are in an array of two elements.
- Not meant for public usage:
# Bmdtable->savefile()
uses it like this:
($low, $high) = $bmd->{"tablefiles"}->getbounds("tablename", "tblfilename");
- setbounds
- Used to manually set the record number boundaries for a given tablename and
table file name. For Bmdschema, this does nothing since the boundary numbers
are not used. Note, this will not set the dirty bit to modified.
- Not meant for public usage:
# Bmdtable->readtablefiles()
uses it like this:
$bmd->{"tablefiles"}->setbounds("tablename", "tblfilename", $firstnum, $lastnum);}
- getfilelistref
- Returns a reference to the 2D array that contains the listings for a specified
group. This is a direct connection into the Bmdfilelist object data structure.
Use with caution.
- Not meant for public usage:
# Bmdschema->savefile()
uses it like this:
my $2Darrayref = $bmd->{"schemafiles"}->getfilelistref("schfilename");
- renamefile
- Changes the name of a file specified by its group name and old file name. It's
used during a "Save As".
- Not meant for public usage:
# Bmdtable->saveallfile()
uses it like this:
$bmd->{"tablefiles"}->renamefile("tablename", "oldfilename", "newfilename");
- renamegroup
- Changes the name of a specified group. It's used during a "Save As".
- Not meant for public usage:
# Bmdschema->savefile()
uses it like this:
$bmd->{"schemafiles"}->renamegroup($file, $newfile);