SQLite

Check-in [8ca6a66565]
Login

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

Overview
Comment:Add a comment to prepare.c explaining why the lookaside buffer is disabled before sqlite3_exec() is called to parse a schema statement. No code changes. (CVS 6376)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8ca6a665650c9683a202f3ced17b14f7c85624bf
User & Date: danielk1977 2009-03-24 04:46:08.000
Context
2009-03-24
15:08
Changes to insure that lookaside memory allocations are never used to hold schema content. Ticket #3743. (CVS 6377) (check-in: ea74d8dc62 user: drh tags: trunk)
04:46
Add a comment to prepare.c explaining why the lookaside buffer is disabled before sqlite3_exec() is called to parse a schema statement. No code changes. (CVS 6376) (check-in: 8ca6a66565 user: danielk1977 tags: trunk)
2009-03-23
21:37
Clarify the meaning of a comment. No changes to code. (CVS 6375) (check-in: 7c2df04b52 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/prepare.c.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    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.112 2009/03/23 17:11:27 danielk1977 Exp $
*/
#include "sqliteInt.h"

/*
** Fill the InitData structure with an error message that indicates
** that the database is corrupt.
*/







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    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.113 2009/03/24 04:46:08 danielk1977 Exp $
*/
#include "sqliteInt.h"

/*
** Fill the InitData structure with an error message that indicates
** that the database is corrupt.
*/
70
71
72
73
74
75
76















77
78
79
80
81
82
83
  if( argv[1]==0 ){
    corruptSchema(pData, argv[0], 0);
  }else if( argv[2] && argv[2][0] ){
    /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
    ** But because db->init.busy is set to 1, no VDBE code is generated
    ** or executed.  All the parser does is build the internal data
    ** structures that describe the table, index, or view.















    */
    char *zErr;
    int rc;
    u8 lookasideEnabled;
    assert( db->init.busy );
    db->init.iDb = iDb;
    db->init.newTnum = atoi(argv[1]);







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







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  if( argv[1]==0 ){
    corruptSchema(pData, argv[0], 0);
  }else if( argv[2] && argv[2][0] ){
    /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
    ** But because db->init.busy is set to 1, no VDBE code is generated
    ** or executed.  All the parser does is build the internal data
    ** structures that describe the table, index, or view.
    **
    ** While the CREATE XXX statement is being processed, the lookaside 
    ** buffer is disabled. One reason for this is that when running in
    ** shared cache mode, the objects allocated for the in-memory schema
    ** might be freed from within a call made on a different database
    ** connection to db (e.g. if the second connection executes a DROP
    ** TABLE statement). If the objects that make up the Table structure
    ** are allocated from within db's lookaside buffer, then db->mutex
    ** would have to be obtained before they could be freed. This would
    ** open the door to deadlock in a multi-threaded application.
    **
    ** Another reason to disable the lookaside buffer is that lookaside
    ** gives the greatest performance boost when it is used to allocate
    ** and free small transient objects. The schema objects, which tend
    ** to have long lifetimes, are better allocated from the heap.
    */
    char *zErr;
    int rc;
    u8 lookasideEnabled;
    assert( db->init.busy );
    db->init.iDb = iDb;
    db->init.newTnum = atoi(argv[1]);