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::buildQuery();
$qrs= \DQB\QueryFactory::getCompleteQuery(false, true, 'array');
$qrs= \DQB\QueryFactory::buildRawQuery();
//$qrs= \DQB\QueryFactory::buildRawQuery();
$this->dbal->begin();
$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;
}
+3 -3
Ver Arquivo
@@ -22,7 +22,7 @@ class DBDealer {
private $dbal;
private $curEntities;
public function createTable($queryData)
public function createTable($query)
{
$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']))
{
@@ -45,7 +45,7 @@ class DBDealer {
if($exec === false)
{
\Mind::write('theosDBQrFail');
echo $queryData->query."\n";
echo $query."\n";
echo $this->dbal->getErrorMessage();
\Mind::write('theosDBQrFailAbort');
return false;
+6 -1
Ver Arquivo
@@ -21,6 +21,11 @@ class sql extends \Lobe\Neuron implements \neuron{
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)
->setFileName('Quit')
->setHelp(<<<EOT
Finishes the application, leaving the console;
Finishes the application, leaving mind3rd console;
EOT
);
$this->init();
+1 -8
Ver Arquivo
@@ -32,15 +32,8 @@
EOT
);
$projectsList= \API\Project::projectList();
foreach($projectsList as $k=>$p)
{
$projectsList[$k]= $p['name'];
}
$this->addRequiredArgument('projectName',
'Specify the project name, you want to use/open',
$projectsList);
'Specify the project name, you want to use/open');
$this->init();
}
+23 -9
Ver Arquivo
@@ -25,18 +25,22 @@
EOT
);
$opts= Array( 'projects',
'users',
'entities',
'relations',
'version',
'idioms',
'plugins',
'ddl',
'info',
'lobes');
asort($opts);
$this->addRequiredArgument('what',
'What to show',
Array( 'projects',
'users',
'entities',
'relations',
'version',
'idioms',
'plugins',
'lobes'));
$opts);
$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();
}
@@ -45,6 +49,7 @@ EOT
{
GLOBAL $_REQ;
GLOBAL $_MIND;
switch($this->what)
{
case 'projects':
@@ -148,9 +153,18 @@ EOT
case 'idioms':
Mind::getIdiomsList();
break;
case 'ddl':
$ddls= $this->detailed? \API\Get::DecoratedDDL():
\API\Get::DDL();
foreach($ddls as $ddlCommand)
echo $ddlCommand;
break;
case 'lobes':
echo implode("\n", \Lobe\Neuron::listLobes());
echo "\n";
break;
case 'info':
print_r(\API\Project::data());
break;
default:
Mind::write('invalidOption', true, $this->what);