27 static const QString resourceCacheDbFilename;
28 static const QString databaseVersion;
36 static bool isValid();
41 static QString lastError();
50 static bool initialize(
const QString &location);
53 static void deleteTemporaryResources();
56 static void performHouseKeepingOnExit();
61 static void setForeignKeysStateImpl(
bool isEnabled);
66 static bool getForeignKeysStateImpl();
72 static void synchronizeForeignKeysState();
77 friend class TestResourceLocator;
78 friend class TestResourceCacheDb;
93 static bool registerResourceType(
const QString &resourceType);
102 static std::pair<QVector<int>,
QVector<int>> tagsForStorage(
const QString &resourceType,
const QString &storageLocation);
106 static QVector<int> resourcesForStorage(
const QString &resourceType,
const QString &storageLocation);
107 static int resourceIdForResource(
const QString &resourceFileName,
const QString &resourceType,
const QString &storageLocation);
108 static bool resourceNeedsUpdating(
int resourceId, QDateTime timestamp);
122 static bool removeResourceVersionImpl(
int resourceId,
int version,
KisResourceStorageSP storage);
124 static bool updateResourceTableForResourceIfNeeded(
int resourceId,
const QString &resourceType,
KisResourceStorageSP storage);
125 static bool makeResourceTheCurrentVersion(
int resourceId,
KoResourceSP resource);
126 static bool removeResourceCompletely(
int resourceId);
129 static bool getResourceIdFromFilename(QString filename, QString resourceType, QString storageLocation,
int &outResourceId);
131 static bool getResourceIdFromVersionedFilename(QString filename, QString resourceType, QString storageLocation,
int& outResourceId);
132 static bool getAllVersionsLocations(
int resourceId,
QStringList &outVersionsLocationsList);
139 static bool setResourceActive(
int resourceId,
bool active =
false);
141 static bool tagResource(
const QString &resourceFileName,
KisTagSP tag,
const QString &resourceType);
142 static bool hasTag(
const QString &url,
const QString &resourceType);
143 static bool linkTagToStorage(
const QString &url,
const QString &resourceType,
const QString &storageLocation);
144 static bool addTag(
const QString &resourceType,
const QString storageLocation,
KisTagSP tag);
160 static bool deleteStorage(QString location);
169 static QMap<QString, QVariant> metaDataForId(
int id,
const QString &tableName);
178 static bool updateMetaDataForId(
const QMap<QString, QVariant> map,
int id,
const QString &tableName);
179 static bool addMetaDataForId(
const QMap<QString, QVariant> map,
int id,
const QString &tableName);
187 static bool removeOrphanedMetaData();
190 static QString s_lastError;