[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/dbal/src/ -> lmbTestDbDump.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/dbal/src/dump/lmbSQLDumpLoader.class.php');
  10  
  11  /**

  12   * class lmbTestDbDump.

  13   *

  14   * @package dbal

  15   * @version $Id: lmbTestDbDump.class.php 5945 2007-06-06 08:31:43Z pachanga $

  16   */
  17  class lmbTestDbDump
  18  {
  19    protected $loader;
  20    protected $connection;
  21  
  22    function __construct($file = null, $connection = null)
  23    {
  24      if($connection)
  25        $this->connection = $connection;
  26      else
  27        $this->connection = lmbToolkit :: instance()->getDefaultDbConnection();
  28  
  29      if(!is_null($file))
  30        $this->_load($file);
  31    }
  32  
  33    function _load($file)
  34    {
  35      $type = $this->connection->getType();
  36  
  37      $default_loader = 'lmbSQLDumpLoader';
  38      $loader = 'lmb' . ucfirst($type) . 'DumpLoader';
  39  
  40      if(file_exists(dirname(__FILE__) . '/dump/' . $loader . '.class.php'))
  41        require_once(dirname(__FILE__) . '/dump/' . $loader . '.class.php');
  42      else
  43        $loader = $default_loader;
  44  
  45      $this->loader = new $loader($file);
  46      $this->loader->execute($this->connection);
  47    }
  48  
  49    function clean()
  50    {
  51      $this->loader->cleanTables($this->connection);
  52    }
  53  }
  54  
  55  ?>


Generated: Tue Oct 7 05:02:03 2008 Cross-referenced by PHPXref 0.7