Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
@@ -19,13 +19,12 @@ static QString getExerciseSchemaName(int exerciseId)
|
||||
return QStringLiteral("ex_") + QString::number(exerciseId);
|
||||
}
|
||||
|
||||
SqlGenerator::SqlGenerator(XmlReader *xmlReader, StructBuilder *structBuilder)
|
||||
: m_xmlReader(xmlReader)
|
||||
SqlGenerator::SqlGenerator(XmlReader *xmlReader, StructBuilder *structBuilder) : m_xmlReader(xmlReader)
|
||||
, m_structBuilder(structBuilder)
|
||||
, m_createdByXmlFile(false)
|
||||
, m_isValid(true)
|
||||
, m_exerciseId(0)
|
||||
{}
|
||||
, m_exerciseId(0),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
SqlGenerator::SqlGenerator(const QString &xmlFile)
|
||||
: m_xmlReader(new XmlReader)
|
||||
@@ -49,7 +48,7 @@ SqlGenerator::~SqlGenerator()
|
||||
|
||||
bool SqlGenerator::generateData(int exerciseId)
|
||||
{
|
||||
DEBUG_LOG() << "Generating SQL data for service " << getServiceAbbr() << " in exercise " << exerciseId << ", this: " << this;
|
||||
DEBUG_LOG(m_logger) << "Generating SQL data for service " << getServiceAbbr() << " in exercise " << exerciseId << ", this: " << this;
|
||||
|
||||
m_exerciseId = exerciseId;
|
||||
m_sqlGlobal = SqlStatements();
|
||||
@@ -134,11 +133,11 @@ bool SqlGenerator::handleViews()
|
||||
|
||||
bool SqlGenerator::handleView(const ViewInformation &vi)
|
||||
{
|
||||
DEBUG_LOG() << "Handle view " << vi.name;
|
||||
DEBUG_LOG(m_logger) << "Handle view " << vi.name;
|
||||
|
||||
const QString parent = vi.baseTable;
|
||||
|
||||
DEBUG_LOG() << "Parent = " << parent;
|
||||
DEBUG_LOG(m_logger) << "Parent = " << parent;
|
||||
|
||||
if (!parent.isEmpty())
|
||||
{
|
||||
@@ -146,7 +145,7 @@ bool SqlGenerator::handleView(const ViewInformation &vi)
|
||||
const QString createViewStmt(QStringLiteral("CREATE OR REPLACE VIEW %1 AS SELECT %2\nFROM %3\nWHERE %4;\n"));
|
||||
const QString dropViewStmt(QStringLiteral("DROP VIEW IF EXISTS %1;"));
|
||||
|
||||
DEBUG_LOG() << "csi.primaryTable = " << csi.primaryTable.data()->name;
|
||||
DEBUG_LOG(m_logger) << "csi.primaryTable = " << csi.primaryTable.data()->name;
|
||||
|
||||
if (!csi.primaryTable.isNull())
|
||||
{
|
||||
@@ -166,7 +165,7 @@ bool SqlGenerator::handleView(const ViewInformation &vi)
|
||||
fqColumnNames += mi.db.table + QLatin1Char('.') + mi.db.columnName + QLatin1String(" AS ") + mi.db.getColumnNameView();
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "fqColumnNames = " << fqColumnNames.join(QStringLiteral(", "));
|
||||
DEBUG_LOG(m_logger) << "fqColumnNames = " << fqColumnNames.join(QStringLiteral(", "));
|
||||
|
||||
|
||||
if (!whereConditions.isEmpty())
|
||||
@@ -185,11 +184,11 @@ bool SqlGenerator::handleView(const ViewInformation &vi)
|
||||
|
||||
bool SqlGenerator::handleTable(const CompleteTableInformation &cti)
|
||||
{
|
||||
DEBUG_LOG() << "Handle table " << cti.name;
|
||||
DEBUG_LOG(m_logger) << "Handle table " << cti.name;
|
||||
|
||||
if (cti.columns.isEmpty())
|
||||
{
|
||||
WARNING_LOG() << "Table " << cti.name
|
||||
WARNING_LOG(m_logger) << "Table " << cti.name
|
||||
<< " has no DatabaseServiceStruct - not generating anything for this!";
|
||||
return true;
|
||||
}
|
||||
@@ -532,11 +531,11 @@ bool SqlGenerator::handleEnumeration(const EnumInformation &ei)
|
||||
|
||||
QStringList SqlGenerator::handleEnumeration(const EnumInformation &ei, const QString &dbSchema) const
|
||||
{
|
||||
DEBUG_LOG() << "Handle enumeration " << ei.enumName;
|
||||
DEBUG_LOG(m_logger) << "Handle enumeration " << ei.enumName;
|
||||
|
||||
if (ei.tableName.isEmpty())
|
||||
{
|
||||
INFO_LOG() << "No table for enumeration " << ei.enumName << " - not creating inserts for this enum";
|
||||
INFO_LOG(m_logger) << "No table for enumeration " << ei.enumName << " - not creating inserts for this enum";
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
@@ -565,7 +564,7 @@ bool SqlGenerator::generateDbNotifications(const QString &tableName,
|
||||
if (notification.paramNames.isEmpty() ||
|
||||
notification.paramNames.size() > 1)
|
||||
{
|
||||
ERROR_LOG() << "Can not handle more than one parameter";
|
||||
ERROR_LOG(m_logger) << "Can not handle more than one parameter";
|
||||
continue;
|
||||
}
|
||||
generateDbNotification(notification, ed);
|
||||
@@ -705,7 +704,7 @@ QStringList SqlGenerator::getDbSettings(const QString &dbSchema) const
|
||||
|
||||
QStringList SqlGenerator::getAllSqlStmts(const QString &dbSchema, ExerciseDependency ed) const
|
||||
{
|
||||
DEBUG_LOG() << "Creating statements for service " << getServiceAbbr() << " in exercise " << m_exerciseId << ", this: " << this;
|
||||
DEBUG_LOG(m_logger) << "Creating statements for service " << getServiceAbbr() << " in exercise " << m_exerciseId << ", this: " << this;
|
||||
|
||||
QStringList data;
|
||||
|
||||
@@ -796,7 +795,7 @@ bool SqlGenerator::writeSql(const QString &filePath, ExerciseDependency ed)
|
||||
const SqlStatements &sql = getStatements(ed);
|
||||
if (sql.isEmpty())
|
||||
{
|
||||
DEBUG_LOG() << "Sql file is emtpy: " << sqlFile;
|
||||
DEBUG_LOG(m_logger) << "Sql file is emtpy: " << sqlFile;
|
||||
return writeFile(sqlFile, QString());
|
||||
}
|
||||
|
||||
@@ -806,7 +805,7 @@ bool SqlGenerator::writeSql(const QString &filePath, ExerciseDependency ed)
|
||||
getExerciseSchemaName(m_exerciseId) :
|
||||
getServiceAbbr());
|
||||
|
||||
INFO_LOG() << "Creating sql-stmt for schema (" << dbSchema << ")";
|
||||
INFO_LOG(m_logger) << "Creating sql-stmt for schema (" << dbSchema << ")";
|
||||
return writeSqlToFile(dbSchema, sqlFile, ed);
|
||||
}
|
||||
|
||||
@@ -929,7 +928,7 @@ bool SqlGenerator::writeFile(const QString &fn, const QString &content) const
|
||||
QFile f(fn);
|
||||
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate))
|
||||
{
|
||||
ERROR_LOG() << "Error opening file '" << f.fileName() << "' for writing: "
|
||||
ERROR_LOG(m_logger) << "Error opening file '" << f.fileName() << "' for writing: "
|
||||
<< f.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user