| OLD | NEW |
| 1 # 2008 June 24 | 1 # 2008 June 24 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # This file implements regression tests for SQLite library. | 11 # This file implements regression tests for SQLite library. |
| 12 # | 12 # |
| 13 # $Id: select9.test,v 1.4 2008/07/01 14:39:35 danielk1977 Exp $ | 13 # $Id: select9.test,v 1.4 2008/07/01 14:39:35 danielk1977 Exp $ |
| 14 | 14 |
| 15 # The tests in this file are focused on test compound SELECT statements | 15 # The tests in this file are focused on test compound SELECT statements |
| 16 # that have any or all of an ORDER BY, LIMIT or OFFSET clauses. As of | 16 # that have any or all of an ORDER BY, LIMIT or OFFSET clauses. As of |
| 17 # version 3.6.0, SQLite contains code to use SQL indexes where possible | 17 # version 3.6.0, SQLite contains code to use SQL indexes where possible |
| 18 # to optimize such statements. | 18 # to optimize such statements. |
| 19 # | 19 # |
| 20 | 20 |
| 21 # TODO Points: | 21 # TODO Points: |
| 22 # | 22 # |
| 23 # * Are there any "column affinity" issues to consider? | 23 # * Are there any "column affinity" issues to consider? |
| 24 | 24 |
| 25 set testdir [file dirname $argv0] | 25 set testdir [file dirname $argv0] |
| 26 source $testdir/tester.tcl | 26 source $testdir/tester.tcl |
| 27 | 27 |
| 28 #set ISQUICK 1 | |
| 29 | |
| 30 #------------------------------------------------------------------------- | 28 #------------------------------------------------------------------------- |
| 31 # test_compound_select TESTNAME SELECT RESULT | 29 # test_compound_select TESTNAME SELECT RESULT |
| 32 # | 30 # |
| 33 # This command is used to run multiple LIMIT/OFFSET test cases based on | 31 # This command is used to run multiple LIMIT/OFFSET test cases based on |
| 34 # the single SELECT statement passed as the second argument. The SELECT | 32 # the single SELECT statement passed as the second argument. The SELECT |
| 35 # statement may not contain a LIMIT or OFFSET clause. This proc tests | 33 # statement may not contain a LIMIT or OFFSET clause. This proc tests |
| 36 # many statements of the form: | 34 # many statements of the form: |
| 37 # | 35 # |
| 38 # "$SELECT limit $X offset $Y" | 36 # "$SELECT limit $X offset $Y" |
| 39 # | 37 # |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 set nRow [expr {[llength $result] / $nCol}] | 53 set nRow [expr {[llength $result] / $nCol}] |
| 56 | 54 |
| 57 set ::compound_sql $sql | 55 set ::compound_sql $sql |
| 58 do_test $testname { | 56 do_test $testname { |
| 59 execsql $::compound_sql | 57 execsql $::compound_sql |
| 60 } $result | 58 } $result |
| 61 #return | 59 #return |
| 62 | 60 |
| 63 set iLimitIncr 1 | 61 set iLimitIncr 1 |
| 64 set iOffsetIncr 1 | 62 set iOffsetIncr 1 |
| 65 if {[info exists ::ISQUICK] && $::ISQUICK && $nRow>=5} { | 63 if {[info exists ::G(isquick)] && $::G(isquick) && $nRow>=5} { |
| 66 set iOffsetIncr [expr $nRow / 5] | 64 set iOffsetIncr [expr $nRow / 5] |
| 67 set iLimitIncr [expr $nRow / 5] | 65 set iLimitIncr [expr $nRow / 5] |
| 68 } | 66 } |
| 69 | 67 |
| 70 set iLimitEnd [expr $nRow+$iLimitIncr] | 68 set iLimitEnd [expr $nRow+$iLimitIncr] |
| 71 set iOffsetEnd [expr $nRow+$iOffsetIncr] | 69 set iOffsetEnd [expr $nRow+$iOffsetIncr] |
| 72 | 70 |
| 73 for {set iOffset 0} {$iOffset < $iOffsetEnd} {incr iOffset $iOffsetIncr} { | 71 for {set iOffset 0} {$iOffset < $iOffsetEnd} {incr iOffset $iOffsetIncr} { |
| 74 for {set iLimit 0} {$iLimit < $iLimitEnd} {incr iLimit} { | 72 for {set iLimit 0} {$iLimit < $iLimitEnd} {incr iLimit} { |
| 75 | 73 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 do_test select9-4.X { | 410 do_test select9-4.X { |
| 413 execsql { | 411 execsql { |
| 414 DROP INDEX i1; | 412 DROP INDEX i1; |
| 415 DROP INDEX i2; | 413 DROP INDEX i2; |
| 416 DROP VIEW v1; | 414 DROP VIEW v1; |
| 417 } | 415 } |
| 418 } {} | 416 } {} |
| 419 | 417 |
| 420 | 418 |
| 421 finish_test | 419 finish_test |
| OLD | NEW |