SQLite

Check-in [036395c0a8]
Login

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

Overview
Comment:Add additional test cases to e_insert.test. Update evidence marks. no changes to core code.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 036395c0a8e08883b11df025e3da9e2461e4b1eb
User & Date: drh 2012-03-19 17:42:46.646
Context
2012-03-20
03:10
Fix out-of-bounds array references in the "echo" virtual table module used for testing. No changes to the SQLite core. (check-in: 7b449b301e user: drh tags: trunk)
2012-03-19
23:32
Merge updates from trunk. (check-in: 4ab1ffd45d user: mistachkin tags: winrt)
17:42
Add additional test cases to e_insert.test. Update evidence marks. no changes to core code. (check-in: 036395c0a8 user: drh tags: trunk)
14:57
Fix one more compiler warning missed by the previous check-in. (check-in: bc03d99a78 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/util.c.
212
213
214
215
216
217
218
219

220
221
222
223
224
225
226
227
228
229
230
/* Convenient short-hand */
#define UpperToLower sqlite3UpperToLower

/*
** Some systems have stricmp().  Others have strcasecmp().  Because
** there is no consistency, we will define our own.
**
** IMPLEMENTATION-OF: R-20522-24639 The sqlite3_strnicmp() API allows

** applications and extensions to compare the contents of two buffers
** containing UTF-8 strings in a case-independent fashion, using the same
** definition of case independence that SQLite uses internally when
** comparing identifiers.
*/
int sqlite3_stricmp(const char *zLeft, const char *zRight){
  register unsigned char *a, *b;
  a = (unsigned char *)zLeft;
  b = (unsigned char *)zRight;
  while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
  return UpperToLower[*a] - UpperToLower[*b];







|
>
|
|
|
<







212
213
214
215
216
217
218
219
220
221
222
223

224
225
226
227
228
229
230
/* Convenient short-hand */
#define UpperToLower sqlite3UpperToLower

/*
** Some systems have stricmp().  Others have strcasecmp().  Because
** there is no consistency, we will define our own.
**
** IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and
** sqlite3_strnicmp() APIs allow applications and extensions to compare
** the contents of two buffers containing UTF-8 strings in a
** case-independent fashion, using the same definition of "case
** independence" that SQLite uses internally when comparing identifiers.

*/
int sqlite3_stricmp(const char *zLeft, const char *zRight){
  register unsigned char *a, *b;
  a = (unsigned char *)zLeft;
  b = (unsigned char *)zRight;
  while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
  return UpperToLower[*a] - UpperToLower[*b];
Changes to test/e_insert.test.
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  CREATE TABLE a4(c UNIQUE, d);
} {}

proc do_insert_tests {args} {
  uplevel do_select_tests $args
}

# EVIDENCE-OF: R-55375-41353 -- syntax diagram insert-stmt
#
do_insert_tests e_insert-0 {
     1  "INSERT             INTO a1 DEFAULT VALUES"                   {}
     2  "INSERT             INTO main.a1 DEFAULT VALUES"              {}
     3  "INSERT OR ROLLBACK INTO main.a1 DEFAULT VALUES"              {}
     4  "INSERT OR ROLLBACK INTO a1 DEFAULT VALUES"                   {}
     5  "INSERT OR ABORT    INTO main.a1 DEFAULT VALUES"              {}







|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  CREATE TABLE a4(c UNIQUE, d);
} {}

proc do_insert_tests {args} {
  uplevel do_select_tests $args
}

# EVIDENCE-OF: R-21350-31508 -- syntax diagram insert-stmt
#
do_insert_tests e_insert-0 {
     1  "INSERT             INTO a1 DEFAULT VALUES"                   {}
     2  "INSERT             INTO main.a1 DEFAULT VALUES"              {}
     3  "INSERT OR ROLLBACK INTO main.a1 DEFAULT VALUES"              {}
     4  "INSERT OR ROLLBACK INTO a1 DEFAULT VALUES"                   {}
     5  "INSERT OR ABORT    INTO main.a1 DEFAULT VALUES"              {}
119
120
121
122
123
124
125














126
127
128
129
130
131
132
    64  "INSERT OR REPLACE  INTO a1      (b, a) SELECT c, b FROM a2"  {}
    65  "INSERT OR FAIL     INTO main.a1 (b, a) SELECT c, b FROM a2"  {}
    66  "INSERT OR FAIL     INTO a1      (b, a) SELECT c, b FROM a2"  {}
    67  "INSERT OR FAIL     INTO main.a1 (b, a) SELECT c, b FROM a2"  {}
    68  "INSERT OR IGNORE   INTO a1      (b, a) SELECT c, b FROM a2"  {}
    69  "REPLACE            INTO a1      (b, a) SELECT c, b FROM a2"  {}
    70  "REPLACE            INTO main.a1 (b, a) SELECT c, b FROM a2"  {}














}

delete_all_data

# EVIDENCE-OF: R-20288-20462 The first form (with the "VALUES" keyword)
# creates a single new row in an existing table.
#







>
>
>
>
>
>
>
>
>
>
>
>
>
>







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
    64  "INSERT OR REPLACE  INTO a1      (b, a) SELECT c, b FROM a2"  {}
    65  "INSERT OR FAIL     INTO main.a1 (b, a) SELECT c, b FROM a2"  {}
    66  "INSERT OR FAIL     INTO a1      (b, a) SELECT c, b FROM a2"  {}
    67  "INSERT OR FAIL     INTO main.a1 (b, a) SELECT c, b FROM a2"  {}
    68  "INSERT OR IGNORE   INTO a1      (b, a) SELECT c, b FROM a2"  {}
    69  "REPLACE            INTO a1      (b, a) SELECT c, b FROM a2"  {}
    70  "REPLACE            INTO main.a1 (b, a) SELECT c, b FROM a2"  {}
    71  "INSERT             INTO a1      (b, a) VALUES(1, 2),(3,4)"   {}
    72  "INSERT             INTO main.a1 (b, a) VALUES(1, 2),(3,4)"   {}
    73  "INSERT OR ROLLBACK INTO main.a1 (b, a) VALUES(1, 2),(3,4)"   {}
    74  "INSERT OR ROLLBACK INTO a1      (b, a) VALUES(1, 2),(3,4)"   {}
    75  "INSERT OR ABORT    INTO main.a1 (b, a) VALUES(1, 2),(3,4)"   {}
    76  "INSERT OR ABORT    INTO a1      (b, a) VALUES(1, 2),(3,4)"   {}
    77  "INSERT OR REPLACE  INTO main.a1 (b, a) VALUES(1, 2),(3,4)"   {}
    78  "INSERT OR REPLACE  INTO a1      (b, a) VALUES(1, 2),(3,4)"   {}
    79  "INSERT OR FAIL     INTO main.a1 (b, a) VALUES(1, 2),(3,4)"   {}
    80  "INSERT OR FAIL     INTO a1      (b, a) VALUES(1, 2),(3,4)"   {}
    81  "INSERT OR FAIL     INTO main.a1 (b, a) VALUES(1, 2),(3,4)"   {}
    82  "INSERT OR IGNORE   INTO a1      (b, a) VALUES(1, 2),(3,4)"   {}
    83  "REPLACE            INTO a1      (b, a) VALUES(1, 2),(3,4)"   {}
    84  "REPLACE            INTO main.a1 (b, a) VALUES(1, 2),(3,4)"   {}
}

delete_all_data

# EVIDENCE-OF: R-20288-20462 The first form (with the "VALUES" keyword)
# creates a single new row in an existing table.
#