From 29840dd689860ef744c3c45d3952ba3078851cd4 Mon Sep 17 00:00:00 2001 From: Alex Watt Date: Mon, 28 Oct 2024 23:13:56 -0400 Subject: [PATCH] Add convenience wrapper for pragma optimize --- lib/sqlite3/pragmas.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/sqlite3/pragmas.rb b/lib/sqlite3/pragmas.rb index 40ff4312..a59ec46b 100644 --- a/lib/sqlite3/pragmas.rb +++ b/lib/sqlite3/pragmas.rb @@ -338,6 +338,14 @@ def mmap_size=(size) set_int_pragma "mmap_size", size end + def optimize(bitmask = nil) + if bitmask + set_int_pragma "optimize", bitmask + else + execute("PRAGMA optimize") + end + end + def page_count get_int_pragma "page_count" end