logic: add storage transformation to merge anonymous types and the respective typedef
* moved storage related classes to data/storage folder * implemented recording c++ unions as NODE_UNION instead of just using NODE_TYPE * added transformation to merge anonymous classes/structs/enums/unions and typedef nodes * added tests for this transformation * added setting for enabling/disabling this transformation
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include "data/storage/sqlite/SqliteDatabaseIndex.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
SqliteDatabaseIndex::SqliteDatabaseIndex(const std::string& indexName, const std::string& indexTarget)
|
||||
: m_indexName(indexName)
|
||||
, m_indexTarget(indexTarget)
|
||||
{
|
||||
}
|
||||
|
||||
SqliteDatabaseIndex::~SqliteDatabaseIndex()
|
||||
{
|
||||
}
|
||||
|
||||
void SqliteDatabaseIndex::createOnDatabase(CppSQLite3DB& database)
|
||||
{
|
||||
try
|
||||
{
|
||||
LOG_INFO_STREAM(<< "Creating database index \"" << m_indexName << "\"");
|
||||
database.execDML((
|
||||
"CREATE INDEX IF NOT EXISTS " + m_indexName + " ON " + m_indexTarget + ";"
|
||||
).c_str());
|
||||
}
|
||||
catch (CppSQLite3Exception e)
|
||||
{
|
||||
LOG_ERROR(std::to_string(e.errorCode()) + ": " + e.errorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void SqliteDatabaseIndex::removeFromDatabase(CppSQLite3DB& database)
|
||||
{
|
||||
try
|
||||
{
|
||||
LOG_INFO_STREAM(<< "Removing database index \"" << m_indexName << "\"");
|
||||
database.execDML((
|
||||
"DROP INDEX IF EXISTS main." + m_indexName + ";"
|
||||
).c_str());
|
||||
}
|
||||
catch (CppSQLite3Exception e)
|
||||
{
|
||||
LOG_ERROR(std::to_string(e.errorCode()) + ": " + e.errorMessage());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user