/ Check-in [4f2ec952]
Login

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

Overview
Comment:Move the implementation of sqlite3_enable_shared_cache from btree.c to main.c. (CVS 2902)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4f2ec95283f1ae0a28b2f9ce0afc5a7203de87fb
User & Date: drh 2006-01-10 13:58:48
Context
2006-01-10
15:18
Updates to the C-API documentation. Change the parameter type of sqlite3_soft_heap_limit to integer. (CVS 2903) check-in: bdd35e9f user: drh tags: trunk
13:58
Move the implementation of sqlite3_enable_shared_cache from btree.c to main.c. (CVS 2902) check-in: 4f2ec952 user: drh tags: trunk
12:31
Fix a problem with shared-schemas and temp triggers. (CVS 2901) check-in: 9c18a1ce user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
....
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
** 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.
**
*************************************************************************
** $Id: btree.c,v 1.288 2006/01/09 09:59:49 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
................................................................................
  rc = queryTableLock(p, iTab, lockType);
  if( rc==SQLITE_OK ){
    rc = lockTable(p, iTab, lockType);
  }
#endif
  return rc;
}

#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** Enable the shared pager and schema features.
*/
int sqlite3_enable_shared_cache(int enable){
  ThreadData *pTd = sqlite3ThreadData();
  
  /* It is only legal to call sqlite3_enable_shared_cache() when there
  ** are no currently open b-trees that were opened by the calling thread.
  ** This condition is only easy to detect if the shared-cache were 
  ** previously enabled (and is being disabled). 
  */
  if( pTd->pBtree && !enable ){
    assert( pTd->useSharedData );
    return SQLITE_MISUSE;
  }

  pTd->useSharedData = enable;
  return SQLITE_OK;
}
#endif







|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
....
6494
6495
6496
6497
6498
6499
6500






















** 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.
**
*************************************************************************
** $Id: btree.c,v 1.289 2006/01/10 13:58:48 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
................................................................................
  rc = queryTableLock(p, iTab, lockType);
  if( rc==SQLITE_OK ){
    rc = lockTable(p, iTab, lockType);
  }
#endif
  return rc;
}






















Changes to src/main.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
....
1049
1050
1051
1052
1053
1054
1055



























**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.321 2006/01/10 07:14:24 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** The following constant value is used by the SQLITE_BIGENDIAN and
................................................................................
** debugging builds.  This provides a way to set a breakpoint for when
** corruption is first detected.
*/
int sqlite3Corrupt(void){
  return SQLITE_CORRUPT;
}
#endif


































|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
....
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.322 2006/01/10 13:58:48 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>

/*
** The following constant value is used by the SQLITE_BIGENDIAN and
................................................................................
** debugging builds.  This provides a way to set a breakpoint for when
** corruption is first detected.
*/
int sqlite3Corrupt(void){
  return SQLITE_CORRUPT;
}
#endif


#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** Enable or disable the shared pager and schema features for the
** current thread.
**
** This routine should only be called when there are no open
** database connections.
*/
int sqlite3_enable_shared_cache(int enable){
  ThreadData *pTd = sqlite3ThreadData();
  
  /* It is only legal to call sqlite3_enable_shared_cache() when there
  ** are no currently open b-trees that were opened by the calling thread.
  ** This condition is only easy to detect if the shared-cache were 
  ** previously enabled (and is being disabled). 
  */
  if( pTd->pBtree && !enable ){
    assert( pTd->useSharedData );
    return SQLITE_MISUSE;
  }

  pTd->useSharedData = enable;
  return SQLITE_OK;
}
#endif