File: combine_db.pl

package info (click to toggle)
phpwiki 1.3.14-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 15,716 kB
  • ctags: 23,548
  • sloc: php: 88,295; sql: 1,476; sh: 1,378; perl: 765; makefile: 602; awk: 28
file content (28 lines) | stat: -rwxr-xr-x 580 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl
# combine the ploticus data files for all database backends
# // test	nr	file	dba	SQL	ADODB

@DB = qw/file dba SQL ADODB/;
for $db (@DB) {
  open F, "< all_$db.data" or die;
  $i=0;
  while (<F>) {
    chomp;
    if (/^(\d+)\t(.+)/) {
      $t{$i} = "\"$2\"" unless $t{$i};
      $m{$db}{$i++} = $1;
    }
  }
  close F;
  $max = $max < $i ? $i : $max;
}
open F, "> combine_db.data";
print F "// test\tinc\t",join("\t",@DB),"\n";
$i=0;
do {
  print F $t{$i};
  print F "\t",$i;
  for $db (@DB) { print F "\t",$m{$db}{$i}; }
  print F "\n";
} while ($i++ < $max);