2001-04-17 20:09:11 +00:00
|
|
|
/*
|
2001-09-16 00:13:26 +00:00
|
|
|
** 2001 September 15
|
2001-04-17 20:09:11 +00:00
|
|
|
**
|
2001-09-16 00:13:26 +00:00
|
|
|
** The author disclaims copyright to this source code. In place of
|
|
|
|
** a legal notice, here is a blessing:
|
2001-04-17 20:09:11 +00:00
|
|
|
**
|
2001-09-16 00:13:26 +00:00
|
|
|
** 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.
|
2001-04-17 20:09:11 +00:00
|
|
|
**
|
|
|
|
*************************************************************************
|
|
|
|
** This header file defines the interface that the sqlite B-Tree file
|
2001-12-15 14:22:18 +00:00
|
|
|
** subsystem. See comments in the source code for a detailed description
|
|
|
|
** of what each interface routine does.
|
2001-04-17 20:09:11 +00:00
|
|
|
**
|
2004-07-23 00:01:38 +00:00
|
|
|
** @(#) $Id: btree.h,v 1.58 2004/07/23 00:01:39 drh Exp $
|
2001-04-17 20:09:11 +00:00
|
|
|
*/
|
2001-09-13 14:46:09 +00:00
|
|
|
#ifndef _BTREE_H_
|
|
|
|
#define _BTREE_H_
|
2001-04-17 20:09:11 +00:00
|
|
|
|
2004-05-08 08:23:19 +00:00
|
|
|
/* TODO: This definition is just included so other modules compile. It
|
|
|
|
** needs to be revisited.
|
|
|
|
*/
|
|
|
|
#define SQLITE_N_BTREE_META 10
|
|
|
|
|
2003-04-06 20:44:45 +00:00
|
|
|
/*
|
|
|
|
** Forward declarations of structure
|
|
|
|
*/
|
2001-04-17 20:09:11 +00:00
|
|
|
typedef struct Btree Btree;
|
|
|
|
typedef struct BtCursor BtCursor;
|
|
|
|
|
2003-04-01 21:16:41 +00:00
|
|
|
|
2004-06-04 06:22:00 +00:00
|
|
|
int sqlite3BtreeOpen(
|
2004-07-22 01:19:35 +00:00
|
|
|
const char *zFilename, /* Name of database file to open */
|
|
|
|
Btree **, /* Return open Btree* here */
|
|
|
|
int flags /* Flags */
|
2004-06-04 06:22:00 +00:00
|
|
|
);
|
2003-04-01 21:16:41 +00:00
|
|
|
|
2004-04-26 14:10:20 +00:00
|
|
|
/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the
|
|
|
|
** following values.
|
2003-04-06 20:44:45 +00:00
|
|
|
*/
|
2004-04-26 14:10:20 +00:00
|
|
|
#define BTREE_OMIT_JOURNAL 1 /* Do not use journal. No argument */
|
|
|
|
#define BTREE_MEMORY 2 /* In-memory DB. No argument */
|
2001-06-08 00:21:52 +00:00
|
|
|
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreeClose(Btree*);
|
2004-07-22 01:19:35 +00:00
|
|
|
int sqlite3BtreeSetBusyHandler(Btree*,BusyHandler*);
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreeSetCacheSize(Btree*,int);
|
|
|
|
int sqlite3BtreeSetSafetyLevel(Btree*,int);
|
2004-07-22 01:19:35 +00:00
|
|
|
int sqlite3BtreeSetPageSize(Btree*,int,int);
|
|
|
|
int sqlite3BtreeGetPageSize(Btree*);
|
2004-07-22 02:40:37 +00:00
|
|
|
int sqlite3BtreeGetReserve(Btree*);
|
2004-06-26 08:38:24 +00:00
|
|
|
int sqlite3BtreeBeginTrans(Btree*,int);
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreeCommit(Btree*);
|
|
|
|
int sqlite3BtreeRollback(Btree*);
|
|
|
|
int sqlite3BtreeBeginStmt(Btree*);
|
|
|
|
int sqlite3BtreeCommitStmt(Btree*);
|
|
|
|
int sqlite3BtreeRollbackStmt(Btree*);
|
|
|
|
int sqlite3BtreeCreateTable(Btree*, int*, int flags);
|
2004-05-31 08:26:49 +00:00
|
|
|
int sqlite3BtreeIsInTrans(Btree*);
|
|
|
|
int sqlite3BtreeIsInStmt(Btree*);
|
2004-06-03 16:08:41 +00:00
|
|
|
int sqlite3BtreeSync(Btree*, const char *zMaster);
|
2001-06-22 19:15:00 +00:00
|
|
|
|
2004-05-08 08:23:19 +00:00
|
|
|
const char *sqlite3BtreeGetFilename(Btree *);
|
2004-06-14 06:03:57 +00:00
|
|
|
const char *sqlite3BtreeGetDirname(Btree *);
|
|
|
|
const char *sqlite3BtreeGetJournalname(Btree *);
|
2004-05-08 08:23:19 +00:00
|
|
|
int sqlite3BtreeCopyFile(Btree *, Btree *);
|
|
|
|
|
2004-04-26 14:10:20 +00:00
|
|
|
/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR
|
|
|
|
** of the following flags:
|
|
|
|
*/
|
2004-05-12 19:18:15 +00:00
|
|
|
#define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */
|
|
|
|
#define BTREE_ZERODATA 2 /* Table has keys only - no data */
|
|
|
|
#define BTREE_LEAFDATA 4 /* Data stored in leaves only. Implies INTKEY */
|
2003-04-01 21:16:41 +00:00
|
|
|
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreeDropTable(Btree*, int);
|
|
|
|
int sqlite3BtreeClearTable(Btree*, int);
|
|
|
|
int sqlite3BtreeGetMeta(Btree*, int idx, u32 *pValue);
|
|
|
|
int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
|
2003-04-01 21:16:41 +00:00
|
|
|
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreeCursor(
|
|
|
|
Btree*, /* BTree containing table to open */
|
|
|
|
int iTable, /* Index of root page */
|
|
|
|
int wrFlag, /* 1 for writing. 0 for read-only */
|
|
|
|
int(*)(void*,int,const void*,int,const void*), /* Key comparison function */
|
|
|
|
void*, /* First argument to compare function */
|
|
|
|
BtCursor **ppCursor /* Returned cursor */
|
|
|
|
);
|
2001-06-22 19:15:00 +00:00
|
|
|
|
2004-05-18 10:06:24 +00:00
|
|
|
void sqlite3BtreeSetCompare(
|
|
|
|
BtCursor *,
|
|
|
|
int(*)(void*,int,const void*,int,const void*),
|
|
|
|
void*
|
|
|
|
);
|
|
|
|
|
2004-05-07 13:30:42 +00:00
|
|
|
int sqlite3BtreeCloseCursor(BtCursor*);
|
2004-05-12 15:15:47 +00:00
|
|
|
int sqlite3BtreeMoveto(BtCursor*, const void *pKey, i64 nKey, int *pRes);
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreeDelete(BtCursor*);
|
2004-05-12 15:15:47 +00:00
|
|
|
int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey,
|
2004-04-26 14:10:20 +00:00
|
|
|
const void *pData, int nData);
|
|
|
|
int sqlite3BtreeFirst(BtCursor*, int *pRes);
|
|
|
|
int sqlite3BtreeLast(BtCursor*, int *pRes);
|
|
|
|
int sqlite3BtreeNext(BtCursor*, int *pRes);
|
2004-05-07 23:50:57 +00:00
|
|
|
int sqlite3BtreeEof(BtCursor*);
|
2004-05-10 23:29:49 +00:00
|
|
|
int sqlite3BtreeFlags(BtCursor*);
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreePrevious(BtCursor*, int *pRes);
|
2004-05-12 15:15:47 +00:00
|
|
|
int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
|
2004-05-30 20:46:09 +00:00
|
|
|
const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);
|
|
|
|
const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);
|
2004-04-26 14:10:20 +00:00
|
|
|
int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
|
|
|
|
int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);
|
2003-04-16 01:28:16 +00:00
|
|
|
|
2004-05-07 13:30:42 +00:00
|
|
|
char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot);
|
|
|
|
struct Pager *sqlite3BtreePager(Btree*);
|
|
|
|
|
2004-05-10 23:29:49 +00:00
|
|
|
|
2004-05-07 13:30:42 +00:00
|
|
|
#ifdef SQLITE_TEST
|
2004-07-23 00:01:38 +00:00
|
|
|
int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
|
2004-05-08 20:07:40 +00:00
|
|
|
void sqlite3BtreeCursorList(Btree*);
|
2004-05-07 13:30:42 +00:00
|
|
|
int sqlite3BtreePageDump(Btree*, int, int recursive);
|
|
|
|
#endif
|
|
|
|
|
2001-09-13 14:46:09 +00:00
|
|
|
|
|
|
|
#endif /* _BTREE_H_ */
|