From 6fc678e9470e1469ba93b5011867ee29d406df82 Mon Sep 17 00:00:00 2001 From: Bruno Cauet Date: Wed, 18 Feb 2015 18:52:22 +0100 Subject: [PATCH] PathQuery: use substr() instead of instr() substr() is only available in SQLite 3.7.15+, which is not available yet on Debian stable, CentOS & co. Use substr() instead. --- beets/library.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beets/library.py b/beets/library.py index 35b763321..c5503dd0a 100644 --- a/beets/library.py +++ b/beets/library.py @@ -73,8 +73,8 @@ class PathQuery(dbcore.FieldQuery): if not self._is_windows: dir_blob = buffer(self.dir_path) - return '({0} = ?) || (instr({0}, ?) = 1)'.format(self.field), \ - (file_blob, dir_blob) + return '({0} = ?) || (substr({0}, 1, ?) = ?)'.format(self.field), \ + (file_blob, len(dir_blob), dir_blob) escape = lambda m: self.escape_char + m.group(0) dir_pattern = self.escape_re.sub(escape, self.dir_path)