Arquivos
wMind/mind3rd/API/classes/theos/DBGen.php
T
Felipe Nascimento de Moura aa8e451a58 - Refactor of all the MindCommand class
- Rebuilt of all programs to use the pattern of the new format designed for the new MindCommand class
2011-04-15 23:32:55 -03:00

51 linhas
1.1 KiB
PHP
Arquivo Executável

<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
namespace theos;
/**
* Description of DBGen
*
* @author Felipe Nascimento de Moura <felipenmoura@gmail.com>
*/
class DBGen{
private $dbData= false;
public function generateDatabase(Array $projectData)
{
$ar= Array(
'driver'=>$projectData['database_drive'],
'dbName'=>$projectData['database_name'],
'host' =>$projectData['database_addr'],
'port' =>$projectData['database_port'],
'user' =>$projectData['database_user'],
'pwd' =>$projectData['database_pwd']
);
$this->dbData= $ar;
$this->dbal= new \MindDBAL($ar);
\DQB\QueryFactory::$showHeader= false;
\DQB\QueryFactory::setUp($ar['driver']);
\DQB\QueryFactory::buildQuery('*');
$qrs= \DQB\QueryFactory::getCompleteQuery(false, true, 'array');
$this->dbal->begin();
foreach($qrs as $qr)
{
$exec = $this->dbal->execute($qr);
if($exec === false)
{
Mind::write('theosDBQrFail');
echo $qr."\n";
Mind::write('theosDBQrFailAbort');
return false;
}
}
$this->dbal->commit();
Mind::write('theosDBQrOk');
return true;
}
}