[prev] [thread] [next] [lurker] [Date index for 2003/10/16]
Author: richardc Date: 2003-10-16 09:56:27 +0100 (Thu, 16 Oct 2003) New Revision: 1420 Added: trunk/mariachi/patches/ trunk/mariachi/patches/Class-DBI-SQLite.patch trunk/mariachi/patches/DBD-SQLite.patch Log: for the home game Added: trunk/mariachi/patches/Class-DBI-SQLite.patch =================================================================== --- trunk/mariachi/patches/Class-DBI-SQLite.patch 2003-10-16 08:46:02 UTC (rev 1419) +++ trunk/mariachi/patches/Class-DBI-SQLite.patch 2003-10-16 08:56:27 UTC (rev 1420) @@ -0,0 +1,78 @@ +diff -urN Class-DBI-SQLite-0.02/lib/Class/DBI/SQLite.pm Class-DBI-SQLite-0.02_hck/lib/Class/DBI/SQLite.pm +--- Class-DBI-SQLite-0.02/lib/Class/DBI/SQLite.pm 2002-08-09 08:02:26.000000000 +0100 ++++ Class-DBI-SQLite-0.02_hck/lib/Class/DBI/SQLite.pm 2003-10-16 01:47:19.000000000 +0100 +@@ -35,7 +35,7 @@ + my($sql) = $sth->fetchrow_array; + $sth->finish; + +- my $parser = SQL::Parser->new('AnyData', { RaiseError => 1}); ++ my $parser = SQL::Parser->new('AnyData', { RaiseError => 0, PrintError => 0}); + $parser->parse($sql); + my $structure = $parser->structure; + my $primary; +diff -urN Class-DBI-SQLite-0.02/t/02_lazy.t Class-DBI-SQLite-0.02_hck/t/02_lazy.t +--- Class-DBI-SQLite-0.02/t/02_lazy.t 1970-01-01 01:00:00.000000000 +0100 ++++ Class-DBI-SQLite-0.02_hck/t/02_lazy.t 2003-10-16 01:44:53.000000000 +0100 +@@ -0,0 +1,30 @@ ++use strict; ++use Test::More tests => 42; ++use lib 't/lib'; ++ ++use Class::DBI::SQLite; ++ ++use Lazy; ++Lazy->CONSTRUCT; ++ ++for my $i (1..10) { ++ my $film = Lazy->create({ ++ title => "movie-$i", ++ director => "director-$i", ++ }); ++ isa_ok $film, 'Lazy'; ++ like $film->id, qr/\d+/, "id is " . $film->id; ++ is $film->title, "movie-$i"; ++ is $film->director, "director-$i"; ++} ++ ++Lazy->dbi_commit; ++Lazy->db_Main->disconnect; ++ ++my @movies = Lazy->retrieve_all; ++is @movies, 10, '10 movies out there'; ++ ++my %seen; ++my @uniq = grep { !$seen{$_}++ } map $_->id, @movies; ++is @uniq, 10, "10 unique ids - @uniq"; ++ +diff -urN Class-DBI-SQLite-0.02/t/lib/Lazy.pm Class-DBI-SQLite-0.02_hck/t/lib/Lazy.pm +--- Class-DBI-SQLite-0.02/t/lib/Lazy.pm 1970-01-01 01:00:00.000000000 +0100 ++++ Class-DBI-SQLite-0.02_hck/t/lib/Lazy.pm 2003-10-16 01:46:42.000000000 +0100 +@@ -0,0 +1,28 @@ ++package Lazy; ++use strict; ++# this film's possibly more the Dirty Dozen ++ ++use File::Temp qw(tempdir tempfile); ++ ++use base qw(Class::DBI::SQLite); ++BEGIN { ++ my $dir = tempdir( CLEANUP => 1 ); ++ my($fh, $filename) = tempfile( DIR => $dir ); ++ __PACKAGE__->set_db('Main', "dbi:SQLite:dbname=$filename", '', ''); ++} ++ ++sub CONSTRUCT { ++ my $class = shift; ++ $class->db_Main->do(<<'SQL'); ++CREATE TABLE Movies ( ++ id INTEGER PRIMARY KEY, ++ title, ++ director ++) ++SQL ++ ; ++ ++ $class->set_up_table('Movies'); ++} ++ ++1; Added: trunk/mariachi/patches/DBD-SQLite.patch =================================================================== --- trunk/mariachi/patches/DBD-SQLite.patch 2003-10-16 08:46:02 UTC (rev 1419) +++ trunk/mariachi/patches/DBD-SQLite.patch 2003-10-16 08:56:27 UTC (rev 1420) @@ -0,0 +1,24 @@ +--- DBD-SQLite-0.28/dbdimp.c 2003-08-23 11:45:57.000000000 +0100 ++++ DBD-SQLite-0.28_hck/dbdimp.c 2003-10-16 01:29:00.000000000 +0100 +@@ -472,11 +472,12 @@ sqlite_st_fetch (SV *sth, imp_sth_t *imp + av = DBIS->get_fbav(imp_sth); + for (i = 0; i < numFields; i++) { + char *val = imp_sth->results[i]; +- /* warn("fetching: %d == %s\n", (current_entry + i), val); */ ++ /* warn("fetching: %d == %s\n", i, val); */ + if (val != NULL) { + size_t len = strlen(val); + char *decoded; + if (chopBlanks) { ++ val = strdup(val); + while((len > 0) && (val[len-1] == ' ')) { + len--; + } +@@ -485,6 +486,7 @@ sqlite_st_fetch (SV *sth, imp_sth_t *imp + decoded = sqlite_decode(imp_dbh, val, &len); + sv_setpvn(AvARRAY(av)[i], decoded, len); + free(decoded); ++ if (chopBlanks) free(val); + + if (!imp_dbh->no_utf8_flag) { + /* sv_utf8_encode(AvARRAY(av)[i]); */
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52