`
deepfuture
  • 浏览: 4332905 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:79405
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:68369
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:101489
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:281156
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:14600
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:65554
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:31313
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:45202
社区版块
存档分类
最新评论

sqlite源码剖析(2)

阅读更多

声明:本SQLite源码剖析系列为刘兴(http://deepfuture.iteye.com/)原创,未经笔者授权,任何人和机构不能转载

/*

** The maximum number of opcodes in a VDBE program.

** Not currently enforced.

*/

//VDBE程序的最大操作码数目

#ifndef SQLITE_MAX_VDBE_OP

# define SQLITE_MAX_VDBE_OP 25000

#endif

 

/*

** The maximum number of arguments to an SQL function.

*/

//SQL函数的最大参数数目

#ifndef SQLITE_MAX_FUNCTION_ARG

# define SQLITE_MAX_FUNCTION_ARG 127

#endif

 

/*

** The maximum number of in-memory pages to use for the main database

** table and for temporary tables.  The SQLITE_DEFAULT_CACHE_SIZE

*/

//主数据库表和临时表的最大内存大小

#ifndef SQLITE_DEFAULT_CACHE_SIZE

# define SQLITE_DEFAULT_CACHE_SIZE  2000

#endif

#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE

# define SQLITE_DEFAULT_TEMP_CACHE_SIZE  500

#endif

 

/*

** The maximum number of attached databases.  This must be between 0

** and 30.  The upper bound on 30 is because a 32-bit integer bitmap

** is used internally to track attached databases.

*/

//附加数据库的数目

#ifndef SQLITE_MAX_ATTACHED

# define SQLITE_MAX_ATTACHED 10

#endif

 

 

/*

** The maximum value of a ?nnn wildcard that the parser will accept.

*/

//解析器接受的匹配符参数最大值

#ifndef SQLITE_MAX_VARIABLE_NUMBER

# define SQLITE_MAX_VARIABLE_NUMBER 999

#endif

 

/* Maximum page size.  The upper bound on this value is 32768.  This a limit

** imposed by the necessity of storing the value in a 2-byte unsigned integer

** and the fact that the page size must be a power of 2.

**

** If this limit is changed, then the compiled library is technically

** incompatible with an SQLite library compiled with a different limit. If

** a process operating on a database with a page-size of 65536 bytes

** crashes, then an instance of SQLite compiled with the default page-size

** limit will not be able to rollback the aborted transaction. This could

** lead to database corruption.

*/

//最大页面大小

#ifndef SQLITE_MAX_PAGE_SIZE

# define SQLITE_MAX_PAGE_SIZE 32768

#endif

 

 

/*

** The default size of a database page.

*/

//数据库页面的默认大小

#ifndef SQLITE_DEFAULT_PAGE_SIZE

# define SQLITE_DEFAULT_PAGE_SIZE 1024

#endif

#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE

# undef SQLITE_DEFAULT_PAGE_SIZE

# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE

#endif

 

/*

** Ordinarily, if no value is explicitly provided, SQLite creates databases

** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain

** device characteristics (sector-size and atomic write() support),

** SQLite may choose a larger value. This constant is the maximum value

** SQLite will choose on its own.

*/

//数据库页面的最大默认大小

#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE

# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192

#endif

#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE

# undef SQLITE_MAX_DEFAULT_PAGE_SIZE

# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE

#endif

 

 

/*

** Maximum number of pages in one database file.

**

** This is really just the default value for the max_page_count pragma.

** This value can be lowered (or raised) at run-time using that the

** max_page_count macro.

*/

//单个数据库文件的最大页数数

#ifndef SQLITE_MAX_PAGE_COUNT

# define SQLITE_MAX_PAGE_COUNT 1073741823

#endif

 

/*

** Maximum length (in bytes) of the pattern in a LIKE or GLOB

** operator.

*/

// LIKE or GLOB模式的最大长度(字节)

#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH

# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000

#endif

 

/*

** Maximum depth of recursion for triggers.

**

** A value of 1 means that a trigger program will not be able to itself

** fire any triggers. A value of 0 means that no trigger programs at all

** may be executed.

*/

//触发器程序的递归深度

#ifndef SQLITE_MAX_TRIGGER_DEPTH

# define SQLITE_MAX_TRIGGER_DEPTH 1000

#endif

//SQLITE限制参数定义完毕

/************** End of sqliteLimit.h *****************************************/

/************** Continuing where we left off in sqliteInt.h ******************/

//禁止Borland编译器的讨厌的警告

/* Disable nuisance warnings on Borland compilers */

#if defined(__BORLANDC__)

#pragma warn -rch /* unreachable code */

#pragma warn -ccc /* Condition is always true or false */

#pragma warn -aus /* Assigned value is never used */

#pragma warn -csu /* Comparing signed and unsigned */

#pragma warn -spa /* Suspicious pointer arithmetic */

#endif

//定义为GNU源码

/* Needed for various definitions... */

#ifndef _GNU_SOURCE

# define _GNU_SOURCE

#endif

 

/*

** Include standard header files as necessary

*/

//包含必要的头文件

#ifdef HAVE_STDINT_H

#include <stdint.h>

#endif

#ifdef HAVE_INTTYPES_H

#include <inttypes.h>

#endif

 

/*

** The number of samples of an index that SQLite takes in order to

** construct a histogram of the table content when running ANALYZE

** and with SQLITE_ENABLE_STAT2

*/

//索引样本数

#define SQLITE_INDEX_SAMPLES 10

 

/*

** The following macros are used to cast pointers to integers and

** integers to pointers.  The way you do this varies from one compiler

** to the next, so we have developed the following set of #if statements

** to generate appropriate macros for a wide range of compilers.

**

** The correct "ANSI" way to do this is to use the intptr_t type.

** Unfortunately, that typedef is not available on all compilers, or

** if it is available, it requires an #include of specific headers

** that very from one machine to the next.

**

** Ticket #3860:  The llvm-gcc-4.2 compiler from Apple chokes on

** the ((void*)&((char*)0)[X]) construct.  But MSVC chokes on ((void*)(X)).

** So we have to define the macros in different ways depending on the

** compiler.

*/

//下列宏完成指针转整数和整数转指针

#if defined(__PTRDIFF_TYPE__)  /* This case should work for GCC */

# define SQLITE_INT_TO_PTR(X)  ((void*)(__PTRDIFF_TYPE__)(X))

# define SQLITE_PTR_TO_INT(X)  ((int)(__PTRDIFF_TYPE__)(X))

#elif !defined(__GNUC__)       /* Works for compilers other than LLVM */

# define SQLITE_INT_TO_PTR(X)  ((void*)&((char*)0)[X])

# define SQLITE_PTR_TO_INT(X)  ((int)(((char*)X)-(char*)0))

#elif defined(HAVE_STDINT_H)   /* Use this case if we have ANSI headers */

# define SQLITE_INT_TO_PTR(X)  ((void*)(intptr_t)(X))

# define SQLITE_PTR_TO_INT(X)  ((int)(intptr_t)(X))

#else                          /* Generates a warning - but it always works */

# define SQLITE_INT_TO_PTR(X)  ((void*)(X))

# define SQLITE_PTR_TO_INT(X)  ((int)(X))

#endif

 

/*

** The SQLITE_THREADSAFE macro must be defined as either 0 or 1.

** Older versions of SQLite used an optional THREADSAFE macro.

** We support that for legacy

*/

// SQLITE_THREADSAFE线程安全宏被定义为01,

#if !defined(SQLITE_THREADSAFE)

#if defined(THREADSAFE)

# define SQLITE_THREADSAFE THREADSAFE

#else

# define SQLITE_THREADSAFE 1

#endif

#endif

 

/*

** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.

** It determines whether or not the features related to

** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can

** be overridden at runtime using the sqlite3_config() API.

*/

// SQLITE_DEFAULT_MEMSTATUS宏被定义为01,在运行时可使

//sqlite3_config() API修改该值

#if !defined(SQLITE_DEFAULT_MEMSTATUS)

# define SQLITE_DEFAULT_MEMSTATUS 1

#endif

分享到:
评论

相关推荐

    sqlite源码及分析

    文档包含sqlite源码,源码分析,以及使用教程

    SQLite源码

    SQLite源码精髓,值得学习!!SQLite源码精髓,值得学习!!SQLite源码精髓,值得学习!!

    开源数据库sqlite源码

    开源数据库源码sqlite 开源数据库sqlite源码 开源数据库sqlite源码

    Sqlite3源码分析

    sqlite源码分析文档,sqlite源码分析文档,sqlite源码分析文档,sqlite源码分析文档,sqlite源码分析文档,sqlite源码分析文档,

    sqlite源码3260000版本

    SQLite是一个小型的,支持嵌入式的数据库,C语言开发,架构清晰。适合研究SQLite源码使用。

    sqlite源码

    sqlite源码分析数据库高级教程,包括里面所有的代码

    Android SQLite源码+说明

    Android 数据库 SQLite 详细文档 以及 源代码

    sqlite源码_学习sqlite必备

    学习sqlite时需要用到的源码,是最新的版本,希望对你有用。

    sqlite源码在自己工程中的使用

    sqlite源码在自己工程中的应用,可以不依赖于其他安装程序和插件,并且纯C语言具有跨平台的特性。 工程是在Qt下的,不过代码是很简单的Demo。

    sqlite源码。。。。。。。

    这是sqlite数据库的源代码,有兴趣的可以看看是怎么实现的 方便大家学习和查阅。。。。。。。。。。。。。。

    QT操作Sqlite源码

    QT操作sqlite数据库源码,包括添加,删除,更新操作

    android sqlite源码

    这是一个安装中使用sqlite的源码,用面向对象写的,可供参考

    sqlite源码库,包含多个版本的vs

    sqlite源码库,包含多个版本的vs,可编译使用

    sqlite3.08源码包及使用指南

    sqlite3.08源码及使用指南 sqlite是嵌入式SQL数据库引擎SQLite(SQLite Embeddable SQL Database Engine)的一个扩展。 SQLite是一个实现嵌入式SQL数据库引擎小型C语言库(C library),实现了独立的,可嵌入的,零...

    SQlite源码.zip

    非常好的开源C学习项目,轻量级的嵌入式...SQLite是一个开源的嵌入式关系数据库,实现自包容、零配置、支持事务的SQL数据库引擎。 其特点是高度便携、使用方便、结构紧凑、高效、可靠。足够小,大致3万行C代码,250K。

    Delphi SQLite实例源码.rar

    Delphi SQLite实例源码,现在SQLite的用途越来越广了,的确如此,SQLite强大易用,而且存储文件体积小,特别是一些单机程序,特别适合使用SQLite作为数据库,本源码就是一个在Delphi中使用SQLite的例子,一个上报...

    C# 操作SQLite示例源码

    该示例演示C#如何连接SQLite并实现增删改查操作;演示批量操作,须要使用事务处理,才能提高效率;同时加入了SQLDapper框架,代码简练,实用,可以直接放在项目中使用;操作完成后,是完全释放了数据库资源的。该压缩...

    sqlite3源码库

    sqlite3源码,用vs2013打开项目,可以直接编译成库使用,用于访问sqlite数据库

Global site tag (gtag.js) - Google Analytics