欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SQLite源码剖析(6)

程序员文章站 2022-03-02 16:28:43
...

/*

** Add the ability to override 'extern'

*/

//定义extern的宏,可使用SQLITE_EXTERN来完成extern功能

#ifndef SQLITE_EXTERN

# define SQLITE_EXTERN extern

#endif

//定义SQLITE_API

#ifndef SQLITE_API

# define SQLITE_API

#endif

 

 

/* no-op宏经常在接口前标记那些实验性的和不推荐的接口。新应用程序最好

**不使用不推荐的接口,它们支持向后兼容。程序员必须意识到实验性接口

**会在某个版本中改变

** These no-op macros are used in front of interfaces to mark those

** interfaces as either deprecated or experimental.  New applications

** should not use deprecated interfaces - they are support for backwards

** compatibility only.  Application writers should be aware that

** experimental interfaces are subject to change in point releases.

**这些宏在他们需要时,能实现编译器魔法compiler magic警告信息,

**编译器魔法最终产生BUG报告,编译器会试着使用noop宏。

** These macros used to resolve to various kinds of compiler magic that

** would generate warning messages when they were used.  But that

** compiler magic ended up generating such a flurry of bug reports

** that we have taken it all out and gone back to using simple

** noop macros.

*/

#define SQLITE_DEPRECATED

#define SQLITE_EXPERIMENTAL

 

/*

** Ensure these symbols were not defined by some previous header file.

*/

//如果SQLITE_VERSIONSQLITE_VERSION_NUMBER标志已经定义,则取消

#ifdef SQLITE_VERSION

# undef SQLITE_VERSION

#endif

#ifdef SQLITE_VERSION_NUMBER

# undef SQLITE_VERSION_NUMBER

#endif

 

/*

** CAPI3REF: Compile-Time Library Version Numbers

** SQLITE_VERSION 宏为版本号,[X.Y.ZSQLITE版本号中,X是主版本号,Y

**是次版本号,Z是发行号

** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header

** evaluates to a string literal that is the SQLite version in the

** format "X.Y.Z" where X is the major version number (always 3 for

** SQLite3) and Y is the minor version number and Z is the release number.)^

** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves

** to an integer with the value (X*1000000 + Y*1000 + Z) where X, Y,

**and Z are the same numbers used in [SQLITE_VERSION].)^

** SQLITE_VERSION_NUMBER根据SQLITE_VERSION中版本号计算一个

**整数(X*1000000 + Y*1000 + Z

** The SQLITE_VERSION_NUMBER for any given release of SQLite will also

** be larger than the release from which it is derived.  Either Y will

** be held constant and Z will be incremented or else Y will be incremented

** and Z will be reset to zero.

**

** Since version 3.6.18, SQLite source code has been stored in the

** <a href="http://www.fossil-scm.org/">Fossil configuration management

** system</a>.  ^The SQLITE_SOURCE_ID macro evalutes to

** a string which identifies a particular check-in of SQLite

** within its configuration management system.  ^The SQLITE_SOURCE_ID

** string contains the date and time of the check-in (UTC) and an SHA1

** hash of the entire source tree.

** SQLITE_SOURCE_ID 为一个字符串,为SQLITE配置管理系统中的check-in

**详情包含check-in的日期和时间以及整个源码树的SHA1哈希

** See also: [sqlite3_libversion()],

** [sqlite3_libversion_number()], [sqlite3_sourceid()],

** [sqlite_version()] and [sqlite_source_id()].

*/

//定义版本号,并计算SQLITE_VERSION_NUMBER

#define SQLITE_VERSION        "3.6.23.1"

#define SQLITE_VERSION_NUMBER 3006023

#define SQLITE_SOURCE_ID      "2010-03-26 22:28:06 b078b588d617e07886ad156e9f54ade6d823568e"

 

/*

** CAPI3REF: Run-Time Library Version Numbers

** KEYWORDS: sqlite3_version, sqlite3_sourceid

** 这些接口通过库而不是头文件提供了

*SQLITE_VERSIONSQLITE_VERSION_NUMBER**SQLITE_SOURCE_ID

**的相同信息

** These interfaces provide the same information as the [SQLITE_VERSION],

** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros

** but are associated with the library instead of the header file.  ^(Cautious

** programmers might include assert() statements in their application to

** verify that values returned by these interfaces match the macros in

** the header, and thus insure that the application is

** compiled with matching library and header files.

**可小心地通过包含以下的assert()声明,在应用程序核实匹配头文件中宏的

**这些接口,以确保应用程序使用相匹配的库和头文件编译

** <blockquote><pre>

** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );

** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );

** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );

** </pre></blockquote>)^

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