Apache-Wyrd
view release on metacpan or search on metacpan
t/7_mysqlindex.t view on Meta::CPAN
use strict;
use warnings;
no warnings qw(uninitialized);
use Cwd;
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw(GET_BODY GET_OK);
use Apache::Wyrd::Services::MySQLIndex;
my $directory = getcwd();
#Note -- This line is to silence some errors using Apache::Test v. 1.19
eval 'use lib $directory';
$directory = "$directory/t" if (-d 't');
my $index = undef;
my $dbh = undef;
my $count = &count;
eval <<'EVAL';
use DBI;
$dbh = DBI->connect('DBI:mysql:test', 'test', '');
EVAL
if ($@) {
$count = 0;
warn "Could not initialize a connection to database 'test': $@";
} elsif (!$dbh) {
$count = 0;
warn "DBI Connection failed to be opened.";
}
my $create_routine = <<"CREATE";
drop table if exists _wyrd_index;
create table _wyrd_index (
id integer not null auto_increment primary key,
name varchar(255) unique not null,
timestamp long,
digest char(40),
data blob,
wordcount integer,
title varchar(255),
keywords varchar(255),
description text,
regular varchar(255),
map varchar(255)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
drop table if exists _wyrd_index_data;
create table _wyrd_index_data (
item varchar(255) not null,
id integer,
tally integer
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
drop table if exists _wyrd_index_regular;
create table _wyrd_index_regular (
item varchar(255) not null,
id integer,
tally integer
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
drop table if exists _wyrd_index_map;
create table _wyrd_index_map (
item varchar(255) not null,
id integer,
tally integer
) ENGINE=MyISAM DEFAULT CHARSET=utf8
CREATE
for my $query (split ';', $create_routine) {
last if ($count == 0);
my $sh = $dbh->prepare($query);
( run in 2.375 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )