/ Check-in [cdd866f5]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a problem with SQLITE_MAX_SQL_LENGTH introduced by check-in (4636). Ticket #2851 (CVS 4639)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cdd866f59797b81b573c68d5c625f9bd9f0f6fde
User & Date: drh 2007-12-18 17:50:33
Context
2007-12-19
09:20
Add the ioerr3.test file, that found an error in br3317. The error is not present in this branch. (CVS 4640) check-in: d3efec14 user: danielk1977 tags: trunk
2007-12-18
17:50
Fix a problem with SQLITE_MAX_SQL_LENGTH introduced by check-in (4636). Ticket #2851 (CVS 4639) check-in: cdd866f5 user: drh tags: trunk
15:41
In the CLI, quote strings that contain the separator character. Ticket #2850. (CVS 4638) check-in: 493a17c4 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/prepare.c.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
526
527
528
529
530
531
532
533


534
535
536
537
538
539
540
...
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the implementation of the sqlite3_prepare()
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: prepare.c,v 1.66 2007/12/13 21:54:11 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Fill the InitData structure with an error message that indicates
** that the database is corrupt.
................................................................................
    }
  }
  
  memset(&sParse, 0, sizeof(sParse));
  sParse.db = db;
  if( nBytes>=0 && zSql[nBytes]!=0 ){
    char *zSqlCopy;
    if( nBytes>SQLITE_MAX_SQL_LENGTH ){


      return SQLITE_TOOBIG;
    }
    zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
    if( zSqlCopy ){
      sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);
      sqlite3_free(zSqlCopy);
    }
................................................................................
    sqlite3Error(db, rc, "%s", zErrMsg);
    sqlite3_free(zErrMsg);
  }else{
    sqlite3Error(db, rc, 0);
  }

  rc = sqlite3ApiExit(db, rc);
  /* sqlite3ReleaseThreadData(); */
  assert( (rc&db->errMask)==rc );
  return rc;
}
static int sqlite3LockAndPrepare(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */







|







 







|
>
>







 







<







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
...
599
600
601
602
603
604
605

606
607
608
609
610
611
612
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the implementation of the sqlite3_prepare()
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: prepare.c,v 1.67 2007/12/18 17:50:33 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Fill the InitData structure with an error message that indicates
** that the database is corrupt.
................................................................................
    }
  }
  
  memset(&sParse, 0, sizeof(sParse));
  sParse.db = db;
  if( nBytes>=0 && zSql[nBytes]!=0 ){
    char *zSqlCopy;
    if( SQLITE_MAX_SQL_LENGTH>0 && nBytes>SQLITE_MAX_SQL_LENGTH ){
      sqlite3Error(db, SQLITE_TOOBIG, "statement too long");
      sqlite3SafetyOff(db);
      return SQLITE_TOOBIG;
    }
    zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
    if( zSqlCopy ){
      sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);
      sqlite3_free(zSqlCopy);
    }
................................................................................
    sqlite3Error(db, rc, "%s", zErrMsg);
    sqlite3_free(zErrMsg);
  }else{
    sqlite3Error(db, rc, 0);
  }

  rc = sqlite3ApiExit(db, rc);

  assert( (rc&db->errMask)==rc );
  return rc;
}
static int sqlite3LockAndPrepare(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */