fixed foreign keys problem;

fixed bug for new projects;
changes to sql generator;
Esse commit está contido em:
Felipe Nascimento de Moura
2011-06-05 21:51:56 -03:00
commit 45a79c7658
7 arquivos alterados com 37 adições e 26 exclusões
+3 -3
Ver Arquivo
@@ -43,14 +43,14 @@ class db extends \Lobe\Neuron implements \neuron{
\DQB\QueryFactory::setUp($ar['driver']); \DQB\QueryFactory::setUp($ar['driver']);
\DQB\QueryFactory::buildQuery(); \DQB\QueryFactory::buildQuery();
$qrs= \DQB\QueryFactory::getCompleteQuery(false, true, 'array'); $qrs= \DQB\QueryFactory::getCompleteQuery(false, true, 'array');
$qrs= \DQB\QueryFactory::buildRawQuery(); //$qrs= \DQB\QueryFactory::buildRawQuery();
$this->dbal->begin(); $this->dbal->begin();
$dealer= new resources\DBDealer($this->dbal); $dealer= new resources\DBDealer($this->dbal);
foreach($qrs['createTable'] as $tbName=>$qrObject) foreach($qrs as $tbName=>$qr)
{ {
if(!$dealer->createTable($qrObject)) if(!$dealer->createTable($qr))
{ {
return false; return false;
} }
+3 -3
Ver Arquivo
@@ -22,7 +22,7 @@ class DBDealer {
private $dbal; private $dbal;
private $curEntities; private $curEntities;
public function createTable($queryData) public function createTable($query)
{ {
$prjDao= new \DAO\Project(); $prjDao= new \DAO\Project();
@@ -36,7 +36,7 @@ class DBDealer {
} }
$exec = $this->dbal->execute($queryData->query); $exec = $this->dbal->execute($query);
/*if(\DQB\QueryFactory::tableExists($queryData->table['name'])) /*if(\DQB\QueryFactory::tableExists($queryData->table['name']))
{ {
@@ -45,7 +45,7 @@ class DBDealer {
if($exec === false) if($exec === false)
{ {
\Mind::write('theosDBQrFail'); \Mind::write('theosDBQrFail');
echo $queryData->query."\n"; echo $query."\n";
echo $this->dbal->getErrorMessage(); echo $this->dbal->getErrorMessage();
\Mind::write('theosDBQrFailAbort'); \Mind::write('theosDBQrFailAbort');
return false; return false;
+6 -1
Ver Arquivo
@@ -21,6 +21,11 @@ class sql extends \Lobe\Neuron implements \neuron{
public function __construct(Array $data) public function __construct(Array $data)
{ {
return \API\FileManager::writeToFile('docs/create.sql', \API\Get::DDL()); if(\API\FileManager::writeToFile('docs/create.sql', \API\Get::DDL()))
{
echo ".sql file created in docs dir for the current project, with all the DDL commands";
return true;
}
return false;
} }
} }
Submodule mind3rd/API/external/pug deleted from 6f9d380f9e
+1 -1
Ver Arquivo
@@ -19,7 +19,7 @@
->setRestrict(false) ->setRestrict(false)
->setFileName('Quit') ->setFileName('Quit')
->setHelp(<<<EOT ->setHelp(<<<EOT
Finishes the application, leaving the console; Finishes the application, leaving mind3rd console;
EOT EOT
); );
$this->init(); $this->init();
+1 -8
Ver Arquivo
@@ -32,15 +32,8 @@
EOT EOT
); );
$projectsList= \API\Project::projectList();
foreach($projectsList as $k=>$p)
{
$projectsList[$k]= $p['name'];
}
$this->addRequiredArgument('projectName', $this->addRequiredArgument('projectName',
'Specify the project name, you want to use/open', 'Specify the project name, you want to use/open');
$projectsList);
$this->init(); $this->init();
} }
+23 -9
Ver Arquivo
@@ -25,18 +25,22 @@
EOT EOT
); );
$opts= Array( 'projects',
'users',
'entities',
'relations',
'version',
'idioms',
'plugins',
'ddl',
'info',
'lobes');
asort($opts);
$this->addRequiredArgument('what', $this->addRequiredArgument('what',
'What to show', 'What to show',
Array( 'projects', $opts);
'users',
'entities',
'relations',
'version',
'idioms',
'plugins',
'lobes'));
$this->addOptionalArgument('extra', 'Any extra information to be used'); $this->addOptionalArgument('extra', 'Any extra information to be used');
$this->addFlag('detailed', '-d', 'Show detailed data'); $this->addFlag('detailed', '-d', 'Show detailed data(or set scripts as decorated)');
$this->init(); $this->init();
} }
@@ -45,6 +49,7 @@ EOT
{ {
GLOBAL $_REQ; GLOBAL $_REQ;
GLOBAL $_MIND; GLOBAL $_MIND;
switch($this->what) switch($this->what)
{ {
case 'projects': case 'projects':
@@ -148,9 +153,18 @@ EOT
case 'idioms': case 'idioms':
Mind::getIdiomsList(); Mind::getIdiomsList();
break; break;
case 'ddl':
$ddls= $this->detailed? \API\Get::DecoratedDDL():
\API\Get::DDL();
foreach($ddls as $ddlCommand)
echo $ddlCommand;
break;
case 'lobes': case 'lobes':
echo implode("\n", \Lobe\Neuron::listLobes()); echo implode("\n", \Lobe\Neuron::listLobes());
echo "\n"; echo "\n";
break;
case 'info':
print_r(\API\Project::data());
break; break;
default: default:
Mind::write('invalidOption', true, $this->what); Mind::write('invalidOption', true, $this->what);