| OLD | NEW |
| 1 # 2001 September 15 | 1 # 2001 September 15 |
| 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 #*********************************************************************** |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 execsql $sql | 137 execsql $sql |
| 138 execsql {SELECT x FROM t1 ORDER BY x} | 138 execsql {SELECT x FROM t1 ORDER BY x} |
| 139 } {1 2 5 7 9} | 139 } {1 2 5 7 9} |
| 140 do_test rowid-2.8 { | 140 do_test rowid-2.8 { |
| 141 global x2rowid | 141 global x2rowid |
| 142 set sql "UPDATE t1 SET x=3 WHERE _rowid_==$x2rowid(3)" | 142 set sql "UPDATE t1 SET x=3 WHERE _rowid_==$x2rowid(3)" |
| 143 execsql $sql | 143 execsql $sql |
| 144 execsql {SELECT x FROM t1 ORDER BY x} | 144 execsql {SELECT x FROM t1 ORDER BY x} |
| 145 } {1 3 5 7 9} | 145 } {1 3 5 7 9} |
| 146 | 146 |
| 147 if 0 { # With the index-on-expressions enhancement, creating |
| 148 # an index on ROWID has become possible. |
| 147 # We cannot index by ROWID | 149 # We cannot index by ROWID |
| 148 # | 150 # |
| 149 do_test rowid-2.9 { | 151 do_test rowid-2.9 { |
| 150 set v [catch {execsql {CREATE INDEX idxt1 ON t1(rowid)}} msg] | 152 set v [catch {execsql {CREATE INDEX idxt1 ON t1(rowid)}} msg] |
| 151 lappend v $msg | 153 lappend v $msg |
| 152 } {1 {table t1 has no column named rowid}} | 154 } {1 {table t1 has no column named rowid}} |
| 153 do_test rowid-2.10 { | 155 do_test rowid-2.10 { |
| 154 set v [catch {execsql {CREATE INDEX idxt1 ON t1(_rowid_)}} msg] | 156 set v [catch {execsql {CREATE INDEX idxt1 ON t1(_rowid_)}} msg] |
| 155 lappend v $msg | 157 lappend v $msg |
| 156 } {1 {table t1 has no column named _rowid_}} | 158 } {1 {table t1 has no column named _rowid_}} |
| 157 do_test rowid-2.11 { | 159 do_test rowid-2.11 { |
| 158 set v [catch {execsql {CREATE INDEX idxt1 ON t1(oid)}} msg] | 160 set v [catch {execsql {CREATE INDEX idxt1 ON t1(oid)}} msg] |
| 159 lappend v $msg | 161 lappend v $msg |
| 160 } {1 {table t1 has no column named oid}} | 162 } {1 {table t1 has no column named oid}} |
| 161 do_test rowid-2.12 { | 163 do_test rowid-2.12 { |
| 162 set v [catch {execsql {CREATE INDEX idxt1 ON t1(x, rowid)}} msg] | 164 set v [catch {execsql {CREATE INDEX idxt1 ON t1(x, rowid)}} msg] |
| 163 lappend v $msg | 165 lappend v $msg |
| 164 } {1 {table t1 has no column named rowid}} | 166 } {1 {table t1 has no column named rowid}} |
| 167 } |
| 165 | 168 |
| 166 # Columns defined in the CREATE statement override the buildin ROWID | 169 # Columns defined in the CREATE statement override the buildin ROWID |
| 167 # column names. | 170 # column names. |
| 168 # | 171 # |
| 169 do_test rowid-3.1 { | 172 do_test rowid-3.1 { |
| 170 execsql { | 173 execsql { |
| 171 CREATE TABLE t2(rowid int, x int, y int); | 174 CREATE TABLE t2(rowid int, x int, y int); |
| 172 INSERT INTO t2 VALUES(0,2,3); | 175 INSERT INTO t2 VALUES(0,2,3); |
| 173 INSERT INTO t2 VALUES(4,5,6); | 176 INSERT INTO t2 VALUES(4,5,6); |
| 174 INSERT INTO t2 VALUES(7,8,9); | 177 INSERT INTO t2 VALUES(7,8,9); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 } | 713 } |
| 711 db function addrow rowid_addrow_func | 714 db function addrow rowid_addrow_func |
| 712 do_execsql_test rowid-13.1 { | 715 do_execsql_test rowid-13.1 { |
| 713 CREATE TABLE t13(x); | 716 CREATE TABLE t13(x); |
| 714 INSERT INTO t13(rowid,x) VALUES(1234,5); | 717 INSERT INTO t13(rowid,x) VALUES(1234,5); |
| 715 SELECT rowid, x, addrow(rowid+1000), '|' FROM t13 LIMIT 3; | 718 SELECT rowid, x, addrow(rowid+1000), '|' FROM t13 LIMIT 3; |
| 716 SELECT last_insert_rowid(); | 719 SELECT last_insert_rowid(); |
| 717 } {1234 5 2234 | 2234 4990756 3234 | 3234 10458756 4234 | 4234} | 720 } {1234 5 2234 | 2234 4990756 3234 | 3234 10458756 4234 | 4234} |
| 718 | 721 |
| 719 finish_test | 722 finish_test |
| OLD | NEW |