version 1.1, 2001/10/31 03:00:10
|
version 1.3, 2001/11/01 01:44:59
|
Line 1
|
Line 1
|
#!/usr/local/bin/perl -w
|
#!/usr/bin/perl -w |
|
|
=head1 NAME
|
=head1 NAME |
|
|
dumpRS.pl - скрипт для создания дампа таблицы word2question.
|
dumpRS.pl - скрипт для создания дампа таблицы word2question. |
|
|
=head1 SYNOPSIS
|
=head1 SYNOPSIS |
|
|
dumpRS.pl output
|
dumpRS.pl output |
|
|
=head1 DESCRIPTION
|
=head1 DESCRIPTION |
|
|
Создаёт дамп таблицы word2question. Формат записи:
|
Создаёт дамп таблицы word2question. Формат записи: |
идентификатор слова (2 байта), длина поля questions (4 байта),
|
идентификатор слова (2 байта), длина поля questions (4 байта), |
содержимое поля questions.
|
содержимое поля questions. |
|
|
=head1 AUTHOR
|
=head1 AUTHOR |
|
|
Роман Семизаров
|
Роман Семизаров |
|
|
|
|
=cut
|
=cut |
|
|
|
use lib "../lib"; |
use dbchgk;
|
use dbchgk; |
|
|
|
|
my $output=shift;
|
my $output=shift; |
|
|
if (!$output)
|
if (!$output) |
{
|
{ |
print "Usage: dumpRS.pl output\n";
|
print "Usage: dumpRS.pl output\n"; |
exit
|
exit |
}
|
} |
|
|
open OUT, ">$output" or die "Can not open $output";
|
open OUT, ">$output" or die "Can not open $output"; |
binmode(OUT);
|
binmode(OUT); |
open STDERR, ">errors";
|
open STDERR, ">errors"; |
getword2question;
|
getword2question; |
|
|
while (($word,$quest)=getrow,$word)
|
while (($word,$quest)=getrow,$word) |
{
|
{ |
print "$sch...\n" unless (++$sch%100);
|
print "$sch...\n" unless (++$sch%100); |
print OUT pack("L",$word);
|
print OUT pack("L",$word); |
print OUT pack("L", length $quest);
|
print OUT pack("L", length $quest); |
print OUT $quest;
|
print OUT $quest; |
}
|
} |
|
|
|
|