Skip Menu |

This queue is for tickets about the MediaWiki-DumpFile CPAN distribution.

Report information
The Basics
Id: 85143
Status: resolved
Priority: 0/
Queue: MediaWiki-DumpFile

People
Owner: Nobody in particular
Requestors: CHOCOLATE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.2.2_01



Subject: [PATCH] fix float parser and add missing type
The attached patch fixes a few issues I encountered while using version 0.2.2_01 of this module (perl 5.14.2, Ubuntu 12.04): - add missing type to typemap: mediumtext - fix float parser to optionally support ints as per MySQL dumps - doc: make it clear that only one table is parsed (i.e. full dumps may need to be split) - POD: fix warning Note: float fields can contain integers e.g. (from the cur table): `cur_random` double unsigned NOT NULL default '0', The same table has (or had) a mediumtext field: `cur_text` mediumtext NOT NULL, Also: perhaps consider using one of the SQL parser modules (e.g SQL::Translator::Parser::MySQL or DBIx::MyParse) to simplify MediaWiki::DumpFile::SQL? Thanks, chocolateboy.
Subject: 0001-add-missing-type-to-typemap-mediumtext.patch
From: chocolateboy <chocolate@cpan.org> Date: Wed, 8 May 2013 19:38:08 Subject: [PATCH] add missing type to typemap: mediumtext; fix float parser to optionally support ints as per MySQL dumps; doc: make it clear that only one table is parsed (i.e. full dumps may need to be split); POD: fix warning --- lib/MediaWiki/DumpFile/SQL.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/MediaWiki/DumpFile/SQL.pm b/lib/MediaWiki/DumpFile/SQL.pm index de75633..0a77a12 100644 --- a/lib/MediaWiki/DumpFile/SQL.pm +++ b/lib/MediaWiki/DumpFile/SQL.pm @@ -230,6 +230,7 @@ sub create_type_map { blob => 'varchar', mediumblob => 'varchar', + mediumtext => 'varchar', tinyblob => 'varchar', varbinary => 'varchar', @@ -311,7 +312,7 @@ sub new_int { sub new_float { return sub { m/\GNULL/gc and return undef; - m/\G(-?[\d]+\.[\d]+(e-?[\d]+)?)/gc or die "expected float"; return $1; + m/\G(-?[\d]+(?:\.[\d]+(e-?[\d]+)?)?)/gc or die "expected float"; return $1; } } @@ -371,10 +372,10 @@ MediaWiki::DumpFile::SQL - Process SQL dump files from a MediaWiki instance @schema = $sql->schema; $name = $sql->table_name; - while(defined($row = $sql->next) { + while(defined($row = $sql->next)) { #do something with the data from the row } - + =head1 FUNCTIONS =head2 new @@ -382,6 +383,8 @@ MediaWiki::DumpFile::SQL - Process SQL dump files from a MediaWiki instance This is the constructor for this package. It is called with a single parameter: the location of a MediaWiki SQL dump file or a reference to an already open file handle. +Only the definition and data for the B<first> table in a SQL dump file is processed. + =head2 next Returns a hash reference where the key is the column name from the table and the value of the hash is -- 1.7.9.5
Hi thanks for the patch! I've created a public repository for the module at https://github.com/triddle/MediaWiki-DumpFile and incorporated your patch into 0.2.2. I'll put it out for testing soon and get the full release not long after that. Thanks again for the clean patch. Cheers, Tyler On Wed May 08 15:06:23 2013, CHOCOLATE wrote: Show quoted text
> The attached patch fixes a few issues I encountered while using > version 0.2.2_01 of this module (perl 5.14.2, Ubuntu 12.04): > > - add missing type to typemap: mediumtext > - fix float parser to optionally support ints as per MySQL dumps > - doc: make it clear that only one table is parsed (i.e. full > dumps may need to be split) > - POD: fix warning > > Note: float fields can contain integers e.g. (from the cur table): > > `cur_random` double unsigned NOT NULL default '0', > > The same table has (or had) a mediumtext field: > > `cur_text` mediumtext NOT NULL, > > Also: perhaps consider using one of the SQL parser modules (e.g > SQL::Translator::Parser::MySQL or DBIx::MyParse) to simplify > MediaWiki::DumpFile::SQL? > > Thanks, > chocolateboy.
Shipped 0.2.2 to CPAN