Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removing obselete files.

  • Loading branch information...
commit 8d3a7c651bfc197dfdeebeba5e8eefa2e3d9031e 1 parent fd3e0eb
Barbie authored
9 t/00basic.t
View
@@ -1,9 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use Test::More tests => 1;
-
-BEGIN {
- use_ok("Data::Phrasebook::Loader::Ini");
-}
-
9 t/02phrases.ini
View
@@ -1,9 +0,0 @@
-[BASE]
-find_series=\
- select title,author from books where class = :series
-find_author=\
- select title,author from books where author = :author
-count_author=\
- select count(1)\
- from books\
- where author = :author
71 t/02shorts.t
View
@@ -1,71 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-use lib 't';
-use vars qw( $class );
-use BookDB;
-
-use Test::More tests => 5;
-
-# ------------------------------------------------------------------------
-
-$class = 'Data::Phrasebook';
-use_ok $class;
-
-my $file = 't/02phrases.ini';
-
-# ------------------------------------------------------------------------
-
-{
- my $dbh = BookDB->new();
-
- my $obj = $class->new(
- class => 'SQL',
- dbh => $dbh,
- loader => 'Ini',
- file => $file,
- );
-
- my ($count) = $obj
- ->query( 'count_author', {
- author => 'Lawrence Miles'
- } )
- ->fetchrow_array;
-
- is( $count => 7, "Quick Miles" );
-}
-
-{
- my $dbh = BookDB->new();
-
- my $obj = $class->new(
- class => 'SQL',
- dbh => $dbh,
- loader => 'Ini',
- file => $file,
- );
-
- my $author = 'Lawrence Miles';
- my $q = $obj->query( 'find_author' );
- isa_ok( $q => 'Data::Phrasebook::SQL::Query' );
-
- # Slow
- {
- my $count = 0;
- $q->execute( author => $author );
- while ( my $row = $q->fetchrow_hashref )
- {
- $count++ if $row->{author} eq $author;
- }
- is( $count => 7, "row by row Miles" );
- $q->finish;
- }
-
- # fetchall_arrayref
- {
- my $count = 0;
- $q->execute( author => $author );
- my $r = $q->fetchall_arrayref;
- is ( scalar @$r => 7, "fetchall Miles" );
- $q->finish;
- }
-}
3  t/03phrases.ini
View
@@ -1,3 +0,0 @@
-[BASE]
-find_author=\
- select class,title,author from books where author = :author
92 t/03sql.t
View
@@ -1,92 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-use lib 't';
-use vars qw( $class );
-use BookDB;
-
-use Test::More tests => 7;
-
-# ------------------------------------------------------------------------
-
-$class = 'Data::Phrasebook';
-use_ok $class;
-
-my $file = 't/03phrases.ini';
-
-# ------------------------------------------------------------------------
-
-{
- my $dbh = BookDB->new();
-
- my $obj = $class->new(
- class => 'SQL',
- dbh => $dbh,
- loader => 'Ini',
- file => $file,
- );
- my $author = 'Lance Parkin';
- my $q = $obj->query( 'find_author', {
- author => \$author,
- });
- isa_ok( $q => 'Data::Phrasebook::SQL::Query' );
-
- $q->prepare();
-
- {
- my $count = 0;
- $q->execute();
- while ( my $row = $q->fetchrow_hashref )
- {
- $count++ if $row->{author} eq $author;
- }
- is( $count => 7, "7 Parkins" );
- $q->finish();
- }
-
- {
- my $count = 0;
- $author = 'Paul Magrs';
- $q->execute();
- while ( my $row = $q->fetchrow_hashref )
- {
- $count++ if $row->{author} eq $author;
- }
- is( $count => 3, "3 Magrs" );
- $q->finish();
- }
-
- {
- my $count = 0;
- $q->execute( author => 'Lawrence Miles' );
- while ( my $row = $q->fetchrow_hashref )
- {
- $count++ if $row->{author} eq 'Lawrence Miles';
- }
- is( $count => 7, "7 Miles" );
- $q->finish();
- }
-}
-
-{
- my $dbh = BookDB->new();
-
- my $obj = $class->new(
- class => 'SQL',
- dbh => $dbh,
- loader => 'Ini',
- file => $file,
- );
- my $author = 'Lance Parkin';
- my $q = $obj->query( 'find_author' );
- isa_ok( $q => 'Data::Phrasebook::SQL::Query' );
-
- {
- my $count = 0;
- $q->execute( author => 'Lawrence Miles' );
- while ( my $row = $q->fetchrow_hashref )
- {
- $count++ if $row->{author} eq 'Lawrence Miles';
- }
- is( $count => 7, "7 more Miles" );
- }
-}
126 t/BookDB.pm
View
@@ -1,126 +0,0 @@
-package BookDB;
-
-my $dbh;
-my $bind = '';
-my $oldq = '';
-
-sub new
-{
- my $self = shift;
-
- # create an attributes hash
- my $atts = {
- 'sql' => undef,
- 'res' => [0],
- };
-
- # create the object
- bless $atts, $self;
- $dbh = $atts;
- return $atts;
-}
-
-use Data::Dumper;
-
-my @miles1 = (
- ['book1', 'Lawrence Miles'],
- ['book2', 'Lawrence Miles'],
- ['book3', 'Lawrence Miles'],
- ['book4', 'Lawrence Miles'],
- ['book5', 'Lawrence Miles'],
- ['book6', 'Lawrence Miles'],
- ['book7', 'Lawrence Miles']);
-my @miles2 = (
- {title=>'book1', author=>'Lawrence Miles'},
- {title=>'book2', author=>'Lawrence Miles'},
- {title=>'book3', author=>'Lawrence Miles'},
- {title=>'book4', author=>'Lawrence Miles'},
- {title=>'book5', author=>'Lawrence Miles'},
- {title=>'book6', author=>'Lawrence Miles'},
- {title=>'book7', author=>'Lawrence Miles'});
-my @miles3 = (
- 7,
-);
-my @lance = (
- {title=>'book1', author=>'Lance Parkin'},
- {title=>'book2', author=>'Lance Parkin'},
- {title=>'book3', author=>'Lance Parkin'},
- {title=>'book4', author=>'Lance Parkin'},
- {title=>'book5', author=>'Lance Parkin'},
- {title=>'book6', author=>'Lance Parkin'},
- {title=>'book7', author=>'Lance Parkin'});
-my @magrs = (
- {title=>'book1', author=>'Paul Magrs'},
- {title=>'book2', author=>'Paul Magrs'},
- {title=>'book3', author=>'Paul Magrs'});
-
-
-sub prepare {
- shift; #print STDERR "\n#prepare=".Dumper(\@_);
- $dbh->{sql} = shift;
- $dbh->{cache} = shift;
- $dbh
-}
-sub prepare_cached {
- shift; #print STDERR "\n#prepare_cached=".Dumper(\@_);
- $dbh->{sql} = shift;
- $dbh->{cache} = shift;
- $dbh
-}
-sub rebind {
- shift;
- $dbh->{sql} = $dbh->{cache};
-}
-sub bind_param {
- shift;
-#print STDERR "\n#bind_param(@_)\n";
- $bind = $_[1];
- return;
-}
-sub execute {
- shift;
- my $query = $dbh->{sql} || $oldq;
- my $arg = @_ ? (scalar @_ > 1 ? $_[1] : $_[0]) : $bind;
-
- $bind = $arg;
- $oldq = $query;
- return unless($query);
-
- if($query =~ /select title,author from books where author/) {
- if($arg && $arg =~ /Lawrence Miles/) {
- $dbh->{array} = \@miles1;
- $dbh->{hash} = \@miles2;
- }
- }
- if($query =~ /select count(1) from books where author/) {
- $dbh->{res} = \@miles3 if($arg && $arg =~ /Lawrence Miles/);
- }
- if($query =~ /select class,title,author from books where author/) {
- if($arg && $arg =~ /Lance Parkin/) {
- $dbh->{hash} = \@lance;
- }
- if($arg && $arg =~ /Paul Magrs/) {
- $dbh->{hash} = \@magrs;
- }
- if($arg && $arg =~ /Lawrence Miles/) {
- my @list = @miles2;
- $dbh->{hash} = \@list;
- }
- }
-}
-sub fetchrow_hashref {
- return shift @{$dbh->{hash}}}
-sub fetchall_arrayref {
- return \@{$dbh->{array}}}
-sub fetchrow_array {
- return (7)}
-sub finish { $dbh->{sql} = undef }
-
-sub can { 1 }
-
-DESTROY { }
-
-END { }
-
-1;
-
Please sign in to comment.
Something went wrong with that request. Please try again.