/ Check-in [f53856a5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the test scripts, changes instances of the TCL interface option "-has_codec" into the correct "-has-codec".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f53856a555403678ea8bd721a9fa1ae179240406
User & Date: drh 2010-09-06 20:28:29
Context
2010-09-07
12:17
Remove a redundant test for multiple output columns in a scalar subquery. check-in: 657472bc user: drh tags: trunk
2010-09-06
20:28
In the test scripts, changes instances of the TCL interface option "-has_codec" into the correct "-has-codec". check-in: f53856a5 user: drh tags: trunk
18:50
Add test cases to e_select.test. check-in: 9db26d5e user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/alter2.test.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
ifcapable {!pragma} return

# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts. See proc [set_file_format].
#
do_not_use_codec

# These tests do not work if there is a codec. 
#
#if {[catch {sqlite3 -has_codec} r] || $r} return
#

# The file format change affects the way row-records stored in tables (but 
# not indices) are interpreted. Before version 3.1.3, a row-record for a 
# table with N columns was guaranteed to contain exactly N fields. As
# of version 3.1.3, the record may contain up to N fields. In this case
# the M fields that are present are the values for the left-most M 
# columns. The (N-M) rightmost columns contain NULL.
#







<
<
<
<
<







23
24
25
26
27
28
29





30
31
32
33
34
35
36
ifcapable {!pragma} return

# Do not use a codec for tests in this file, as the database file is
# manipulated directly using tcl scripts. See proc [set_file_format].
#
do_not_use_codec






# The file format change affects the way row-records stored in tables (but 
# not indices) are interpreted. Before version 3.1.3, a row-record for a 
# table with N columns was guaranteed to contain exactly N fields. As
# of version 3.1.3, the record may contain up to N fields. In this case
# the M fields that are present are the values for the left-most M 
# columns. The (N-M) rightmost columns contain NULL.
#

Changes to test/alter3.test.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
51
52
53
54
55
56
57

58
59
60
61
62
63
64
...
194
195
196
197
198
199
200

201
202
203
204
205
206
207
ifcapable !altertable {
  finish_test
  return
}

# Determine if there is a codec available on this test.
#
if {[catch {sqlite3 -has_codec} r] || $r} {
  set has_codec 1
} else {
  set has_codec 0
}


# Test Organisation:
................................................................................
# 
proc get_file_format {{fname test.db}} {
  return [hexio_get_int [hexio_read $fname 44 4]]
}

do_test alter3-1.1 {
  execsql {

    CREATE TABLE abc(a, b, c);
    SELECT sql FROM sqlite_master;
  }
} {{CREATE TABLE abc(a, b, c)}}
do_test alter3-1.2 {
  execsql {ALTER TABLE abc ADD d INTEGER;}
  execsql {
................................................................................
}

do_test alter3-4.1 {
  db close
  file delete -force test.db
  set ::DB [sqlite3 db test.db]
  execsql {

    CREATE TABLE t1(a, b);
    INSERT INTO t1 VALUES(1, 100);
    INSERT INTO t1 VALUES(2, 300);
    SELECT * FROM t1;
  }
} {1 100 2 300}
do_test alter3-4.1 {







|







 







>







 







>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
ifcapable !altertable {
  finish_test
  return
}

# Determine if there is a codec available on this test.
#
if {[catch {sqlite3 -has-codec} r] || $r} {
  set has_codec 1
} else {
  set has_codec 0
}


# Test Organisation:
................................................................................
# 
proc get_file_format {{fname test.db}} {
  return [hexio_get_int [hexio_read $fname 44 4]]
}

do_test alter3-1.1 {
  execsql {
    PRAGMA legacy_file_format=ON;
    CREATE TABLE abc(a, b, c);
    SELECT sql FROM sqlite_master;
  }
} {{CREATE TABLE abc(a, b, c)}}
do_test alter3-1.2 {
  execsql {ALTER TABLE abc ADD d INTEGER;}
  execsql {
................................................................................
}

do_test alter3-4.1 {
  db close
  file delete -force test.db
  set ::DB [sqlite3 db test.db]
  execsql {
    PRAGMA legacy_file_format=ON;
    CREATE TABLE t1(a, b);
    INSERT INTO t1 VALUES(1, 100);
    INSERT INTO t1 VALUES(2, 300);
    SELECT * FROM t1;
  }
} {1 100 2 300}
do_test alter3-4.1 {

Changes to test/alter4.test.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
...
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
...
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
ifcapable !altertable {
  finish_test
  return
}

# Determine if there is a codec available on this test.
#
if {[catch {sqlite3 -has_codec} r] || $r} {
  set has_codec 1
} else {
  set has_codec 0
}


# Test Organisation:
# ------------------
#
# alter4-1.*: Test that ALTER TABLE correctly modifies the CREATE TABLE sql.
# alter4-2.*: Test error messages.
# alter4-3.*: Test adding columns with default value NULL.
# alter4-4.*: Test adding columns with default values other than NULL.
# alter4-5.*: Test adding columns to tables in ATTACHed databases.
# alter4-6.*: Test that temp triggers are not accidentally dropped.
# alter4-7.*: Test that VACUUM resets the file-format.
#

# This procedure returns the value of the file-format in file 'test.db'.
# 
proc get_file_format {{fname test.db}} {
  return [hexio_get_int [hexio_read $fname 44 4]]
}

do_test alter4-1.1 {
  execsql {
    CREATE TEMP TABLE abc(a, b, c);
    SELECT sql FROM sqlite_temp_master;
  }
} {{CREATE TABLE abc(a, b, c)}}
do_test alter4-1.2 {
................................................................................
} {}
do_test alter4-3.2 {
  execsql {
    ALTER TABLE t1 ADD c;
    SELECT * FROM t1;
  }
} {1 100 {} 2 300 {}}
if {!$has_codec} {
  do_test alter4-3.3 {
    get_file_format
  } {3}
}
ifcapable schema_version {
  do_test alter4-3.4 {
    execsql {
      PRAGMA schema_version;
    }
  } {10}
}
................................................................................
} {}
do_test alter4-4.2 {
  execsql {
    ALTER TABLE t1 ADD c DEFAULT 'hello world';
    SELECT * FROM t1;
  }
} {1 100 {hello world} 2 300 {hello world}}
if {!$has_codec} {
  do_test alter4-4.3 {
    get_file_format
  } {3}
}
ifcapable schema_version {
  do_test alter4-4.4 {
    execsql {
      PRAGMA schema_version;
    }
  } {20}
}
................................................................................
  ifcapable schema_version {
    do_test alter4-5.4 {
      execsql {
        PRAGMA aux.schema_version;
      }
    } {31}
  }
  if {!$has_codec} {
    do_test alter4-5.5 {
      list [get_file_format test2.db] [get_file_format]
    } {2 3}
  }
  do_test alter4-5.6 {
    execsql {
      ALTER TABLE aux.t1 ADD COLUMN d DEFAULT 1000;
      SELECT sql FROM aux.sqlite_master;
    }
  } {{CREATE TABLE t1(a,b, c VARCHAR(128), d DEFAULT 1000)}}
  do_test alter4-5.7 {
................................................................................
      ALTER TABLE t1 ADD COLUMN c DEFAULT 'c';
      INSERT INTO t1(a, b) VALUES(3, 4);
      SELECT * FROM log;
    }
  } {b 1 2 a 1 2 b 3 4 a 3 4}
}

if {!$has_codec} {
  ifcapable vacuum {
    do_test alter4-7.1 {
      execsql {
        VACUUM;
      }
      get_file_format
    } {1}
    do_test alter4-7.2 {
      execsql {
        CREATE TEMP TABLE abc(a, b, c);
        ALTER TABLE abc ADD d DEFAULT NULL;
      }
      get_file_format
    } {2}
    do_test alter4-7.3 {
      execsql {
        ALTER TABLE abc ADD e DEFAULT 10;
      }
      get_file_format
    } {3}
    do_test alter4-7.4 {
      execsql {
        ALTER TABLE abc ADD f DEFAULT NULL;
      }
      get_file_format
    } {3}
    do_test alter4-7.5 {
      execsql {
        VACUUM;
      }
      get_file_format
    } {1}
  }
}

# Ticket #1183 - Make sure adding columns to large tables does not cause
# memory corruption (as was the case before this bug was fixed).
do_test alter4-8.1 {
  execsql {
    CREATE TEMP TABLE t4(c1);
  }
} {}







<
<
<
<
<
<
<
<













<
<
<
<
<
<







 







<
<
<
<
<







 







<
<
<
<
<







 







<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







22
23
24
25
26
27
28








29
30
31
32
33
34
35
36
37
38
39
40
41






42
43
44
45
46
47
48
...
164
165
166
167
168
169
170





171
172
173
174
175
176
177
...
194
195
196
197
198
199
200





201
202
203
204
205
206
207
...
239
240
241
242
243
244
245





246
247
248
249
250
251
252
...
300
301
302
303
304
305
306




































307
308
309
310
311
312
313

# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
ifcapable !altertable {
  finish_test
  return
}










# Test Organisation:
# ------------------
#
# alter4-1.*: Test that ALTER TABLE correctly modifies the CREATE TABLE sql.
# alter4-2.*: Test error messages.
# alter4-3.*: Test adding columns with default value NULL.
# alter4-4.*: Test adding columns with default values other than NULL.
# alter4-5.*: Test adding columns to tables in ATTACHed databases.
# alter4-6.*: Test that temp triggers are not accidentally dropped.
# alter4-7.*: Test that VACUUM resets the file-format.
#







do_test alter4-1.1 {
  execsql {
    CREATE TEMP TABLE abc(a, b, c);
    SELECT sql FROM sqlite_temp_master;
  }
} {{CREATE TABLE abc(a, b, c)}}
do_test alter4-1.2 {
................................................................................
} {}
do_test alter4-3.2 {
  execsql {
    ALTER TABLE t1 ADD c;
    SELECT * FROM t1;
  }
} {1 100 {} 2 300 {}}





ifcapable schema_version {
  do_test alter4-3.4 {
    execsql {
      PRAGMA schema_version;
    }
  } {10}
}
................................................................................
} {}
do_test alter4-4.2 {
  execsql {
    ALTER TABLE t1 ADD c DEFAULT 'hello world';
    SELECT * FROM t1;
  }
} {1 100 {hello world} 2 300 {hello world}}





ifcapable schema_version {
  do_test alter4-4.4 {
    execsql {
      PRAGMA schema_version;
    }
  } {20}
}
................................................................................
  ifcapable schema_version {
    do_test alter4-5.4 {
      execsql {
        PRAGMA aux.schema_version;
      }
    } {31}
  }





  do_test alter4-5.6 {
    execsql {
      ALTER TABLE aux.t1 ADD COLUMN d DEFAULT 1000;
      SELECT sql FROM aux.sqlite_master;
    }
  } {{CREATE TABLE t1(a,b, c VARCHAR(128), d DEFAULT 1000)}}
  do_test alter4-5.7 {
................................................................................
      ALTER TABLE t1 ADD COLUMN c DEFAULT 'c';
      INSERT INTO t1(a, b) VALUES(3, 4);
      SELECT * FROM log;
    }
  } {b 1 2 a 1 2 b 3 4 a 3 4}
}





































# Ticket #1183 - Make sure adding columns to large tables does not cause
# memory corruption (as was the case before this bug was fixed).
do_test alter4-8.1 {
  execsql {
    CREATE TEMP TABLE t4(c1);
  }
} {}

Changes to test/ioerr.test.

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    COMMIT;
  } -exclude $ex
}

# Test IO errors when replaying two hot journals from a 2-file 
# transaction. This test only runs on UNIX.
ifcapable crashtest&&attach {
  if {![catch {sqlite3 -has_codec} r] && !$r} {
    do_ioerr_test ioerr-6 -ckrefcount true -tclprep {
      execsql {
        ATTACH 'test2.db' as aux;
        CREATE TABLE tx(a, b);
        CREATE TABLE aux.ty(a, b);
      }
      set rc [crashsql -delay 2 -file test2.db-journal {







|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    COMMIT;
  } -exclude $ex
}

# Test IO errors when replaying two hot journals from a 2-file 
# transaction. This test only runs on UNIX.
ifcapable crashtest&&attach {
  if {![catch {sqlite3 -has-codec} r] && !$r} {
    do_ioerr_test ioerr-6 -ckrefcount true -tclprep {
      execsql {
        ATTACH 'test2.db' as aux;
        CREATE TABLE tx(a, b);
        CREATE TABLE aux.ty(a, b);
      }
      set rc [crashsql -delay 2 -file test2.db-journal {