Пример #1
0
 private function DoOnAfterLogin($userName)
 {
     $connectionFactory = new MyConnectionFactory();
     $connection = $connectionFactory->CreateConnection(GetConnectionOptions());
     try {
         $connection->Connect();
     } catch (Exception $e) {
         ShowErrorPage($e->getMessage());
         die;
     }
     $this->OnAfterLogin($userName, $connection);
     $connection->Disconnect();
 }
Пример #2
0
// merge with allowed table names to get final table name list.
$allCurrentDDL = new DDL();
if (($res = YAMLDDLParser::loadAllDDLFiles($ddlDir, $allCurrentDDL)) != 0) {
    exit($res);
}
$mapTargetTableNames = MyConnectionFactory::getMapTargetTableNames($connectionName, $connectionParamsByName, $allCurrentDDL);
unset($allCurrentDDL, $res);
if (!empty($mapTargetTableNames)) {
    if (!empty($allowedTableNames)) {
        $allowedTableNames = array_intersect($allowedTableNames, $mapTargetTableNames);
    } else {
        $allowedTableNames = $mapTargetTableNames;
    }
}
// Load the DDL from the database, filtering out all non-allowed tables.
$db = MyConnectionFactory::getConnection($connectionName);
$dialect = $db->getDialect();
$loader = new ConnectionDDLLoader();
$databaseDDL = $loader->loadDDL($db, false, $databaseAllowedTableNames);
$db->close();
// Load the current DDL from the DDL files.
$currentDDL = new DDL(array());
if (($res = YAMLDDLParser::loadAllDDLFiles($ddlDir, $currentDDL, $allowedTableNames, $dbmap)) != 0) {
    exit($res);
}
// If we have map-target tables, remove all foreign keys from the current DDL which
// reference tables which are not map targets (because those tables should not exist
// in this database).
if (!empty($mapTargetTableNames)) {
    $anyDeleted = false;
    for ($i = 0, $n = count($currentDDL->topLevelEntities); $i < $n; $i++) {
Пример #3
0
    } else {
        $allowedTableNames = $mapTargetTableNames;
    }
}
// Load the current DDL from the DDL files.
$currentDDL = new DDL(array());
if (($res = YAMLDDLParser::loadAllDDLFiles($ddlDir, $currentDDL, $allowedTableNames, $dbmap)) != 0) {
    exit($res);
}
// If we have map-target tables, remove all foreign keys from the current DDL which
// reference tables which are not map targets (because those tables should not exist
// in this database).
if (!empty($mapTargetTableNames)) {
    $anyDeleted = false;
    for ($i = 0, $n = count($currentDDL->topLevelEntities); $i < $n; $i++) {
        if ($currentDDL->topLevelEntities[$i] instanceof DDLForeignKey && !in_array($currentDDL->topLevelEntities[$i]->foreignTableName, $mapTargetTableNames)) {
            unset($currentDDL->topLevelEntities[$i]);
            $anyDeleted = true;
        }
    }
    if ($anyDeleted) {
        $currentDDL->topLevelEntities = array_slice($currentDDL->topLevelEntities, 0);
    }
    unset($i, $n, $anyDeleted);
}
$db = $action == 'insertsWithKeyCols' ? MyConnectionFactory::getConnection($connectionName) : '';
process($currentDDL, $dialect, $action, $allowedTableNames, $db, $dbmap, $ddlDir);
if ($db) {
    $db->close();
}
exit(0);