Algorithm-SpatialIndex
view release on metacpan or search on metacpan
lib/Algorithm/SpatialIndex/Storage/DBI.pm view on Meta::CPAN
package Algorithm::SpatialIndex::Storage::DBI;
use 5.008001;
use strict;
use warnings;
use Carp qw(croak);
our $VERSION = '0.02';
use parent 'Algorithm::SpatialIndex::Storage';
use constant DEBUG => 0;
=head1 NAME
Algorithm::SpatialIndex::Storage::DBI - DBI storage backend
=head1 SYNOPSIS
use Algorithm::SpatialIndex;
my $dbh = ...;
my $idx = Algorithm::SpatialIndex->new(
storage => 'DBI',
dbh_rw => $dbh,
dbh_ro => $dbh, # defaults to dbh_rw
table_prefix => 'si_',
);
=head1 DESCRIPTION
B<WARNING: WHILE IT SEEMS TO WORK FOR ME, THIS STORAGE BACKEND IS HIGHLY
EXPERIMENTAL AND IN A PROOF-OF-CONCEPT STATE.> Unsurprisingly, it is also
20x slower when using SQLite as the storage engine then when using the
memory storage backend. Has only been tested with SQLite but has
mysql-specific and SQLite specific code paths as well as a general
SQL code path which is less careful about race conditions.
Inherits from L<Algorithm::SpatialIndex::Storage>.
This storage backend is persistent.
No implementation of schema migration yet, so expect to have to
reinitialize the index after a module upgrade!
=head1 ACCESSORS
=cut
use constant NODE_ID_TYPE => 'INTEGER';
use constant ITEM_ID_TYPE => 'INTEGER';
use Class::XSAccessor {
getters => [qw(
dbh_rw
table_prefix
no_of_coords
coord_types
node_coord_create_sql
node_coord_select_sql
node_coord_insert_sql
no_of_subnodes
subnodes_create_sql
subnodes_select_sql
subnodes_insert_sql
bucket_size
item_coord_types
( run in 0.802 second using v1.01-cache-2.11-cpan-d8267643d1d )