'dropnotifsxmpp' => 'DELETE FROM pending WHERE notification = 1 AND EXISTS ( SELECT 1 FROM users WHERE users.id = pending.user AND nextxmpp <= ? )',
'dropnotifsmail' => 'DELETE FROM pending WHERE notification = 0 AND EXISTS ( SELECT 1 FROM users WHERE users.id = pending.user AND nextmail <= ? )',
'time' => 'SELECT NOW()',
- 'searchname' => 'SELECT l.id, l.name, p.name FROM locations AS l JOIN locations AS p ON l.parent = p.id WHERE l.name LIKE ? ORDER BY l.id',
- 'searchlocalname' => 'SELECT l.id, l.name, p.name FROM locations AS l JOIN locations AS p ON l.parent = p.id WHERE l.name LIKE ? AND l.id LIKE ? ORDER BY l.id',
+ 'searchname' => 'SELECT l.id, l.name, p.name FROM locations AS l JOIN locations AS p ON l.parent = p.id WHERE l.name LIKE ? ORDER BY LENGTH(l.id), l.id',
+ 'searchlocalname' => 'SELECT l.id, l.name, p.name FROM locations AS l JOIN locations AS p ON l.parent = p.id WHERE l.name LIKE ? AND l.id LIKE ? ORDER BY LENGTH(l.id), l.id',
'hasChildren' => 'SELECT DISTINCT 1 FROM locations WHERE parent = ?',
'hasMain' => 'SELECT DISTINCT 1 FROM locations WHERE id = ? AND mainhistory IS NOT NULL',
'notif-exists' => 'SELECT DISTINCT 1 FROM notifications WHERE user = ? AND ( location = ? OR ( recursive = 1 AND type <= 1 AND SUBSTR( ?, 1, LENGTH( location ) ) = location ) )'
cd ..
if ! [ -f docs/pci.ids.nohead ] || ! cmp docs/pci.ids.nohead pci.ids.new >/dev/null ; then
cp perl/cf/head.ids pci.ids.final
- echo '# Version: '`date +%Y%m%d` >> pci.ids.final
+ echo '# Generated at: '`date '+%F %T'` >> pci.ids.final
echo >> pci.ids.final
cat pci.ids.new >> pci.ids.final
# ln -f pci.ids.final ~/origs/00-current
ln -f pci.ids.final docs/pci.ids
+ ln -f pci.ids.final docs/v2.2/pci.ids
ln -f pci.ids.new docs/pci.ids.nohead
rm pci.ids.final
bzip2 -9c <docs/pci.ids >docs/pci.ids.bz2
+ ln -f docs/pci.ids.bz2 docs/v2.2/
gzip -9c <docs/pci.ids >docs/pci.ids.gz
+ ln -f docs/pci.ids.gz docs/v2.2/
fi
rm pci.ids.new