@@ -171,9 +171,11 @@ DbTable *SqliteDbAccess::openTableWithNodes(PrnGen &rng, FileSystemAccess &fsAcc
171
171
// Create specific table for handle nodes
172
172
std::string sql = " CREATE TABLE IF NOT EXISTS nodes (nodehandle int64 PRIMARY KEY NOT NULL, "
173
173
" parenthandle int64, name text, fingerprint BLOB, origFingerprint BLOB, "
174
- " type tinyint, mimetype tinyint AS (getmimetype(name)) VIRTUAL, size int64, share tinyint, fav tinyint, "
175
- " ctime int64, mtime int64 DEFAULT 0, flags int64, counter BLOB NOT NULL, node BLOB NOT NULL, "
176
- " label tinyint DEFAULT 0, description text, tags text)" ;
174
+ " type tinyint, mimetypeVirtual tinyint AS (getmimetype(name)) VIRTUAL, size "
175
+ " int64, share tinyint, fav tinyint, ctime int64, mtime int64 DEFAULT 0, "
176
+ " flags int64, counter BLOB NOT NULL, "
177
+ " node BLOB NOT NULL, label tinyint DEFAULT 0, description text, tags text)" ;
178
+
177
179
int result = sqlite3_exec (db, sql.c_str (), nullptr , nullptr , nullptr );
178
180
if (result)
179
181
{
@@ -192,7 +194,7 @@ DbTable *SqliteDbAccess::openTableWithNodes(PrnGen &rng, FileSystemAccess &fsAcc
192
194
" tinyint DEFAULT 0" ,
193
195
NodeData::COMPONENT_LABEL,
194
196
NewColumn::extractDataFromNodeData<LabelType> },
195
- {" mimetype " ,
197
+ {" mimetypeVirtual " ,
196
198
" tinyint AS (getmimetype(name)) VIRTUAL" ,
197
199
NodeData::COMPONENT_NONE,
198
200
nullptr },
@@ -1575,11 +1577,11 @@ bool SqliteAccountState::getChildren(const mega::NodeSearchFilter& filter, int o
1575
1577
" AND (?8 = " + std::to_string (MIME_TYPE_UNKNOWN) +
1576
1578
" OR (type = " + std::to_string (FILENODE) +
1577
1579
" AND ((?8 = " + std::to_string (MIME_TYPE_ALL_DOCS) +
1578
- " AND mimetype IN (" + std::to_string (MIME_TYPE_DOCUMENT) +
1580
+ " AND mimetypeVirtual IN (" + std::to_string (MIME_TYPE_DOCUMENT) +
1579
1581
' ,' + std::to_string (MIME_TYPE_PDF) +
1580
1582
' ,' + std::to_string (MIME_TYPE_PRESENTATION) +
1581
1583
' ,' + std::to_string (MIME_TYPE_SPREADSHEET) + " ))"
1582
- " OR mimetype = ?8))) "
1584
+ " OR mimetypeVirtual = ?8))) "
1583
1585
" AND (?11 = 0 OR (name REGEXP ?9)) "
1584
1586
" AND (?14 = 0 OR isContained(?15, description)) "
1585
1587
" AND (?16 = 0 OR matchTag(?17, tags)) "
@@ -1678,7 +1680,7 @@ bool SqliteAccountState::searchNodes(const NodeSearchFilter& filter, int order,
1678
1680
" AND nodehandle IN (SELECT nodehandle FROM nodes WHERE share = ?7)))" ;
1679
1681
1680
1682
string columnsForNodeAndFilters =
1681
- " nodehandle, parenthandle, flags, name, type, counter, node, size, ctime, mtime, share, mimetype , fav, label, description, tags" ;
1683
+ " nodehandle, parenthandle, flags, name, type, counter, node, size, ctime, mtime, share, mimetypeVirtual , fav, label, description, tags" ;
1682
1684
1683
1685
string nodesOfShares =
1684
1686
" nodesOfShares(" + columnsForNodeAndFilters + " ) \n "
@@ -1693,7 +1695,7 @@ bool SqliteAccountState::searchNodes(const NodeSearchFilter& filter, int order,
1693
1695
" WHERE parenthandle IN (SELECT nodehandle FROM ancestors) \n "
1694
1696
" UNION ALL \n "
1695
1697
" SELECT N.nodehandle, N.parenthandle, N.flags, N.name, N.type, N.counter, N.node, "
1696
- " N.size, N.ctime, N.mtime, N.share, N.mimetype , N.fav, N.label, N.description, N.tags \n "
1698
+ " N.size, N.ctime, N.mtime, N.share, N.mimetypeVirtual , N.fav, N.label, N.description, N.tags \n "
1697
1699
" FROM nodes AS N \n "
1698
1700
" INNER JOIN nodesCTE AS P \n "
1699
1701
" ON (N.parenthandle = P.nodehandle \n "
@@ -1715,11 +1717,11 @@ bool SqliteAccountState::searchNodes(const NodeSearchFilter& filter, int order,
1715
1717
" AND (?8 = " + std::to_string (MIME_TYPE_UNKNOWN) +
1716
1718
" OR (type = " + std::to_string (FILENODE) +
1717
1719
" AND ((?8 = " + std::to_string (MIME_TYPE_ALL_DOCS) +
1718
- " AND mimetype IN (" + std::to_string (MIME_TYPE_DOCUMENT) +
1720
+ " AND mimetypeVirtual IN (" + std::to_string (MIME_TYPE_DOCUMENT) +
1719
1721
' ,' + std::to_string (MIME_TYPE_PDF) +
1720
1722
' ,' + std::to_string (MIME_TYPE_PRESENTATION) +
1721
1723
' ,' + std::to_string (MIME_TYPE_SPREADSHEET) + " ))"
1722
- " OR mimetype = ?8))) \n "
1724
+ " OR mimetypeVirtual = ?8))) \n "
1723
1725
" AND (?13 = 0 OR (name REGEXP ?9)) \n "
1724
1726
" AND (?17 = 0 OR isContained(?18, description)) \n "
1725
1727
" AND (?19 = 0 OR matchTag(?20, tags)) \n "
0 commit comments