3 # Copyright 2009-2012, Equinox Software, Inc.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 my $startOfColumnTypes = 8;
33 my $rowlength = ord(substr($dbd, 0, 1)) + (256 * (ord(substr($dbd, 1, 1))));
34 my $numcolumns = ord substr($dbd, 2, 1);
37 ord substr($dbd, 4, 1),
38 ord substr($dbd, 5, 1),
39 ord substr($dbd, 6, 1),
41 my $delimiter = sprintf(
43 ord substr($dbd, 7, 1),
46 my $colnames = substr($dbd, $startOfColumnTypes + 7*$numcolumns - 2);
47 my @col = split(/\x00/, $colnames);
49 print "Row length: $rowlength\n";
50 print "Columns: $numcolumns\n";
51 print "Extra data: $extra\n";
52 print "Delimiter: $delimiter\n";
54 for (my $i = 1; $i <= $numcolumns; $i++) {
55 my $coltype = substr($dbd, 7*($i-1)+$startOfColumnTypes, 1);
56 my $collength = ord substr($dbd, 7*($i-1)+$startOfColumnTypes+1, 1);
57 printf ("Column %02d: %-8s %s (%d chars)\n", $i, $coltypes{$coltype}, $col[$i-1], $collength);