Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Multiple dBases through 3 dim array???

Quote Reply
Multiple dBases through 3 dim array???
I was working on adding a few extra databases to the Links2 program and noticed how %db_def is set up then hashed into $db_cols.... IS it possible to have unlimited dbases automatically reflect through-out all programs...i.e. db_def1....db_def2...etc.....
add a variable called $db_total = 5;
then just add another nested loop over top of the hash in links.def????
**************************
# Build up some variables from your definitions. Internal use only.
@db_cols = ();
for ($i = 0; $1 < $db_total; $i++){
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
($_ eq $db_key) and $db_key_pos = $db_def{$_}[0];
}
}
***********************

something like this anyway.... I know it will have to reflect wherever $db_cols gets called....and the %rec hash will have to be passed through loops as well.....
Any feedback whether or not this is a go on a potentialy unlimited useful mod???