Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sqlite builds with DQS=off #311

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions diskcache/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,39 +542,39 @@ def __init__(self, directory=None, timeout=60, disk=Disk, **settings):
# Use triggers to keep Metadata updated.

sql(
'CREATE TRIGGER IF NOT EXISTS Settings_count_insert'
' AFTER INSERT ON Cache FOR EACH ROW BEGIN'
' UPDATE Settings SET value = value + 1'
' WHERE key = "count"; END'
"CREATE TRIGGER IF NOT EXISTS Settings_count_insert"
" AFTER INSERT ON Cache FOR EACH ROW BEGIN"
" UPDATE Settings SET value = value + 1"
" WHERE key = 'count'; END"
)

sql(
'CREATE TRIGGER IF NOT EXISTS Settings_count_delete'
' AFTER DELETE ON Cache FOR EACH ROW BEGIN'
' UPDATE Settings SET value = value - 1'
' WHERE key = "count"; END'
"CREATE TRIGGER IF NOT EXISTS Settings_count_delete"
" AFTER DELETE ON Cache FOR EACH ROW BEGIN"
" UPDATE Settings SET value = value - 1"
" WHERE key = 'count'; END"
)

sql(
'CREATE TRIGGER IF NOT EXISTS Settings_size_insert'
' AFTER INSERT ON Cache FOR EACH ROW BEGIN'
' UPDATE Settings SET value = value + NEW.size'
' WHERE key = "size"; END'
"CREATE TRIGGER IF NOT EXISTS Settings_size_insert"
" AFTER INSERT ON Cache FOR EACH ROW BEGIN"
" UPDATE Settings SET value = value + NEW.size"
" WHERE key = 'size'; END"
)

sql(
'CREATE TRIGGER IF NOT EXISTS Settings_size_update'
' AFTER UPDATE ON Cache FOR EACH ROW BEGIN'
' UPDATE Settings'
' SET value = value + NEW.size - OLD.size'
' WHERE key = "size"; END'
"CREATE TRIGGER IF NOT EXISTS Settings_size_update"
" AFTER UPDATE ON Cache FOR EACH ROW BEGIN"
" UPDATE Settings"
" SET value = value + NEW.size - OLD.size"
" WHERE key = 'size'; END"
)

sql(
'CREATE TRIGGER IF NOT EXISTS Settings_size_delete'
' AFTER DELETE ON Cache FOR EACH ROW BEGIN'
' UPDATE Settings SET value = value - OLD.size'
' WHERE key = "size"; END'
"CREATE TRIGGER IF NOT EXISTS Settings_size_delete"
" AFTER DELETE ON Cache FOR EACH ROW BEGIN"
" UPDATE Settings SET value = value - OLD.size"
" WHERE key = 'size'; END"
)

# Create tag index if requested.
Expand Down Expand Up @@ -1177,10 +1177,10 @@ def get(

else: # Slow path, transaction required.
cache_hit = (
'UPDATE Settings SET value = value + 1 WHERE key = "hits"'
"UPDATE Settings SET value = value + 1 WHERE key = 'hits'"
)
cache_miss = (
'UPDATE Settings SET value = value + 1 WHERE key = "misses"'
"UPDATE Settings SET value = value + 1 WHERE key = 'misses'"
)

with self._transact(retry) as (sql, _):
Expand Down