File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -32,5 +32,46 @@ def test_set_boolean_pragma
32
32
ensure
33
33
@db . set_boolean_pragma ( "read_uncommitted" , 0 )
34
34
end
35
+
36
+ def test_optimize_with_no_args
37
+ class << @db
38
+ attr_reader :statements
39
+
40
+ def execute sql , bind_vars = [ ] , &block
41
+ ( @statements ||= [ ] ) << sql
42
+ super
43
+ end
44
+ end
45
+
46
+ @db . optimize
47
+
48
+ assert_equal ( [ "PRAGMA optimize" ] , @db . statements )
49
+ end
50
+
51
+ def test_optimize_with_args
52
+ class << @db
53
+ attr_reader :statements
54
+
55
+ def execute sql , bind_vars = [ ] , &block
56
+ ( @statements ||= [ ] ) << sql
57
+ super
58
+ end
59
+ end
60
+
61
+ @db . optimize ( Constants ::Optimize ::DEFAULT )
62
+ @db . optimize ( Constants ::Optimize ::ANALYZE_TABLES | Constants ::Optimize ::LIMIT_ANALYZE )
63
+ @db . optimize ( Constants ::Optimize ::ANALYZE_TABLES | Constants ::Optimize ::DEBUG )
64
+ @db . optimize ( Constants ::Optimize ::DEFAULT | Constants ::Optimize ::CHECK_ALL_TABLES )
65
+
66
+ assert_equal (
67
+ [
68
+ "PRAGMA optimize=18" ,
69
+ "PRAGMA optimize=18" ,
70
+ "PRAGMA optimize=3" ,
71
+ "PRAGMA optimize=65554"
72
+ ] ,
73
+ @db . statements
74
+ )
75
+ end
35
76
end
36
77
end
You can’t perform that action at this time.
0 commit comments