~skinny.moey/drizzle/branch-rev

« back to all changes in this revision

Viewing changes to storage/myisam/ftbench/Ecreate.pl

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
$test=shift || die "Usage $0 testname [option]";
 
4
$option=shift;
 
5
 
 
6
open(D, "<data/$test.d") || die "Cannot open(<data/$test.d): $!";
 
7
open(Q, "<data/$test.q") || die "Cannot open(<data/$test.q): $!";
 
8
 
 
9
$N=0;
 
10
 
 
11
print <<__HEADER__;
 
12
DROP TABLE IF EXISTS $test;
 
13
CREATE TABLE $test (
 
14
  id int(10) unsigned NOT NULL,
 
15
  text text NOT NULL,
 
16
  FULLTEXT KEY text (text)
 
17
) TYPE=MyISAM CHARSET=latin1;
 
18
 
 
19
ALTER TABLE $test DISABLE KEYS;
 
20
__HEADER__
 
21
 
 
22
while (<D>) { chomp;
 
23
  s/'/\\'/g; ++$N;
 
24
  print "INSERT $test VALUES ($N, '$_');\n";
 
25
}
 
26
 
 
27
print <<__PREP__;
 
28
ALTER TABLE $test ENABLE KEYS;
 
29
SELECT $N;
 
30
__PREP__
 
31
 
 
32
$N=0;
 
33
 
 
34
while (<Q>) { chomp;
 
35
  s/'/\\'/g; ++$N;
 
36
  $_="MATCH text AGAINST ('$_' $option)";
 
37
  print "SELECT $N, id, $_ FROM $test WHERE $_;\n";
 
38
}
 
39
 
 
40
print <<__FOOTER__;
 
41
DROP TABLE $test;
 
42
__FOOTER__
 
43
 
 
44