From: John Graham-C. <jgr...@us...> - 2005-08-24 18:35:27
|
Update of /cvsroot/popfile/engine/POPFile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8371/POPFile Modified Files: Configuration.pm Database.pm History.pm Log Message: More v0.23.0 work. In this case around getting more parts of the test suite to work. *** POPFile/Database.pm: Replace INSERT with INSERT OR IGNORE statements. This surpresses the errors we were seeing with duplicate primary keys caused by the insertion of data from the schema file, followed by the insertion of data. The use of IGNORE also means that data inserted by the schema file will override old data. Making this change also causes the following tests to now pass: TestBayesScript, TestInsertScript. *** tests/TestConfiguration.tst Update tests for new global parameter GLOBAL_single_user. Fix a bug that was causing the command-line parser to erroneously complain about an empty -- command-line option. Changed the default options for Getopt::Long so that they are inline with the usage in POPFile/Loader.pm.TestConfiguration test suite now passes. *** POPFile/History.pm, tests/TestHistory.tst Fix minor oddity in History where the query used for searches had a LF in the middle of it (this was harmless but ugly). Update test suite so that start_query now gets a valid session. TestHistory suite now passes. *** Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS TestHistory PASS TestHTML fail (horribly) TestHTTP PASS TestIMAP PASS TestInsertScript PASS TestLogger PASS TestMailParse fail TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 fail TestProxy PASS TestWordMangle PASS TestXMLRPC fail TODO Why is there no TestDatabase? TestMailParse is failing on my machine because accented characters are not being recognized as part of the [:alpha:] character class. I have not fully understood why yet. Is any one else seeing this? Try running: print +(sort grep /[[:alpha:]]/, map { chr } 0..255), "\n"; To find out what [:alpha:] maps to. Index: Configuration.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/Configuration.pm,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Configuration.pm 7 Apr 2005 19:54:44 -0000 1.55 --- Configuration.pm 24 Aug 2005 18:35:13 -0000 1.56 *************** *** 36,40 **** use locale; ! use Getopt::Long; #---------------------------------------------------------------------------- --- 36,40 ---- use locale; ! use Getopt::Long qw(:config pass_through); #---------------------------------------------------------------------------- *************** *** 409,414 **** } } else { ! print STDERR "\nUnknown option $options[$i]\n"; ! return 0; } } else { --- 409,417 ---- } } else { ! if ( $options[$i] ne '--' ) { ! print STDERR "\nUnknown option: $options[$i]\n"; ! return 0; ! } ! ++$i; } } else { Index: Database.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/Database.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Database.pm 31 Jan 2005 15:12:38 -0000 1.4 --- Database.pm 24 Aug 2005 18:35:13 -0000 1.5 *************** *** 362,370 **** print "\n\nDatabase schema is outdated, performing automatic upgrade\n"; ! # The database needs upgrading, so we are going to dump out ! # all the data in the database as INSERT statements in a ! # temporary file, then DROP all the tables in the database, ! # then recreate the schema from the new schema and finally ! # rerun the inserts. my $i = 0; --- 362,370 ---- print "\n\nDatabase schema is outdated, performing automatic upgrade\n"; ! # The database needs upgrading, so we are going to dump ! # out all the data in the database as INSERT OR IGNORE ! # statements in a temporary file, then DROP all the tables ! # in the database, then recreate the schema from the new ! # schema and finally rerun the inserts. my $i = 0; *************** *** 398,402 **** last if ( $#rows == -1 ); ! print INSERT "INSERT INTO $table ("; for my $i (0..$t->{NUM_OF_FIELDS}-1) { if ( $i != 0 ) { --- 398,402 ---- last if ( $#rows == -1 ); ! print INSERT "INSERT OR IGNORE INTO $table ("; for my $i (0..$t->{NUM_OF_FIELDS}-1) { if ( $i != 0 ) { *************** *** 464,468 **** # Now write the current version to the database ! $db->do( "insert into popfile ( version ) values ( $version ); " ); unlink $ins_file; --- 464,468 ---- # Now write the current version to the database ! $db->do( "INSERT OR REPLACE into popfile ( version ) values ( $version ); " ); unlink $ins_file; Index: History.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/History.pm,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** History.pm 7 Apr 2005 19:54:45 -0000 1.36 --- History.pm 24 Aug 2005 18:35:13 -0000 1.37 *************** *** 920,925 **** my $userid = $self->{queries__}{$id}{userid}; ! $self->{queries__}{$id}{base} = "select XXX from history, buckets, ! magnets where history.userid = $userid and committed = 1"; $self->{queries__}{$id}{base} .= ' and history.bucketid = buckets.id'; --- 920,924 ---- my $userid = $self->{queries__}{$id}{userid}; ! $self->{queries__}{$id}{base} = "select XXX from history, buckets, magnets where history.userid = $userid and committed = 1"; $self->{queries__}{$id}{base} .= ' and history.bucketid = buckets.id'; |