PageRenderTime 69ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 1ms

/library/Library/WP7/SQLiteDriver/sqlite/sqlite3_h.cs

https://bitbucket.org/digitalizarte/coolstorage
C# | 6931 lines | 559 code | 195 blank | 6177 comment | 1 complexity | 9e04f0da16d31674651fb379356f4e22 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. using u8 = System.Byte;
  2. using System.Diagnostics;
  3. namespace Community.CsharpSqlite
  4. {
  5. public partial class Sqlite3
  6. {
  7. /*
  8. ** 2001 September 15
  9. **
  10. ** The author disclaims copyright to this source code. In place of
  11. ** a legal notice, here is a blessing:
  12. **
  13. ** May you do good and not evil.
  14. ** May you find forgiveness for yourself and forgive others.
  15. ** May you share freely, never taking more than you give.
  16. **
  17. *************************************************************************
  18. ** This header file defines the interface that the SQLite library
  19. ** presents to client programs. If a C-function, structure, datatype,
  20. ** or constant definition does not appear in this file, then it is
  21. ** not a published API of SQLite, is subject to change without
  22. ** notice, and should not be referenced by programs that use SQLite.
  23. **
  24. ** Some of the definitions that are in this file are marked as
  25. ** "experimental". Experimental interfaces are normally new
  26. ** features recently added to SQLite. We do not anticipate changes
  27. ** to experimental interfaces but reserve the right to make minor changes
  28. ** if experience from use "in the wild" suggest such changes are prudent.
  29. **
  30. ** The official C-language API documentation for SQLite is derived
  31. ** from comments in this file. This file is the authoritative source
  32. ** on how SQLite interfaces are suppose to operate.
  33. **
  34. ** The name of this file under configuration management is "sqlite.h.in".
  35. ** The makefile makes some minor changes to this file (such as inserting
  36. ** the version number) and changes its name to "sqlite3.h" as
  37. ** part of the build process.
  38. *************************************************************************
  39. ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
  40. ** C#-SQLite is an independent reimplementation of the SQLite software library
  41. **
  42. ** SQLITE_SOURCE_ID: 2011-01-28 17:03:50 ed759d5a9edb3bba5f48f243df47be29e3fe8cd7
  43. **
  44. *************************************************************************
  45. */
  46. //#ifndef _SQLITE3_H_
  47. //#define _SQLITE3_H_
  48. //#include <stdarg.h> /* Needed for the definition of va_list */
  49. /*
  50. ** Make sure we can call this stuff from C++.
  51. */
  52. //#ifdef __cplusplus
  53. //extern "C" {
  54. //#endif
  55. /*
  56. ** Add the ability to override 'extern'
  57. */
  58. //#ifndef SQLITE_EXTERN
  59. //# define SQLITE_EXTERN extern
  60. //#endif
  61. //#ifndef SQLITE_API
  62. //# define SQLITE_API
  63. //#endif
  64. /*
  65. ** These no-op macros are used in front of interfaces to mark those
  66. ** interfaces as either deprecated or experimental. New applications
  67. ** should not use deprecated interfaces - they are support for backwards
  68. ** compatibility only. Application writers should be aware that
  69. ** experimental interfaces are subject to change in point releases.
  70. **
  71. ** These macros used to resolve to various kinds of compiler magic that
  72. ** would generate warning messages when they were used. But that
  73. ** compiler magic ended up generating such a flurry of bug reports
  74. ** that we have taken it all out and gone back to using simple
  75. ** noop macros.
  76. */
  77. //#define SQLITE_DEPRECATED
  78. //#define SQLITE_EXPERIMENTAL
  79. /*
  80. ** Ensure these symbols were not defined by some previous header file.
  81. */
  82. //#ifdef SQLITE_VERSION
  83. //# undef SQLITE_VERSION
  84. //#endif
  85. //#ifdef SQLITE_VERSION_NUMBER
  86. //# undef SQLITE_VERSION_NUMBER
  87. //#endif
  88. /*
  89. ** CAPI3REF: Compile-Time Library Version Numbers
  90. **
  91. ** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header
  92. ** evaluates to a string literal that is the SQLite version in the
  93. ** format "X.Y.Z" where X is the major version number (always 3 for
  94. ** SQLite3) and Y is the minor version number and Z is the release number.)^
  95. ** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer
  96. ** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
  97. ** numbers used in [SQLITE_VERSION].)^
  98. ** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
  99. ** be larger than the release from which it is derived. Either Y will
  100. ** be held constant and Z will be incremented or else Y will be incremented
  101. ** and Z will be reset to zero.
  102. **
  103. ** Since version 3.6.18, SQLite source code has been stored in the
  104. ** <a href="http://www.fossil-scm.org/">Fossil configuration management
  105. ** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
  106. ** a string which identifies a particular check-in of SQLite
  107. ** within its configuration management system. ^The SQLITE_SOURCE_ID
  108. ** string contains the date and time of the check-in (UTC) and an SHA1
  109. ** hash of the entire source tree.
  110. **
  111. ** See also: [sqlite3_libversion()],
  112. ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
  113. ** [sqlite_version()] and [sqlite_source_id()].
  114. */
  115. //#define SQLITE_VERSION "3.7.5"
  116. //#define SQLITE_VERSION_NUMBER 3007005
  117. //#define SQLITE_SOURCE_ID "2011-01-28 17:03:50 ed759d5a9edb3bba5f48f243df47be29e3fe8cd7"
  118. const string SQLITE_VERSION = "3.7.5.C#";
  119. const int SQLITE_VERSION_NUMBER = 300700567;
  120. const string SQLITE_SOURCE_ID = "Ported to C# from 2011-01-28 17:03:50 ed759d5a9edb3bba5f48f243df47be29e3fe8cd7";
  121. /*
  122. ** CAPI3REF: Run-Time Library Version Numbers
  123. ** KEYWORDS: sqlite3_version, sqlite3_sourceid
  124. **
  125. ** These interfaces provide the same information as the [SQLITE_VERSION],
  126. ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
  127. ** but are associated with the library instead of the header file. ^(Cautious
  128. ** programmers might include assert() statements in their application to
  129. ** verify that values returned by these interfaces match the macros in
  130. ** the header, and thus insure that the application is
  131. ** compiled with matching library and header files.
  132. **
  133. ** <blockquote><pre>
  134. ** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
  135. ** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
  136. ** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
  137. ** </pre></blockquote>)^
  138. **
  139. ** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
  140. ** macro. ^The sqlite3_libversion() function returns a pointer to the
  141. ** to the sqlite3_version[] string constant. The sqlite3_libversion()
  142. ** function is provided for use in DLLs since DLL users usually do not have
  143. ** direct access to string constants within the DLL. ^The
  144. ** sqlite3_libversion_number() function returns an integer equal to
  145. ** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns
  146. ** a pointer to a string constant whose value is the same as the
  147. ** [SQLITE_SOURCE_ID] C preprocessor macro.
  148. **
  149. ** See also: [sqlite_version()] and [sqlite_source_id()].
  150. */
  151. //SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
  152. //SQLITE_API const char *sqlite3_libversion(void);
  153. //SQLITE_API const char *sqlite3_sourceid(void);
  154. //SQLITE_API int sqlite3_libversion_number(void);
  155. /*
  156. ** CAPI3REF: Run-Time Library Compilation Options Diagnostics
  157. **
  158. ** ^The sqlite3_compileoption_used() function returns 0 or 1
  159. ** indicating whether the specified option was defined at
  160. ** compile time. ^The SQLITE_ prefix may be omitted from the
  161. ** option name passed to sqlite3_compileoption_used().
  162. **
  163. ** ^The sqlite3_compileoption_get() function allows iterating
  164. ** over the list of options that were defined at compile time by
  165. ** returning the N-th compile time option string. ^If N is out of range,
  166. ** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_
  167. ** prefix is omitted from any strings returned by
  168. ** sqlite3_compileoption_get().
  169. **
  170. ** ^Support for the diagnostic functions sqlite3_compileoption_used()
  171. ** and sqlite3_compileoption_get() may be omitted by specifying the
  172. ** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
  173. **
  174. ** See also: SQL functions [sqlite_compileoption_used()] and
  175. ** [sqlite_compileoption_get()] and the [compile_options pragma].
  176. */
  177. //#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
  178. //SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
  179. //SQLITE_API const char *sqlite3_compileoption_get(int N);
  180. //#endif
  181. /*
  182. ** CAPI3REF: Test To See If The Library Is Threadsafe
  183. **
  184. ** ^The sqlite3_threadsafe() function returns zero if and only if
  185. ** SQLite was compiled mutexing code omitted due to the
  186. ** [SQLITE_THREADSAFE] compile-time option being set to 0.
  187. **
  188. ** SQLite can be compiled with or without mutexes. When
  189. ** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes
  190. ** are enabled and SQLite is threadsafe. When the
  191. ** [SQLITE_THREADSAFE] macro is 0,
  192. ** the mutexes are omitted. Without the mutexes, it is not safe
  193. ** to use SQLite concurrently from more than one thread.
  194. **
  195. ** Enabling mutexes incurs a measurable performance penalty.
  196. ** So if speed is of utmost importance, it makes sense to disable
  197. ** the mutexes. But for maximum safety, mutexes should be enabled.
  198. ** ^The default behavior is for mutexes to be enabled.
  199. **
  200. ** This interface can be used by an application to make sure that the
  201. ** version of SQLite that it is linking against was compiled with
  202. ** the desired setting of the [SQLITE_THREADSAFE] macro.
  203. **
  204. ** This interface only reports on the compile-time mutex setting
  205. ** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with
  206. ** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
  207. ** can be fully or partially disabled using a call to [sqlite3_config()]
  208. ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
  209. ** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the
  210. ** sqlite3_threadsafe() function shows only the compile-time setting of
  211. ** thread safety, not any run-time changes to that setting made by
  212. ** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
  213. ** is unchanged by calls to sqlite3_config().)^
  214. **
  215. ** See the [threading mode] documentation for additional information.
  216. */
  217. //SQLITE_API int sqlite3_threadsafe(void);
  218. /*
  219. ** CAPI3REF: Database Connection Handle
  220. ** KEYWORDS: {database connection} {database connections}
  221. **
  222. ** Each open SQLite database is represented by a pointer to an instance of
  223. ** the opaque structure named "sqlite3". It is useful to think of an sqlite3
  224. ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and
  225. ** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
  226. ** is its destructor. There are many other interfaces (such as
  227. ** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
  228. ** [sqlite3_busy_timeout()] to name but three) that are methods on an
  229. ** sqlite3 object.
  230. */
  231. //typedef struct sqlite3 sqlite3;
  232. /*
  233. ** CAPI3REF: 64-Bit Integer Types
  234. ** KEYWORDS: sqlite_int64 sqlite_uint64
  235. **
  236. ** Because there is no cross-platform way to specify 64-bit integer types
  237. ** SQLite includes typedefs for 64-bit signed and unsigned integers.
  238. **
  239. ** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
  240. ** The sqlite_int64 and sqlite_uint64 types are supported for backwards
  241. ** compatibility only.
  242. **
  243. ** ^The sqlite3_int64 and sqlite_int64 types can store integer values
  244. ** between -9223372036854775808 and +9223372036854775807 inclusive. ^The
  245. ** sqlite3_uint64 and sqlite_uint64 types can store integer values
  246. ** between 0 and +18446744073709551615 inclusive.
  247. */
  248. //#ifdef SQLITE_INT64_TYPE
  249. // typedef SQLITE_INT64_TYPE sqlite_int64;
  250. // typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
  251. //#elif defined(_MSC_VER) || defined(__BORLANDC__)
  252. // typedef __int64 sqlite_int64;
  253. // typedef unsigned __int64 sqlite_uint64;
  254. //#else
  255. // typedef long long int sqlite_int64;
  256. // typedef unsigned long long int sqlite_uint64;
  257. //#endif
  258. //typedef sqlite_int64 sqlite3_int64;
  259. //typedef sqlite_uint64 sqlite3_uint64;
  260. /*
  261. ** If compiling for a processor that lacks floating point support,
  262. ** substitute integer for floating-point.
  263. */
  264. //#ifdef SQLITE_OMIT_FLOATING_POINT
  265. //# define double sqlite3_int64
  266. //#endif
  267. /*
  268. ** CAPI3REF: Closing A Database Connection
  269. **
  270. ** ^The sqlite3_close() routine is the destructor for the [sqlite3] object.
  271. ** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is
  272. ** successfully destroyed and all associated resources are deallocated.
  273. **
  274. ** Applications must [sqlite3_finalize | finalize] all [prepared statements]
  275. ** and [sqlite3_blob_close | close] all [BLOB handles] associated with
  276. ** the [sqlite3] object prior to attempting to close the object. ^If
  277. ** sqlite3_close() is called on a [database connection] that still has
  278. ** outstanding [prepared statements] or [BLOB handles], then it returns
  279. ** SQLITE_BUSY.
  280. **
  281. ** ^If [sqlite3_close()] is invoked while a transaction is open,
  282. ** the transaction is automatically rolled back.
  283. **
  284. ** The C parameter to [sqlite3_close(C)] must be either a NULL
  285. ** pointer or an [sqlite3] object pointer obtained
  286. ** from [sqlite3_open()], [sqlite3_open16()], or
  287. ** [sqlite3_open_v2()], and not previously closed.
  288. ** ^Calling sqlite3_close() with a NULL pointer argument is a
  289. ** harmless no-op.
  290. */
  291. //SQLITE_API int sqlite3_close(sqlite3 *);
  292. /*
  293. ** The type for a callback function.
  294. ** This is legacy and deprecated. It is included for historical
  295. ** compatibility and is not documented.
  296. */
  297. //typedef int (*sqlite3_callback)(void*,int,char**, char**);
  298. /*
  299. ** CAPI3REF: One-Step Query Execution Interface
  300. **
  301. ** The sqlite3_exec() interface is a convenience wrapper around
  302. ** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
  303. ** that allows an application to run multiple statements of SQL
  304. ** without having to use a lot of C code.
  305. **
  306. ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
  307. ** semicolon-separate SQL statements passed into its 2nd argument,
  308. ** in the context of the [database connection] passed in as its 1st
  309. ** argument. ^If the callback function of the 3rd argument to
  310. ** sqlite3_exec() is not NULL, then it is invoked for each result row
  311. ** coming out of the evaluated SQL statements. ^The 4th argument to
  312. ** to sqlite3_exec() is relayed through to the 1st argument of each
  313. ** callback invocation. ^If the callback pointer to sqlite3_exec()
  314. ** is NULL, then no callback is ever invoked and result rows are
  315. ** ignored.
  316. **
  317. ** ^If an error occurs while evaluating the SQL statements passed into
  318. ** sqlite3_exec(), then execution of the current statement stops and
  319. ** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec()
  320. ** is not NULL then any error message is written into memory obtained
  321. ** from [sqlite3_malloc()] and passed back through the 5th parameter.
  322. ** To avoid memory leaks, the application should invoke [sqlite3_free()]
  323. ** on error message strings returned through the 5th parameter of
  324. ** of sqlite3_exec() after the error message string is no longer needed.
  325. ** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
  326. ** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
  327. ** NULL before returning.
  328. **
  329. ** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()
  330. ** routine returns SQLITE_ABORT without invoking the callback again and
  331. ** without running any subsequent SQL statements.
  332. **
  333. ** ^The 2nd argument to the sqlite3_exec() callback function is the
  334. ** number of columns in the result. ^The 3rd argument to the sqlite3_exec()
  335. ** callback is an array of pointers to strings obtained as if from
  336. ** [sqlite3_column_text()], one for each column. ^If an element of a
  337. ** result row is NULL then the corresponding string pointer for the
  338. ** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the
  339. ** sqlite3_exec() callback is an array of pointers to strings where each
  340. ** entry represents the name of corresponding result column as obtained
  341. ** from [sqlite3_column_name()].
  342. **
  343. ** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
  344. ** to an empty string, or a pointer that contains only whitespace and/or
  345. ** SQL comments, then no SQL statements are evaluated and the database
  346. ** is not changed.
  347. **
  348. ** Restrictions:
  349. **
  350. ** <ul>
  351. ** <li> The application must insure that the 1st parameter to sqlite3_exec()
  352. ** is a valid and open [database connection].
  353. ** <li> The application must not close [database connection] specified by
  354. ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
  355. ** <li> The application must not modify the SQL statement text passed into
  356. ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
  357. ** </ul>
  358. */
  359. //SQLITE_API int sqlite3_exec(
  360. // sqlite3*, /* An open database */
  361. // const char *sql, /* SQL to be evaluated */
  362. // int (*callback)(void*,int,char**,char**), /* Callback function */
  363. // void *, /* 1st argument to callback */
  364. // char **errmsg /* Error msg written here */
  365. //);
  366. /*
  367. ** CAPI3REF: Result Codes
  368. ** KEYWORDS: SQLITE_OK {error code} {error codes}
  369. ** KEYWORDS: {result code} {result codes}
  370. **
  371. ** Many SQLite functions return an integer result code from the set shown
  372. ** here in order to indicates success or failure.
  373. **
  374. ** New error codes may be added in future versions of SQLite.
  375. **
  376. ** See also: [SQLITE_IOERR_READ | extended result codes]
  377. */
  378. //#define SQLITE_OK 0 /* Successful result */
  379. ///* beginning-of-error-codes */
  380. //#define SQLITE_ERROR 1 /* SQL error or missing database */
  381. //#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
  382. //#define SQLITE_PERM 3 /* Access permission denied */
  383. //#define SQLITE_ABORT 4 /* Callback routine requested an abort */
  384. //#define SQLITE_BUSY 5 /* The database file is locked */
  385. //#define SQLITE_LOCKED 6 /* A table in the database is locked */
  386. //#define SQLITE_NOMEM 7 /* A malloc() failed */
  387. //#define SQLITE_READONLY 8 /* Attempt to write a readonly database */
  388. //#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/
  389. //#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
  390. //#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
  391. //#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
  392. //#define SQLITE_FULL 13 /* Insertion failed because database is full */
  393. //#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
  394. //#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
  395. //#define SQLITE_EMPTY 16 /* Database is empty */
  396. //#define SQLITE_SCHEMA 17 /* The database schema changed */
  397. //#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
  398. //#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
  399. //#define SQLITE_MISMATCH 20 /* Data type mismatch */
  400. //#define SQLITE_MISUSE 21 /* Library used incorrectly */
  401. //#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
  402. //#define SQLITE_AUTH 23 /* Authorization denied */
  403. //#define SQLITE_FORMAT 24 /* Auxiliary database format error */
  404. //#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
  405. //#define SQLITE_NOTADB 26 /* File opened that is not a database file */
  406. //#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
  407. //#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */
  408. /* end-of-error-codes */
  409. public const int SQLITE_OK = 0;
  410. public const int SQLITE_ERROR = 1;
  411. public const int SQLITE_INTERNAL = 2;
  412. public const int SQLITE_PERM = 3;
  413. public const int SQLITE_ABORT = 4;
  414. public const int SQLITE_BUSY = 5;
  415. public const int SQLITE_LOCKED = 6;
  416. public const int SQLITE_NOMEM = 7;
  417. public const int SQLITE_READONLY = 8;
  418. public const int SQLITE_INTERRUPT = 9;
  419. public const int SQLITE_IOERR = 10;
  420. public const int SQLITE_CORRUPT = 11;
  421. public const int SQLITE_NOTFOUND = 12;
  422. public const int SQLITE_FULL = 13;
  423. public const int SQLITE_CANTOPEN = 14;
  424. public const int SQLITE_PROTOCOL = 15;
  425. public const int SQLITE_EMPTY = 16;
  426. public const int SQLITE_SCHEMA = 17;
  427. public const int SQLITE_TOOBIG = 18;
  428. public const int SQLITE_CONSTRAINT = 19;
  429. public const int SQLITE_MISMATCH = 20;
  430. public const int SQLITE_MISUSE = 21;
  431. public const int SQLITE_NOLFS = 22;
  432. public const int SQLITE_AUTH = 23;
  433. public const int SQLITE_FORMAT = 24;
  434. public const int SQLITE_RANGE = 25;
  435. public const int SQLITE_NOTADB = 26;
  436. public const int SQLITE_ROW = 100;
  437. public const int SQLITE_DONE = 101;
  438. /*
  439. ** CAPI3REF: Extended Result Codes
  440. ** KEYWORDS: {extended error code} {extended error codes}
  441. ** KEYWORDS: {extended result code} {extended result codes}
  442. **
  443. ** In its default configuration, SQLite API routines return one of 26 integer
  444. ** [SQLITE_OK | result codes]. However, experience has shown that many of
  445. ** these result codes are too coarse-grained. They do not provide as
  446. ** much information about problems as programmers might like. In an effort to
  447. ** address this, newer versions of SQLite (version 3.3.8 and later) include
  448. ** support for additional result codes that provide more detailed information
  449. ** about errors. The extended result codes are enabled or disabled
  450. ** on a per database connection basis using the
  451. ** [sqlite3_extended_result_codes()] API.
  452. **
  453. ** Some of the available extended result codes are listed here.
  454. ** One may expect the number of extended result codes will be expand
  455. ** over time. Software that uses extended result codes should expect
  456. ** to see new result codes in future releases of SQLite.
  457. **
  458. ** The SQLITE_OK result code will never be extended. It will always
  459. ** be exactly zero.
  460. */
  461. //#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
  462. //#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
  463. //#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
  464. //#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8))
  465. //#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8))
  466. //#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8))
  467. //#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8))
  468. //#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8))
  469. //#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8))
  470. //#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8))
  471. //#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8))
  472. //#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8))
  473. //#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8))
  474. //#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))
  475. //#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8))
  476. //#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8))
  477. //#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))
  478. //#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8))
  479. //#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8))
  480. //#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8))
  481. //#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
  482. //#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
  483. //#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
  484. const int SQLITE_IOERR_READ = ( SQLITE_IOERR | ( 1 << 8 ) );
  485. const int SQLITE_IOERR_SHORT_READ = ( SQLITE_IOERR | ( 2 << 8 ) );
  486. const int SQLITE_IOERR_WRITE = ( SQLITE_IOERR | ( 3 << 8 ) );
  487. const int SQLITE_IOERR_FSYNC = ( SQLITE_IOERR | ( 4 << 8 ) );
  488. const int SQLITE_IOERR_DIR_FSYNC = ( SQLITE_IOERR | ( 5 << 8 ) );
  489. const int SQLITE_IOERR_TRUNCATE = ( SQLITE_IOERR | ( 6 << 8 ) );
  490. const int SQLITE_IOERR_FSTAT = ( SQLITE_IOERR | ( 7 << 8 ) );
  491. const int SQLITE_IOERR_UNLOCK = ( SQLITE_IOERR | ( 8 << 8 ) );
  492. const int SQLITE_IOERR_RDLOCK = ( SQLITE_IOERR | ( 9 << 8 ) );
  493. const int SQLITE_IOERR_DELETE = ( SQLITE_IOERR | ( 10 << 8 ) );
  494. const int SQLITE_IOERR_BLOCKED = ( SQLITE_IOERR | ( 11 << 8 ) );
  495. const int SQLITE_IOERR_NOMEM = ( SQLITE_IOERR | ( 12 << 8 ) );
  496. const int SQLITE_IOERR_ACCESS = ( SQLITE_IOERR | ( 13 << 8 ) );
  497. const int SQLITE_IOERR_CHECKRESERVEDLOCK = ( SQLITE_IOERR | ( 14 << 8 ) );
  498. const int SQLITE_IOERR_LOCK = ( SQLITE_IOERR | ( 15 << 8 ) );
  499. const int SQLITE_IOERR_CLOSE = ( SQLITE_IOERR | ( 16 << 8 ) );
  500. const int SQLITE_IOERR_DIR_CLOSE = ( SQLITE_IOERR | ( 17 << 8 ) );
  501. const int SQLITE_IOERR_SHMOPEN = ( SQLITE_IOERR | ( 18 << 8 ) );
  502. const int SQLITE_IOERR_SHMSIZE = ( SQLITE_IOERR | ( 19 << 8 ) );
  503. const int SQLITE_IOERR_SHMLOCK = ( SQLITE_IOERR | ( 20 << 8 ) );
  504. const int SQLITE_LOCKED_SHAREDCACHE = ( SQLITE_LOCKED | ( 1 << 8 ) );
  505. const int SQLITE_BUSY_RECOVERY = ( SQLITE_BUSY | ( 1 << 8 ) );
  506. const int SQLITE_CANTOPEN_NOTEMPDIR = ( SQLITE_CANTOPEN | ( 1 << 8 ) );
  507. /*
  508. ** CAPI3REF: Flags For File Open Operations
  509. **
  510. ** These bit values are intended for use in the
  511. ** 3rd parameter to the [sqlite3_open_v2()] interface and
  512. ** in the 4th parameter to the xOpen method of the
  513. ** [sqlite3_vfs] object.
  514. */
  515. //#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
  516. //#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */
  517. //#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */
  518. //#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */
  519. //#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */
  520. //#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */
  521. //#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */
  522. //#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */
  523. //#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */
  524. //#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */
  525. //#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */
  526. //#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */
  527. //#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */
  528. //#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */
  529. //#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
  530. //#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */
  531. //#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
  532. //#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
  533. /* Reserved: 0x00F00000 */
  534. public const int SQLITE_OPEN_READONLY = 0x00000001;
  535. public const int SQLITE_OPEN_READWRITE = 0x00000002;
  536. public const int SQLITE_OPEN_CREATE = 0x00000004;
  537. public const int SQLITE_OPEN_DELETEONCLOSE = 0x00000008;
  538. public const int SQLITE_OPEN_EXCLUSIVE = 0x00000010;
  539. public const int SQLITE_OPEN_AUTOPROXY = 0x00000020;
  540. public const int SQLITE_OPEN_MAIN_DB = 0x00000100;
  541. public const int SQLITE_OPEN_TEMP_DB = 0x00000200;
  542. public const int SQLITE_OPEN_TRANSIENT_DB = 0x00000400;
  543. public const int SQLITE_OPEN_MAIN_JOURNAL = 0x00000800;
  544. public const int SQLITE_OPEN_TEMP_JOURNAL = 0x00001000;
  545. public const int SQLITE_OPEN_SUBJOURNAL = 0x00002000;
  546. public const int SQLITE_OPEN_MASTER_JOURNAL = 0x00004000;
  547. public const int SQLITE_OPEN_NOMUTEX = 0x00008000;
  548. public const int SQLITE_OPEN_FULLMUTEX = 0x00010000;
  549. public const int SQLITE_OPEN_SHAREDCACHE = 0x00020000;
  550. public const int SQLITE_OPEN_PRIVATECACHE = 0x00040000;
  551. public const int SQLITE_OPEN_WAL = 0x00080000;
  552. /*
  553. ** CAPI3REF: Device Characteristics
  554. **
  555. ** The xDeviceCharacteristics method of the [sqlite3_io_methods]
  556. ** object returns an integer which is a vector of the these
  557. ** bit values expressing I/O characteristics of the mass storage
  558. ** device that holds the file that the [sqlite3_io_methods]
  559. ** refers to.
  560. **
  561. ** The SQLITE_IOCAP_ATOMIC property means that all writes of
  562. ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
  563. ** mean that writes of blocks that are nnn bytes in size and
  564. ** are aligned to an address which is an integer multiple of
  565. ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
  566. ** that when data is appended to a file, the data is appended
  567. ** first then the size of the file is extended, never the other
  568. ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
  569. ** information is written to disk in the same order as calls
  570. ** to xWrite().
  571. */
  572. //#define SQLITE_IOCAP_ATOMIC 0x00000001
  573. //#define SQLITE_IOCAP_ATOMIC512 0x00000002
  574. //#define SQLITE_IOCAP_ATOMIC1K 0x00000004
  575. //#define SQLITE_IOCAP_ATOMIC2K 0x00000008
  576. //#define SQLITE_IOCAP_ATOMIC4K 0x00000010
  577. //#define SQLITE_IOCAP_ATOMIC8K 0x00000020
  578. //#define SQLITE_IOCAP_ATOMIC16K 0x00000040
  579. //#define SQLITE_IOCAP_ATOMIC32K 0x00000080
  580. //#define SQLITE_IOCAP_ATOMIC64K 0x00000100
  581. //#define SQLITE_IOCAP_SAFE_APPEND 0x00000200
  582. //#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
  583. //#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
  584. const int SQLITE_IOCAP_ATOMIC = 0x00000001;
  585. const int SQLITE_IOCAP_ATOMIC512 = 0x00000002;
  586. const int SQLITE_IOCAP_ATOMIC1K = 0x00000004;
  587. const int SQLITE_IOCAP_ATOMIC2K = 0x00000008;
  588. const int SQLITE_IOCAP_ATOMIC4K = 0x00000010;
  589. const int SQLITE_IOCAP_ATOMIC8K = 0x00000020;
  590. const int SQLITE_IOCAP_ATOMIC16K = 0x00000040;
  591. const int SQLITE_IOCAP_ATOMIC32K = 0x00000080;
  592. const int SQLITE_IOCAP_ATOMIC64K = 0x00000100;
  593. const int SQLITE_IOCAP_SAFE_APPEND = 0x00000200;
  594. const int SQLITE_IOCAP_SEQUENTIAL = 0x00000400;
  595. const int SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN = 0x00000800;
  596. /*
  597. ** CAPI3REF: File Locking Levels
  598. **
  599. ** SQLite uses one of these integer values as the second
  600. ** argument to calls it makes to the xLock() and xUnlock() methods
  601. ** of an [sqlite3_io_methods] object.
  602. */
  603. //#define SQLITE_LOCK_NONE 0
  604. //#define SQLITE_LOCK_SHARED 1
  605. //#define SQLITE_LOCK_RESERVED 2
  606. //#define SQLITE_LOCK_PENDING 3
  607. //#define SQLITE_LOCK_EXCLUSIVE 4
  608. const int SQLITE_LOCK_NONE = 0;
  609. const int SQLITE_LOCK_SHARED = 1;
  610. const int SQLITE_LOCK_RESERVED = 2;
  611. const int SQLITE_LOCK_PENDING = 3;
  612. const int SQLITE_LOCK_EXCLUSIVE = 4;
  613. /*
  614. ** CAPI3REF: Synchronization Type Flags
  615. **
  616. ** When SQLite invokes the xSync() method of an
  617. ** [sqlite3_io_methods] object it uses a combination of
  618. ** these integer values as the second argument.
  619. **
  620. ** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
  621. ** sync operation only needs to flush data to mass storage. Inode
  622. ** information need not be flushed. If the lower four bits of the flag
  623. ** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
  624. ** If the lower four bits equal SQLITE_SYNC_FULL, that means
  625. ** to use Mac OS X style fullsync instead of fsync().
  626. **
  627. ** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
  628. ** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
  629. ** settings. The [synchronous pragma] determines when calls to the
  630. ** xSync VFS method occur and applies uniformly across all platforms.
  631. ** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
  632. ** energetic or rigorous or forceful the sync operations are and
  633. ** only make a difference on Mac OSX for the default SQLite code.
  634. ** (Third-party VFS implementations might also make the distinction
  635. ** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
  636. ** operating systems natively supported by SQLite, only Mac OSX
  637. ** cares about the difference.)
  638. */
  639. //#define SQLITE_SYNC_NORMAL 0x00002
  640. //#define SQLITE_SYNC_FULL 0x00003
  641. //#define SQLITE_SYNC_DATAONLY 0x00010
  642. const int SQLITE_SYNC_NORMAL = 0x00002;
  643. const int SQLITE_SYNC_FULL = 0x00003;
  644. const int SQLITE_SYNC_DATAONLY = 0x00010;
  645. /*
  646. ** CAPI3REF: OS Interface Open File Handle
  647. **
  648. ** An [sqlite3_file] object represents an open file in the
  649. ** [sqlite3_vfs | OS interface layer]. Individual OS interface
  650. ** implementations will
  651. ** want to subclass this object by appending additional fields
  652. ** for their own use. The pMethods entry is a pointer to an
  653. ** [sqlite3_io_methods] object that defines methods for performing
  654. ** I/O operations on the open file.
  655. */
  656. //typedef struct sqlite3_file sqlite3_file;
  657. //struct sqlite3_file {
  658. // const struct sqlite3_io_methods *pMethods; /* Methods for an open file */
  659. //};
  660. public partial class sqlite3_file
  661. {
  662. public sqlite3_io_methods pMethods;/* Must be first */
  663. }
  664. /*
  665. ** CAPI3REF: OS Interface File Virtual Methods Object
  666. **
  667. ** Every file opened by the [sqlite3_vfs] xOpen method populates an
  668. ** [sqlite3_file] object (or, more commonly, a subclass of the
  669. ** [sqlite3_file] object) with a pointer to an instance of this object.
  670. ** This object defines the methods used to perform various operations
  671. ** against the open file represented by the [sqlite3_file] object.
  672. **
  673. ** If the xOpen method sets the sqlite3_file.pMethods element
  674. ** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
  675. ** may be invoked even if the xOpen reported that it failed. The
  676. ** only way to prevent a call to xClose following a failed xOpen
  677. ** is for the xOpen to set the sqlite3_file.pMethods element to NULL.
  678. **
  679. ** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
  680. ** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
  681. ** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
  682. ** flag may be ORed in to indicate that only the data of the file
  683. ** and not its inode needs to be synced.
  684. **
  685. ** The integer values to xLock() and xUnlock() are one of
  686. ** <ul>
  687. ** <li> [SQLITE_LOCK_NONE],
  688. ** <li> [SQLITE_LOCK_SHARED],
  689. ** <li> [SQLITE_LOCK_RESERVED],
  690. ** <li> [SQLITE_LOCK_PENDING], or
  691. ** <li> [SQLITE_LOCK_EXCLUSIVE].
  692. ** </ul>
  693. ** xLock() increases the lock. xUnlock() decreases the lock.
  694. ** The xCheckReservedLock() method checks whether any database connection,
  695. ** either in this process or in some other process, is holding a RESERVED,
  696. ** PENDING, or EXCLUSIVE lock on the file. It returns true
  697. ** if such a lock exists and false otherwise.
  698. **
  699. ** The xFileControl() method is a generic interface that allows custom
  700. ** VFS implementations to directly control an open file using the
  701. ** [sqlite3_file_control()] interface. The second "op" argument is an
  702. ** integer opcode. The third argument is a generic pointer intended to
  703. ** point to a structure that may contain arguments or space in which to
  704. ** write return values. Potential uses for xFileControl() might be
  705. ** functions to enable blocking locks with timeouts, to change the
  706. ** locking strategy (for example to use dot-file locks), to inquire
  707. ** about the status of a lock, or to break stale locks. The SQLite
  708. ** core reserves all opcodes less than 100 for its own use.
  709. ** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
  710. ** Applications that define a custom xFileControl method should use opcodes
  711. ** greater than 100 to avoid conflicts. VFS implementations should
  712. ** return [SQLITE_NOTFOUND] for file control opcodes that they do not
  713. ** recognize.
  714. **
  715. ** The xSectorSize() method returns the sector size of the
  716. ** device that underlies the file. The sector size is the
  717. ** minimum write that can be performed without disturbing
  718. ** other bytes in the file. The xDeviceCharacteristics()
  719. ** method returns a bit vector describing behaviors of the
  720. ** underlying device:
  721. **
  722. ** <ul>
  723. ** <li> [SQLITE_IOCAP_ATOMIC]
  724. ** <li> [SQLITE_IOCAP_ATOMIC512]
  725. ** <li> [SQLITE_IOCAP_ATOMIC1K]
  726. ** <li> [SQLITE_IOCAP_ATOMIC2K]
  727. ** <li> [SQLITE_IOCAP_ATOMIC4K]
  728. ** <li> [SQLITE_IOCAP_ATOMIC8K]
  729. ** <li> [SQLITE_IOCAP_ATOMIC16K]
  730. ** <li> [SQLITE_IOCAP_ATOMIC32K]
  731. ** <li> [SQLITE_IOCAP_ATOMIC64K]
  732. ** <li> [SQLITE_IOCAP_SAFE_APPEND]
  733. ** <li> [SQLITE_IOCAP_SEQUENTIAL]
  734. ** </ul>
  735. **
  736. ** The SQLITE_IOCAP_ATOMIC property means that all writes of
  737. ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
  738. ** mean that writes of blocks that are nnn bytes in size and
  739. ** are aligned to an address which is an integer multiple of
  740. ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
  741. ** that when data is appended to a file, the data is appended
  742. ** first then the size of the file is extended, never the other
  743. ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
  744. ** information is written to disk in the same order as calls
  745. ** to xWrite().
  746. **
  747. ** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
  748. ** in the unread portions of the buffer with zeros. A VFS that
  749. ** fails to zero-fill short reads might seem to work. However,
  750. ** failure to zero-fill short reads will eventually lead to
  751. ** database corruption.
  752. */
  753. //typedef struct sqlite3_io_methods sqlite3_io_methods;
  754. //struct sqlite3_io_methods {
  755. // int iVersion;
  756. // int (*xClose)(sqlite3_file*);
  757. // int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
  758. // int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
  759. // int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);
  760. // int (*xSync)(sqlite3_file*, int flags);
  761. // int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
  762. // int (*xLock)(sqlite3_file*, int);
  763. // int (*xUnlock)(sqlite3_file*, int);
  764. // int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);
  765. // int (*xFileControl)(sqlite3_file*, int op, void *pArg);
  766. // int (*xSectorSize)(sqlite3_file*);
  767. // int (*xDeviceCharacteristics)(sqlite3_file*);
  768. // /* Methods above are valid for version 1 */
  769. // int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
  770. // int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
  771. // void (*xShmBarrier)(sqlite3_file*);
  772. // int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
  773. // /* Methods above are valid for version 2 */
  774. // /* Additional methods may be added in future releases */
  775. //};
  776. public class sqlite3_io_methods
  777. {
  778. public int iVersion;
  779. public dxClose xClose;
  780. public dxRead xRead;
  781. public dxWrite xWrite;
  782. public dxTruncate xTruncate;
  783. public dxSync xSync;
  784. public dxFileSize xFileSize;
  785. public dxLock xLock;
  786. public dxUnlock xUnlock;
  787. public dxCheckReservedLock xCheckReservedLock;
  788. public dxFileControl xFileControl;
  789. public dxSectorSize xSectorSize;
  790. public dxDeviceCharacteristics xDeviceCharacteristics;
  791. public dxShmMap xShmMap;//int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
  792. public dxShmLock xShmLock;//int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
  793. public dxShmBarrier xShmBarrier;//void (*xShmBarrier)(sqlite3_file*);
  794. public dxShmUnmap xShmUnmap;//int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
  795. /* Additional methods may be added in future releases */
  796. public sqlite3_io_methods( int iVersion,
  797. dxClose xClose,
  798. dxRead xRead,
  799. dxWrite xWrite,
  800. dxTruncate xTruncate,
  801. dxSync xSync,
  802. dxFileSize xFileSize,
  803. dxLock xLock,
  804. dxUnlock xUnlock,
  805. dxCheckReservedLock xCheckReservedLock,
  806. dxFileControl xFileControl,
  807. dxSectorSize xSectorSize,
  808. dxDeviceCharacteristics xDeviceCharacteristics,
  809. dxShmMap xShmMap,
  810. dxShmLock xShmLock,
  811. dxShmBarrier xShmBarrier,
  812. dxShmUnmap xShmUnmap
  813. )
  814. {
  815. this.iVersion = iVersion;
  816. this.xClose = xClose;
  817. this.xRead = xRead;
  818. this.xWrite = xWrite;
  819. this.xTruncate = xTruncate;
  820. this.xSync = xSync;
  821. this.xFileSize = xFileSize;
  822. this.xLock = xLock;
  823. this.xUnlock = xUnlock;
  824. this.xCheckReservedLock = xCheckReservedLock;
  825. this.xFileControl = xFileControl;
  826. this.xSectorSize = xSectorSize;
  827. this.xDeviceCharacteristics = xDeviceCharacteristics;
  828. this.xShmMap = xShmMap;
  829. this.xShmLock = xShmLock;
  830. this.xShmBarrier = xShmBarrier;
  831. this.xShmUnmap = xShmUnmap;
  832. }
  833. }
  834. /*
  835. ** CAPI3REF: Standard File Control Opcodes
  836. **
  837. ** These integer constants are opcodes for the xFileControl method
  838. ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
  839. ** interface.
  840. **
  841. ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
  842. ** opcode causes the xFileControl method to write the current state of
  843. ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
  844. ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
  845. ** into an integer that the pArg argument points to. This capability
  846. ** is used during testing and only needs to be supported when SQLITE_TEST
  847. ** is defined.
  848. **
  849. ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
  850. ** layer a hint of how large the database file will grow to be during the
  851. ** current transaction. This hint is not guaranteed to be accurate but it
  852. ** is often close. The underlying VFS might choose to preallocate database
  853. ** file space based on this hint in order to help writes to the database
  854. ** file run faster.
  855. **
  856. ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
  857. ** extends and truncates the database file in chunks of a size specified
  858. ** by the user. The fourth argument to [sqlite3_file_control()] should
  859. ** point to an integer (type int) containing the new chunk-size to use
  860. ** for the nominated database. Allocating database file space in large
  861. ** chunks (say 1MB at a time), may reduce file-system fragmentation and
  862. ** improve performance on some systems.
  863. **
  864. ** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
  865. ** to the [sqlite3_file] object associated with a particular database
  866. ** connection. See the [sqlite3_file_control()] documentation for
  867. ** additional information.
  868. **
  869. ** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by
  870. ** SQLite and sent to all VFSes in place of a call to the xSync method
  871. ** when the database connection has [PRAGMA synchronous] set to OFF.)^
  872. ** Some specialized VFSes need this signal in order to operate correctly
  873. ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
  874. ** VFSes do not need this signal and should silently ignore this opcode.
  875. ** Applications should not call [sqlite3_file_control()] with this
  876. ** opcode as doing so may disrupt the operation of the specilized VFSes
  877. ** that do require it.
  878. */
  879. //#define SQLITE_FCNTL_LOCKSTATE 1
  880. //#define SQLITE_GET_LOCKPROXYFILE 2
  881. //#define SQLITE_SET_LOCKPROXYFILE 3
  882. //#define SQLITE_LAST_ERRNO 4
  883. //#define SQLITE_FCNTL_SIZE_HINT 5
  884. //#define SQLITE_FCNTL_CHUNK_SIZE 6
  885. //#define SQLITE_FCNTL_FILE_POINTER 7
  886. //#define SQLITE_FCNTL_SYNC_OMITTED 8
  887. const int SQLITE_FCNTL_LOCKSTATE = 1;
  888. const int SQLITE_GET_LOCKPROXYFILE = 2;
  889. const int SQLITE_SET_LOCKPROXYFILE = 3;
  890. const int SQLITE_LAST_ERRNO = 4;
  891. const int SQLITE_FCNTL_SIZE_HINT = 5;
  892. const int SQLITE_FCNTL_CHUNK_SIZE = 6;
  893. const int SQLITE_FCNTL_FILE_POINTER = 7;
  894. const int SQLITE_FCNTL_SYNC_OMITTED = 8;
  895. /*
  896. ** CAPI3REF: Mutex Handle
  897. **
  898. ** The mutex module within SQLite defines [sqlite3_mutex] to be an
  899. ** abstract type for a mutex object. The SQLite core never looks
  900. ** at the internal representation of an [sqlite3_mutex]. It only
  901. ** deals with pointers to the [sqlite3_mutex] object.
  902. **
  903. ** Mutexes are created using [sqlite3_mutex_alloc()].
  904. */
  905. //typedef struct sqlite3_mutex sqlite3_mutex;
  906. /*
  907. ** CAPI3REF: OS Interface Object
  908. **
  909. ** An instance of the sqlite3_vfs object defines the interface between
  910. ** the SQLite core and the underlying operating system. The "vfs"
  911. ** in the name of the object stands for "virtual file system".
  912. **
  913. ** The value of the iVersion field is initially 1 but may be larger in
  914. ** future versions of SQLite. Additional fields may be appended to this
  915. ** object when the iVersion value is increased. Note that the structure
  916. ** of the sqlite3_vfs object changes in the transaction between
  917. ** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not
  918. ** modified.
  919. **
  920. ** The szOsFile field is the size of the subclassed [sqlite3_file]
  921. ** structure used by this VFS. mxPathname is the maximum length of
  922. ** a pathname in this VFS.
  923. **
  924. ** Registered sqlite3_vfs objects are kept on a linked list formed by
  925. ** the pNext pointer. The [sqlite3_vfs_register()]
  926. ** and [sqlite3_vfs_unregister()] interfaces manage this list
  927. ** in a thread-safe way. The [sqlite3_vfs_find()] interface
  928. ** searches the list. Neither the application code nor the VFS
  929. ** implementation should use the pNext pointer.
  930. **
  931. ** The pNext field is the only field in the sqlite3_vfs
  932. ** structure that SQLite will ever modify. SQLite will only access
  933. ** or modify this field while holding a particular static mutex.
  934. ** The application should never modify anything within the sqlite3_vfs
  935. ** object once the object has been registered.
  936. **
  937. ** The zName field holds the name of the VFS module. The name must
  938. ** be unique across all VFS modules.
  939. **
  940. ** ^SQLite guarantees that the zFilename parameter to xOpen
  941. ** is either a NULL pointer or string obtained
  942. ** from xFullPathname() with an optional suffix added.
  943. ** ^If a suffix is added to the zFilename parameter, it will
  944. ** consist of a single "-" character followed by no more than
  945. ** 10 alphanumeric and/or "-" characters.
  946. ** ^SQLite further guarantees that
  947. ** the string will be valid and unchanged until xClose() is
  948. ** called. Because of the previous sentence,
  949. ** the [sqlite3_file] can safely store a pointer to the
  950. ** filename if it needs to remember the filename for some reason.
  951. ** If the zFilename parameter to xOpen is a NULL pointer then xOpen
  952. ** must invent its own temporary name for the file. ^Whenever the
  953. ** xFilename parameter is NULL it will also be the case that the
  954. ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
  955. **
  956. ** The flags argument to xOpen() includes all bits set in
  957. ** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()]
  958. ** or [sqlite3_open16()] is used, then flags includes at least
  959. ** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
  960. ** If xOpen() opens a file read-only then it sets *pOutFlags to
  961. ** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set.
  962. **
  963. ** ^(SQLite will also add one of the following flags to the xOpen()
  964. ** call, depending on the object being opened:
  965. **
  966. ** <ul>
  967. ** <li> [SQLITE_OPEN_MAIN_DB]
  968. ** <li> [SQLITE_OPEN_MAIN_JOURNAL]
  969. ** <li> [SQLITE_OPEN_TEMP_DB]
  970. ** <li> [SQLITE_OPEN_TEMP_JOURNAL]
  971. ** <li> [SQLITE_OPEN_TRANSIENT_DB]
  972. ** <li> [SQLITE_OPEN_SUBJOURNAL]
  973. ** <li> [SQLITE_OPEN_MASTER_JOURNAL]
  974. ** <li> [SQLITE_OPEN_WAL]
  975. ** </ul>)^
  976. **
  977. ** The file I/O implementation can use the object type flags to
  978. ** change the way it deals with files. For example, an application
  979. ** that does not care about crash recovery or rollback might make
  980. ** the open of a journal file a no-op. Writes to this journal would
  981. ** also be no-ops, and any attempt to read the journal would return
  982. ** SQLITE_IOERR. Or the implementation might recognize that a database
  983. ** file will be doing page-aligned sector reads and writes in a random
  984. ** order and set up its I/O subsystem accordingly.
  985. **
  986. ** SQLite might also add one of the following flags to …

Large files files are truncated, but you can click here to view the full file