SQLite

Check-in [b51028ed2f]
Login

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

Overview
Comment:Ensure the sqlite3Select() routine always returns non-zero if an error has occurred.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b51028ed2f57f4245a7ebd9bdb99d1bcfaf1a01b
User & Date: dan 2015-04-16 07:19:23.819
Context
2015-04-16
08:54
Fix a problem in test file e_reindex.test. (check-in: 5b3de9390f user: dan tags: trunk)
07:19
Ensure the sqlite3Select() routine always returns non-zero if an error has occurred. (check-in: b51028ed2f user: dan tags: trunk)
00:26
When parsing the schema, ignore any SQL that does not begin with "CREATE". (check-in: d3c00d6158 user: drh tags: trunk)
Changes
Unified Diff Show Whitespace Changes Patch
Changes to src/select.c.
5479
5480
5481
5482
5483
5484
5485

5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
    generateSortTail(pParse, p, &sSort, pEList->nExpr, pDest);
  }

  /* Jump here to skip this query
  */
  sqlite3VdbeResolveLabel(v, iEnd);


  /* The SELECT was successfully coded.   Set the return code to 0
  ** to indicate no errors.
  */
  rc = 0;

  /* Control jumps to here if an error is encountered above, or upon
  ** successful coding of the SELECT.
  */
select_end:
  explainSetInteger(pParse->iSelectId, iRestoreSelectId);








>
|
<
<
|







5479
5480
5481
5482
5483
5484
5485
5486
5487


5488
5489
5490
5491
5492
5493
5494
5495
    generateSortTail(pParse, p, &sSort, pEList->nExpr, pDest);
  }

  /* Jump here to skip this query
  */
  sqlite3VdbeResolveLabel(v, iEnd);

  /* The SELECT has been coded. If there is an error in the Parse structure,
  ** set the return code to 1. Otherwise 0. */


  rc = (pParse->nErr>0);

  /* Control jumps to here if an error is encountered above, or upon
  ** successful coding of the SELECT.
  */
select_end:
  explainSetInteger(pParse->iSelectId, iRestoreSelectId);

Changes to test/select1.test.
303
304
305
306
307
308
309



310
311
312
313
314
315
316
  set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1,f2)}} msg]
  lappend v $msg
} {0 {11 33}}
do_test select1-4.4 {
  set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1)}} msg]
  lappend v $msg
} {1 {misuse of aggregate: min()}}




# The restriction not allowing constants in the ORDER BY clause
# has been removed.  See ticket #1768
#do_test select1-4.5 {
#  catchsql {
#    SELECT f1 FROM test1 ORDER BY 8.4;
#  }







>
>
>







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
  set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1,f2)}} msg]
  lappend v $msg
} {0 {11 33}}
do_test select1-4.4 {
  set v [catch {execsql {SELECT f1 FROM test1 ORDER BY min(f1)}} msg]
  lappend v $msg
} {1 {misuse of aggregate: min()}}
do_catchsql_test select1-4.5 {
  INSERT INTO test1(f1) SELECT f1 FROM test1 ORDER BY min(f1);
} {1 {misuse of aggregate: min()}}

# The restriction not allowing constants in the ORDER BY clause
# has been removed.  See ticket #1768
#do_test select1-4.5 {
#  catchsql {
#    SELECT f1 FROM test1 ORDER BY 8.4;
#  }