Fix SQL queries that intended to match directories. Code originates from FreeBSD ports extra patch. Probably it was working on previous versions of SQLite, or on previous minidlna schema.

This commit is contained in:
Gleb Smirnoff authored and Justin Maggard committed 2018-01-16 17:02:05 -08:00
1 parent 4ba6f1fa27
commit d6374fa4e2
1 file changed
+2 -2
+2 -2
View File
@@ -49,7 +49,7 @@ dir_vnode_process(struct event *ev, u_int fflags)
DPRINTF(E_DEBUG, L_INOTIFY, "Directory [%s] content updated\n", DPRINTF(E_DEBUG, L_INOTIFY, "Directory [%s] content updated\n",
path); path);
sql = sqlite3_mprintf("SELECT PATH from DETAILS where " sql = sqlite3_mprintf("SELECT PATH from DETAILS where "
"(PATH > '%q/' and PATH <= '%q/%c') and SIZE = ''", "(PATH > '%q/' and PATH <= '%q/%c') and SIZE IS NULL",
path, path, 0xFF); path, path, 0xFF);
DPRINTF(E_DEBUG, L_INOTIFY, "SQL: %s\n", sql); DPRINTF(E_DEBUG, L_INOTIFY, "SQL: %s\n", sql);
if ((sql_get_table(db, sql, &result, &rows, NULL) != if ((sql_get_table(db, sql, &result, &rows, NULL) !=
@@ -112,7 +112,7 @@ dir_vnode_process(struct event *ev, u_int fflags)
DPRINTF(E_DEBUG, L_INOTIFY, "File [%s] content updated\n", DPRINTF(E_DEBUG, L_INOTIFY, "File [%s] content updated\n",
path); path);
sql = sqlite3_mprintf("SELECT PATH from DETAILS where " sql = sqlite3_mprintf("SELECT PATH from DETAILS where "
"(PATH > '%q/' and PATH <= '%q/%c') and SIZE <> ''", "(PATH > '%q/' and PATH <= '%q/%c') and SIZE IS NOT NULL",
path, path, 0xFF); path, path, 0xFF);
if (sql_get_table(db, sql, &result, &rows, NULL) != SQLITE_OK) { if (sql_get_table(db, sql, &result, &rows, NULL) != SQLITE_OK) {
DPRINTF(E_WARN, L_INOTIFY, DPRINTF(E_WARN, L_INOTIFY,