Clang: Add file informations table

We could add this properties to the sources table but then we have to
handle null values which makes the SQL statements much more complicated
and most probably slower too.

Change-Id: Ie2a1e4862b0517825292213567725d6c18abfb30
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-01-29 15:15:44 +01:00
parent c0b771f99c
commit 8aef667ad7
2 changed files with 23 additions and 0 deletions

View File

@@ -114,6 +114,15 @@ TEST_F(RefactoringDatabaseInitializer, AddUsedMacrosTable)
initializer.createUsedMacrosTable();
}
TEST_F(RefactoringDatabaseInitializer, AddFileInformationsTable)
{
InSequence s;
EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileInformations(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER)")));
initializer.createFileInformationsTable();
}
TEST_F(RefactoringDatabaseInitializer, CreateInTheContructor)
{
InSequence s;
@@ -135,6 +144,7 @@ TEST_F(RefactoringDatabaseInitializer, CreateInTheContructor)
EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS usedMacros(usedMacroId INTEGER PRIMARY KEY, sourceId INTEGER, macroName TEXT)")));
EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_usedMacros_sourceId_macroName ON usedMacros(sourceId, macroName)")));
EXPECT_CALL(mockDatabase, execute(Eq("CREATE INDEX IF NOT EXISTS index_usedMacros_macroName ON usedMacros(macroName)")));
EXPECT_CALL(mockDatabase, execute(Eq("CREATE TABLE IF NOT EXISTS fileInformations(sourceId INTEGER PRIMARY KEY, size INTEGER, lastModified INTEGER)")));
EXPECT_CALL(mockDatabase, commit());
Initializer initializer{mockDatabase};