SQLite

Check-in [d07cdd3c09]
Login

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

Overview
Comment:Make sure the parser aborts quickly following a syntax error. (CVS 3996)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d07cdd3c096c120d104ae13f7932c0a955324517
User & Date: drh 2007-05-15 00:09:13.000
Context
2007-05-15
01:13
The built-in substr() function applied to a BLOB counts bytes, not characters. (CVS 3997) (check-in: 75d573080d user: drh tags: trunk)
00:09
Make sure the parser aborts quickly following a syntax error. (CVS 3996) (check-in: d07cdd3c09 user: drh tags: trunk)
2007-05-14
16:50
Fix a problem with ORDER BY and compound SELECT queries. (CVS 3995) (check-in: af76928fc5 user: danielk1977 tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/parse.y.
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24







-
+







**
*************************************************************************
** This file contains SQLite's grammar for SQL.  Process this file
** using the lemon parser generator to generate C code that runs
** the parser.  Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.226 2007/05/11 01:44:52 drh Exp $
** @(#) $Id: parse.y,v 1.227 2007/05/15 00:09:13 drh Exp $
*/

// All token codes are small integers with #defines that begin with "TK_"
%token_prefix TK_

// The type of the data attached to each token is Token.  This is also the
// default type for non-terminals.
35
36
37
38
39
40
41

42
43
44
45
46
47
48
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49







+







  if( !pParse->parseError ){
    if( TOKEN.z[0] ){
      sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
    }else{
      sqlite3ErrorMsg(pParse, "incomplete SQL statement");
    }
    pParse->parseError = 1;
    pParse->rc = SQLITE_ERROR;
  }
}
%stack_overflow {
  sqlite3ErrorMsg(pParse, "parser stack overflow");
  pParse->parseError = 1;
}

Changes to test/alter.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21













-
+







# 2004 November 10
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this script is testing the ALTER TABLE statement.
#
# $Id: alter.test,v 1.20 2007/05/08 12:37:46 danielk1977 Exp $
# $Id: alter.test,v 1.21 2007/05/15 00:09:13 drh Exp $
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
ifcapable !altertable {
296
297
298
299
300
301
302





303
304
305
306
307
308
309
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314







+
+
+
+
+







  }
} {1 {table sqlite_master may not be altered}}
do_test alter-2.5 {
  catchsql {
    ALTER TABLE t3 RENAME TO sqlite_t3;
  }
} {1 {object name reserved for internal use: sqlite_t3}}
do_test alter-2.6 {
  catchsql {
    ALTER TABLE t3 ADD COLUMN (ALTER TABLE t3 ADD COLUMN);
  }
} {1 {near "(": syntax error}}

# If this compilation does not include triggers, omit the alter-3.* tests.
ifcapable trigger {

#-----------------------------------------------------------------------
# Tests alter-3.* test ALTER TABLE on tables that have triggers.
#