PHP Classes

File: include/base/DB_TableImport.lib

Recommend this page to a friend!
  Classes of philippe thomassigny   Dominion   include/base/DB_TableImport.lib   Download  
File: include/base/DB_TableImport.lib
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Dominion
Build and execute portable SQL queries
Author: By
Last change:
Date: 12 years ago
Size: 2,557 bytes
 

Contents

Class file image Download
<?php /* DB_TableImport.lib, Dominion, the WebAbility(r) Database Abstraction Layer Contains the class to manager TableImports of information (c) 2008-2010 Philippe Thomassigny This file is part of Dominion Dominion is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Dominion is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Dominion. If not, see <http://www.gnu.org/licenses/>. */ /* @UML_Box -- Do not edit |------------------------------------------------------------------| | DB_TableImport: Import a full table | |------------------------------------------------------------------| |------------------------------------------------------------------| |------------------------------------------------------------------| @End_UML_Box */ class DB_TableImport { public static function Import($file, $table) { $data = WASimpleXML::tags(file_get_contents($file)); var_dump($data); return; $name = $table->getName(); fwrite($f, '<'.$name.'>'.PHP_EOL); $num = $table->getNumberOfRecords($condition); if ($num > $this->block) { $end = false; $first = 1; while (!$end) { $data = $table->doSelectCondition($condition, $orderby, false, $this->block, $first); if (!$data) { $end = true; break; } foreach($data as $rec) { $trec = '<record>'; foreach($rec as $field => $value) { $trec .= '<'.$field.'>'.$value.'</'.$field.'>'; } $trec .= '</record>'.PHP_EOL; fwrite($f, $trec); } $first += $this->block; } } else { $data = $table->doSelectCondition($condition, $orderby); foreach($data as $rec) { $trec = '<record>'; foreach($rec as $field => $value) { $trec .= '<'.$field.'>'.$value.'</'.$field.'>'; } $trec .= '</record>'.PHP_EOL; fwrite($f, $trec); } } fwrite($f, '</'.$name.'>'.PHP_EOL); fclose($f); } } ?>