Skip to content

Commit 9650475

Browse files
alexcwattflavorjones
authored andcommitted
Add bitmask constants
1 parent 65f4a41 commit 9650475

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

lib/sqlite3/constants.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,21 @@ module Status
170170
# This parameter records the number of separate memory allocations currently checked out.
171171
MALLOC_COUNT = 9
172172
end
173+
174+
module Optimize
175+
# Debugging mode. Do not actually perform any optimizations but instead return one line of text
176+
# for each optimization that would have been done.
177+
DEBUG = 0x00001
178+
179+
# Run ANALYZE on tables that might benefit.
180+
ANALYZE_TABLES = 0x00002
181+
182+
# When running ANALYZE, set a temporary PRAGMA analysis_limit to prevent excess run-time.
183+
LIMIT_ANALYZE = 0x00010
184+
185+
# Check the size of all tables, not just tables that have not been recently used, to see if
186+
# any have grown and shrunk significantly and hence might benefit from being re-analyzed.
187+
CHECK_ALL_TABLES = 0x10000
188+
end
173189
end
174190
end

lib/sqlite3/pragmas.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ def mmap_size=(size)
338338
set_int_pragma "mmap_size", size
339339
end
340340

341+
# Attempt to optimize the database.
342+
#
343+
# To customize the optimization options, pass +bitmask+ with a combination
344+
# of the Constants::Optimize masks.
341345
def optimize(bitmask = nil)
342346
if bitmask
343347
set_int_pragma "optimize", bitmask

0 commit comments

Comments
 (0)