DOKK / manpages / debian 10 / libmediawiki-dumpfile-perl / MediaWiki::DumpFile::SQL.3pm.en
MediaWiki::DumpFile::SQL(3pm) User Contributed Perl Documentation MediaWiki::DumpFile::SQL(3pm)

MediaWiki::DumpFile::SQL - Process SQL dump files from a MediaWiki instance

  use MediaWiki::DumpFile::SQL;
  
  $sql = MediaWiki::DumpFile::SQL->new('dumpfile.sql');
  #many compression formats are supported
  $sql = MediaWiki::DumpFile::SQL->new('dumpfile.sql.gz');
  $sql = MediaWiki::DumpFile::SQL->new('dumpfile.sql.bz2');
  $sql = MediaWiki::DumpFile::SQL->new(\*FH);
  
  @schema = $sql->schema;
  $name = $sql->table_name;
  
  while(defined($row = $sql->next)) {
        #do something with the data from the row
  }

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 first table in a SQL dump file is processed.

Returns a hash reference where the key is the column name from the table and the value of the hash is the value for that column and row. Returns undef when there is no more data available.

Returns a string of the table name that was discovered in the dump file.

Returns a string of the unparsed CREATE TABLE statement straight from the dump file.

Returns a list that represents the table schema as it was parsed by this module. Each item in the list is a reference to an array with two elements. The first element is the name of the row and the second element is the MySQL datatype associated with the row. The list is in an identical order as the definitions in the CREATE TABLE statement.

Tyler Riddle, "<triddle at gmail.com>"

Please see MediaWiki::DumpFile for information on how to report bugs in this software.

Copyright 2009 "Tyler Riddle".

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

2016-06-27 perl v5.22.2