PageRenderTime 62ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/Community.CsharpSqlite/src/sqlite3_h.cs

https://bitbucket.org/eumario/csharp-sqlite
C# | 7485 lines | 703 code | 209 blank | 6573 comment | 1 complexity | 567165b45bb3aa2ee8635f8eeb4ebd54 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-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2
  43. **
  44. *************************************************************************
  45. */
  46. //#if !_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. //#if __cplusplus
  53. //extern "C" {
  54. //#endif
  55. /*
  56. ** Add the ability to override 'extern'
  57. */
  58. //#if !SQLITE_EXTERN
  59. //# define SQLITE_EXTERN extern
  60. //#endif
  61. //#if !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. //#if SQLITE_VERSION
  83. //# undef SQLITE_VERSION
  84. //#endif
  85. //#if 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.7"
  116. //#define SQLITE_VERSION_NUMBER 3007007
  117. //#define SQLITE_SOURCE_ID "2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2"
  118. public const string SQLITE_VERSION = "3.7.7(C#)";
  119. public const int SQLITE_VERSION_NUMBER = 300700701;
  120. public const string SQLITE_SOURCE_ID = "2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2";
  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 Debug.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. ** Debug.Assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
  135. ** Debug.Assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
  136. ** Debug.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 string sqlite3_libversion(void);
  153. //SQLITE_API string 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. //#if !SQLITE_OMIT_COMPILEOPTION_DIAGS
  178. //SQLITE_API int sqlite3_compileoption_used(string zOptName);
  179. //SQLITE_API string 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. //#if 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. //#if 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. ** 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. // string 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. ** [sqlite3_vtab_on_conflict()] [SQLITE_ROLLBACK | result codes].
  378. */
  379. //#define SQLITE_OK 0 /* Successful result */
  380. ///* beginning-of-error-codes */
  381. //#define SQLITE_ERROR 1 /* SQL error or missing database */
  382. //#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
  383. //#define SQLITE_PERM 3 /* Access permission denied */
  384. //#define SQLITE_ABORT 4 /* Callback routine requested an abort */
  385. //#define SQLITE_BUSY 5 /* The database file is locked */
  386. //#define SQLITE_LOCKED 6 /* A table in the database is locked */
  387. //#define SQLITE_NOMEM 7 /* A malloc() failed */
  388. //#define SQLITE_READONLY 8 /* Attempt to write a readonly database */
  389. //#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/
  390. //#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
  391. //#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
  392. //#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
  393. //#define SQLITE_FULL 13 /* Insertion failed because database is full */
  394. //#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
  395. //#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
  396. //#define SQLITE_EMPTY 16 /* Database is empty */
  397. //#define SQLITE_SCHEMA 17 /* The database schema changed */
  398. //#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
  399. //#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
  400. //#define SQLITE_MISMATCH 20 /* Data type mismatch */
  401. //#define SQLITE_MISUSE 21 /* Library used incorrectly */
  402. //#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
  403. //#define SQLITE_AUTH 23 /* Authorization denied */
  404. //#define SQLITE_FORMAT 24 /* Auxiliary database format error */
  405. //#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
  406. //#define SQLITE_NOTADB 26 /* File opened that is not a database file */
  407. //#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
  408. //#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */
  409. /* end-of-error-codes */
  410. public const int SQLITE_OK = 0;
  411. public const int SQLITE_ERROR = 1;
  412. public const int SQLITE_INTERNAL = 2;
  413. public const int SQLITE_PERM = 3;
  414. public const int SQLITE_ABORT = 4;
  415. public const int SQLITE_BUSY = 5;
  416. public const int SQLITE_LOCKED = 6;
  417. public const int SQLITE_NOMEM = 7;
  418. public const int SQLITE_READONLY = 8;
  419. public const int SQLITE_INTERRUPT = 9;
  420. public const int SQLITE_IOERR = 10;
  421. public const int SQLITE_CORRUPT = 11;
  422. public const int SQLITE_NOTFOUND = 12;
  423. public const int SQLITE_FULL = 13;
  424. public const int SQLITE_CANTOPEN = 14;
  425. public const int SQLITE_PROTOCOL = 15;
  426. public const int SQLITE_EMPTY = 16;
  427. public const int SQLITE_SCHEMA = 17;
  428. public const int SQLITE_TOOBIG = 18;
  429. public const int SQLITE_CONSTRAINT = 19;
  430. public const int SQLITE_MISMATCH = 20;
  431. public const int SQLITE_MISUSE = 21;
  432. public const int SQLITE_NOLFS = 22;
  433. public const int SQLITE_AUTH = 23;
  434. public const int SQLITE_FORMAT = 24;
  435. public const int SQLITE_RANGE = 25;
  436. public const int SQLITE_NOTADB = 26;
  437. public const int SQLITE_ROW = 100;
  438. public const int SQLITE_DONE = 101;
  439. /*
  440. ** CAPI3REF: Extended Result Codes
  441. ** KEYWORDS: {extended error code} {extended error codes}
  442. ** KEYWORDS: {extended result code} {extended result codes}
  443. **
  444. ** In its default configuration, SQLite API routines return one of 26 integer
  445. ** [SQLITE_OK | result codes]. However, experience has shown that many of
  446. ** these result codes are too coarse-grained. They do not provide as
  447. ** much information about problems as programmers might like. In an effort to
  448. ** address this, newer versions of SQLite (version 3.3.8 and later) include
  449. ** support for additional result codes that provide more detailed information
  450. ** about errors. The extended result codes are enabled or disabled
  451. ** on a per database connection basis using the
  452. ** [sqlite3_extended_result_codes()] API.
  453. **
  454. ** Some of the available extended result codes are listed here.
  455. ** One may expect the number of extended result codes will be expand
  456. ** over time. Software that uses extended result codes should expect
  457. ** to see new result codes in future releases of SQLite.
  458. **
  459. ** The SQLITE_OK result code will never be extended. It will always
  460. ** be exactly zero.
  461. */
  462. //#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
  463. //#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
  464. //#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
  465. //#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8))
  466. //#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8))
  467. //#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8))
  468. //#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8))
  469. //#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8))
  470. //#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8))
  471. //#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8))
  472. //#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8))
  473. //#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8))
  474. //#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8))
  475. //#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))
  476. //#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8))
  477. //#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8))
  478. //#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))
  479. //#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8))
  480. //#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8))
  481. //#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8))
  482. //#define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8))
  483. //#define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8))
  484. //#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
  485. //#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
  486. //#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
  487. //#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
  488. //#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
  489. //#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
  490. const int SQLITE_IOERR_READ = ( SQLITE_IOERR | ( 1 << 8 ) );
  491. const int SQLITE_IOERR_SHORT_READ = ( SQLITE_IOERR | ( 2 << 8 ) );
  492. const int SQLITE_IOERR_WRITE = ( SQLITE_IOERR | ( 3 << 8 ) );
  493. const int SQLITE_IOERR_FSYNC = ( SQLITE_IOERR | ( 4 << 8 ) );
  494. const int SQLITE_IOERR_DIR_FSYNC = ( SQLITE_IOERR | ( 5 << 8 ) );
  495. const int SQLITE_IOERR_TRUNCATE = ( SQLITE_IOERR | ( 6 << 8 ) );
  496. const int SQLITE_IOERR_FSTAT = ( SQLITE_IOERR | ( 7 << 8 ) );
  497. const int SQLITE_IOERR_UNLOCK = ( SQLITE_IOERR | ( 8 << 8 ) );
  498. const int SQLITE_IOERR_RDLOCK = ( SQLITE_IOERR | ( 9 << 8 ) );
  499. const int SQLITE_IOERR_DELETE = ( SQLITE_IOERR | ( 10 << 8 ) );
  500. const int SQLITE_IOERR_BLOCKED = ( SQLITE_IOERR | ( 11 << 8 ) );
  501. const int SQLITE_IOERR_NOMEM = ( SQLITE_IOERR | ( 12 << 8 ) );
  502. const int SQLITE_IOERR_ACCESS = ( SQLITE_IOERR | ( 13 << 8 ) );
  503. const int SQLITE_IOERR_CHECKRESERVEDLOCK = ( SQLITE_IOERR | ( 14 << 8 ) );
  504. const int SQLITE_IOERR_LOCK = ( SQLITE_IOERR | ( 15 << 8 ) );
  505. const int SQLITE_IOERR_CLOSE = ( SQLITE_IOERR | ( 16 << 8 ) );
  506. const int SQLITE_IOERR_DIR_CLOSE = ( SQLITE_IOERR | ( 17 << 8 ) );
  507. const int SQLITE_IOERR_SHMOPEN = ( SQLITE_IOERR | ( 18 << 8 ) );
  508. const int SQLITE_IOERR_SHMSIZE = ( SQLITE_IOERR | ( 19 << 8 ) );
  509. const int SQLITE_IOERR_SHMLOCK = ( SQLITE_IOERR | ( 20 << 8 ) );
  510. const int SQLITE_IOERR_SHMMAP = ( SQLITE_IOERR | ( 21 << 8 ) );
  511. const int SQLITE_IOERR_SEEK = ( SQLITE_IOERR | ( 22 << 8 ) );
  512. const int SQLITE_LOCKED_SHAREDCACHE = ( SQLITE_LOCKED | ( 1 << 8 ) );
  513. const int SQLITE_BUSY_RECOVERY = ( SQLITE_BUSY | ( 1 << 8 ) );
  514. const int SQLITE_CANTOPEN_NOTEMPDIR = ( SQLITE_CANTOPEN | ( 1 << 8 ) );
  515. const int SQLITE_CORRUPT_VTAB = ( SQLITE_CORRUPT | ( 1 << 8 ) );
  516. const int SQLITE_READONLY_RECOVERY = ( SQLITE_READONLY | ( 1 << 8 ) );
  517. const int SQLITE_READONLY_CANTLOCK = ( SQLITE_READONLY | ( 2 << 8 ) );
  518. /*
  519. ** CAPI3REF: Flags For File Open Operations
  520. **
  521. ** These bit values are intended for use in the
  522. ** 3rd parameter to the [sqlite3_open_v2()] interface and
  523. ** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
  524. */
  525. //#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
  526. //#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */
  527. //#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */
  528. //#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */
  529. //#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */
  530. //#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */
  531. //#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */
  532. //#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */
  533. //#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */
  534. //#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */
  535. //#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */
  536. //#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */
  537. //#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */
  538. //#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */
  539. //#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */
  540. //#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
  541. //#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */
  542. //#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
  543. //#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
  544. /* Reserved: 0x00F00000 */
  545. public const int SQLITE_OPEN_READONLY = 0x00000001;
  546. public const int SQLITE_OPEN_READWRITE = 0x00000002;
  547. public const int SQLITE_OPEN_CREATE = 0x00000004;
  548. public const int SQLITE_OPEN_DELETEONCLOSE = 0x00000008;
  549. public const int SQLITE_OPEN_EXCLUSIVE = 0x00000010;
  550. public const int SQLITE_OPEN_AUTOPROXY = 0x00000020;
  551. public const int SQLITE_OPEN_URI = 0x00000040;
  552. public const int SQLITE_OPEN_MAIN_DB = 0x00000100;
  553. public const int SQLITE_OPEN_TEMP_DB = 0x00000200;
  554. public const int SQLITE_OPEN_TRANSIENT_DB = 0x00000400;
  555. public const int SQLITE_OPEN_MAIN_JOURNAL = 0x00000800;
  556. public const int SQLITE_OPEN_TEMP_JOURNAL = 0x00001000;
  557. public const int SQLITE_OPEN_SUBJOURNAL = 0x00002000;
  558. public const int SQLITE_OPEN_MASTER_JOURNAL = 0x00004000;
  559. public const int SQLITE_OPEN_NOMUTEX = 0x00008000;
  560. public const int SQLITE_OPEN_FULLMUTEX = 0x00010000;
  561. public const int SQLITE_OPEN_SHAREDCACHE = 0x00020000;
  562. public const int SQLITE_OPEN_PRIVATECACHE = 0x00040000;
  563. public const int SQLITE_OPEN_WAL = 0x00080000;
  564. /*
  565. ** CAPI3REF: Device Characteristics
  566. **
  567. ** The xDeviceCharacteristics method of the [sqlite3_io_methods]
  568. ** object returns an integer which is a vector of the these
  569. ** bit values expressing I/O characteristics of the mass storage
  570. ** device that holds the file that the [sqlite3_io_methods]
  571. ** refers to.
  572. **
  573. ** The SQLITE_IOCAP_ATOMIC property means that all writes of
  574. ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
  575. ** mean that writes of blocks that are nnn bytes in size and
  576. ** are aligned to an address which is an integer multiple of
  577. ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
  578. ** that when data is appended to a file, the data is appended
  579. ** first then the size of the file is extended, never the other
  580. ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
  581. ** information is written to disk in the same order as calls
  582. ** to xWrite().
  583. */
  584. //#define SQLITE_IOCAP_ATOMIC 0x00000001
  585. //#define SQLITE_IOCAP_ATOMIC512 0x00000002
  586. //#define SQLITE_IOCAP_ATOMIC1K 0x00000004
  587. //#define SQLITE_IOCAP_ATOMIC2K 0x00000008
  588. //#define SQLITE_IOCAP_ATOMIC4K 0x00000010
  589. //#define SQLITE_IOCAP_ATOMIC8K 0x00000020
  590. //#define SQLITE_IOCAP_ATOMIC16K 0x00000040
  591. //#define SQLITE_IOCAP_ATOMIC32K 0x00000080
  592. //#define SQLITE_IOCAP_ATOMIC64K 0x00000100
  593. //#define SQLITE_IOCAP_SAFE_APPEND 0x00000200
  594. //#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
  595. //#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
  596. const int SQLITE_IOCAP_ATOMIC = 0x00000001;
  597. const int SQLITE_IOCAP_ATOMIC512 = 0x00000002;
  598. const int SQLITE_IOCAP_ATOMIC1K = 0x00000004;
  599. const int SQLITE_IOCAP_ATOMIC2K = 0x00000008;
  600. const int SQLITE_IOCAP_ATOMIC4K = 0x00000010;
  601. const int SQLITE_IOCAP_ATOMIC8K = 0x00000020;
  602. const int SQLITE_IOCAP_ATOMIC16K = 0x00000040;
  603. const int SQLITE_IOCAP_ATOMIC32K = 0x00000080;
  604. const int SQLITE_IOCAP_ATOMIC64K = 0x00000100;
  605. const int SQLITE_IOCAP_SAFE_APPEND = 0x00000200;
  606. const int SQLITE_IOCAP_SEQUENTIAL = 0x00000400;
  607. const int SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN = 0x00000800;
  608. /*
  609. ** CAPI3REF: File Locking Levels
  610. **
  611. ** SQLite uses one of these integer values as the second
  612. ** argument to calls it makes to the xLock() and xUnlock() methods
  613. ** of an [sqlite3_io_methods] object.
  614. */
  615. //#define SQLITE_LOCK_NONE 0
  616. //#define SQLITE_LOCK_SHARED 1
  617. //#define SQLITE_LOCK_RESERVED 2
  618. //#define SQLITE_LOCK_PENDING 3
  619. //#define SQLITE_LOCK_EXCLUSIVE 4
  620. const int SQLITE_LOCK_NONE = 0;
  621. const int SQLITE_LOCK_SHARED = 1;
  622. const int SQLITE_LOCK_RESERVED = 2;
  623. const int SQLITE_LOCK_PENDING = 3;
  624. const int SQLITE_LOCK_EXCLUSIVE = 4;
  625. /*
  626. ** CAPI3REF: Synchronization Type Flags
  627. **
  628. ** When SQLite invokes the xSync() method of an
  629. ** [sqlite3_io_methods] object it uses a combination of
  630. ** these integer values as the second argument.
  631. **
  632. ** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
  633. ** sync operation only needs to flush data to mass storage. Inode
  634. ** information need not be flushed. If the lower four bits of the flag
  635. ** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
  636. ** If the lower four bits equal SQLITE_SYNC_FULL, that means
  637. ** to use Mac OS X style fullsync instead of fsync().
  638. **
  639. ** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
  640. ** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
  641. ** settings. The [synchronous pragma] determines when calls to the
  642. ** xSync VFS method occur and applies uniformly across all platforms.
  643. ** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
  644. ** energetic or rigorous or forceful the sync operations are and
  645. ** only make a difference on Mac OSX for the default SQLite code.
  646. ** (Third-party VFS implementations might also make the distinction
  647. ** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
  648. ** operating systems natively supported by SQLite, only Mac OSX
  649. ** cares about the difference.)
  650. */
  651. //#define SQLITE_SYNC_NORMAL 0x00002
  652. //#define SQLITE_SYNC_FULL 0x00003
  653. //#define SQLITE_SYNC_DATAONLY 0x00010
  654. const int SQLITE_SYNC_NORMAL = 0x00002;
  655. const int SQLITE_SYNC_FULL = 0x00003;
  656. const int SQLITE_SYNC_DATAONLY = 0x00010;
  657. /*
  658. ** CAPI3REF: OS Interface Open File Handle
  659. **
  660. ** An [sqlite3_file] object represents an open file in the
  661. ** [sqlite3_vfs | OS interface layer]. Individual OS interface
  662. ** implementations will
  663. ** want to subclass this object by appending additional fields
  664. ** for their own use. The pMethods entry is a pointer to an
  665. ** [sqlite3_io_methods] object that defines methods for performing
  666. ** I/O operations on the open file.
  667. */
  668. //typedef struct sqlite3_file sqlite3_file;
  669. //struct sqlite3_file {
  670. // const struct sqlite3_io_methods *pMethods; /* Methods for an open file */
  671. //};
  672. public partial class sqlite3_file
  673. {
  674. public sqlite3_io_methods pMethods;/* Must be first */
  675. }
  676. /*
  677. ** CAPI3REF: OS Interface File Virtual Methods Object
  678. **
  679. ** Every file opened by the [sqlite3_vfs.xOpen] method populates an
  680. ** [sqlite3_file] object (or, more commonly, a subclass of the
  681. ** [sqlite3_file] object) with a pointer to an instance of this object.
  682. ** This object defines the methods used to perform various operations
  683. ** against the open file represented by the [sqlite3_file] object.
  684. **
  685. ** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element
  686. ** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
  687. ** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The
  688. ** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]
  689. ** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element
  690. ** to NULL.
  691. **
  692. ** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
  693. ** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
  694. ** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
  695. ** flag may be ORed in to indicate that only the data of the file
  696. ** and not its inode needs to be synced.
  697. **
  698. ** The integer values to xLock() and xUnlock() are one of
  699. ** <ul>
  700. ** <li> [SQLITE_LOCK_NONE],
  701. ** <li> [SQLITE_LOCK_SHARED],
  702. ** <li> [SQLITE_LOCK_RESERVED],
  703. ** <li> [SQLITE_LOCK_PENDING], or
  704. ** <li> [SQLITE_LOCK_EXCLUSIVE].
  705. ** </ul>
  706. ** xLock() increases the lock. xUnlock() decreases the lock.
  707. ** The xCheckReservedLock() method checks whether any database connection,
  708. ** either in this process or in some other process, is holding a RESERVED,
  709. ** PENDING, or EXCLUSIVE lock on the file. It returns true
  710. ** if such a lock exists and false otherwise.
  711. **
  712. ** The xFileControl() method is a generic interface that allows custom
  713. ** VFS implementations to directly control an open file using the
  714. ** [sqlite3_file_control()] interface. The second "op" argument is an
  715. ** integer opcode. The third argument is a generic pointer intended to
  716. ** point to a structure that may contain arguments or space in which to
  717. ** write return values. Potential uses for xFileControl() might be
  718. ** functions to enable blocking locks with timeouts, to change the
  719. ** locking strategy (for example to use dot-file locks), to inquire
  720. ** about the status of a lock, or to break stale locks. The SQLite
  721. ** core reserves all opcodes less than 100 for its own use.
  722. ** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
  723. ** Applications that define a custom xFileControl method should use opcodes
  724. ** greater than 100 to avoid conflicts. VFS implementations should
  725. ** return [SQLITE_NOTFOUND] for file control opcodes that they do not
  726. ** recognize.
  727. **
  728. ** The xSectorSize() method returns the sector size of the
  729. ** device that underlies the file. The sector size is the
  730. ** minimum write that can be performed without disturbing
  731. ** other bytes in the file. The xDeviceCharacteristics()
  732. ** method returns a bit vector describing behaviors of the
  733. ** underlying device:
  734. **
  735. ** <ul>
  736. ** <li> [SQLITE_IOCAP_ATOMIC]
  737. ** <li> [SQLITE_IOCAP_ATOMIC512]
  738. ** <li> [SQLITE_IOCAP_ATOMIC1K]
  739. ** <li> [SQLITE_IOCAP_ATOMIC2K]
  740. ** <li> [SQLITE_IOCAP_ATOMIC4K]
  741. ** <li> [SQLITE_IOCAP_ATOMIC8K]
  742. ** <li> [SQLITE_IOCAP_ATOMIC16K]
  743. ** <li> [SQLITE_IOCAP_ATOMIC32K]
  744. ** <li> [SQLITE_IOCAP_ATOMIC64K]
  745. ** <li> [SQLITE_IOCAP_SAFE_APPEND]
  746. ** <li> [SQLITE_IOCAP_SEQUENTIAL]
  747. ** </ul>
  748. **
  749. ** The SQLITE_IOCAP_ATOMIC property means that all writes of
  750. ** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
  751. ** mean that writes of blocks that are nnn bytes in size and
  752. ** are aligned to an address which is an integer multiple of
  753. ** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
  754. ** that when data is appended to a file, the data is appended
  755. ** first then the size of the file is extended, never the other
  756. ** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
  757. ** information is written to disk in the same order as calls
  758. ** to xWrite().
  759. **
  760. ** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
  761. ** in the unread portions of the buffer with zeros. A VFS that
  762. ** fails to zero-fill short reads might seem to work. However,
  763. ** failure to zero-fill short reads will eventually lead to
  764. ** database corruption.
  765. */
  766. //typedef struct sqlite3_io_methods sqlite3_io_methods;
  767. //struct sqlite3_io_methods {
  768. // int iVersion;
  769. // int (*xClose)(sqlite3_file);
  770. // int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
  771. // int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
  772. // int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);
  773. // int (*xSync)(sqlite3_file*, int flags);
  774. // int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
  775. // int (*xLock)(sqlite3_file*, int);
  776. // int (*xUnlock)(sqlite3_file*, int);
  777. // int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);
  778. // int (*xFileControl)(sqlite3_file*, int op, object *pArg);
  779. // int (*xSectorSize)(sqlite3_file);
  780. // int (*xDeviceCharacteristics)(sqlite3_file);
  781. // /* Methods above are valid for version 1 */
  782. // int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, object volatile*);
  783. // int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
  784. // void (*xShmBarrier)(sqlite3_file);
  785. // int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
  786. // /* Methods above are valid for version 2 */
  787. // /* Additional methods may be added in future releases */
  788. //};
  789. public class sqlite3_io_methods
  790. {
  791. public int iVersion;
  792. public dxClose xClose;
  793. public dxRead xRead;
  794. public dxWrite xWrite;
  795. public dxTruncate xTruncate;
  796. public dxSync xSync;
  797. public dxFileSize xFileSize;
  798. public dxLock xLock;
  799. public dxUnlock xUnlock;
  800. public dxCheckReservedLock xCheckReservedLock;
  801. public dxFileControl xFileControl;
  802. public dxSectorSize xSectorSize;
  803. public dxDeviceCharacteristics xDeviceCharacteristics;
  804. public dxShmMap xShmMap;//int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, object volatile*);
  805. public dxShmLock xShmLock;//int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
  806. public dxShmBarrier xShmBarrier;//void (*xShmBarrier)(sqlite3_file);
  807. public dxShmUnmap xShmUnmap;//int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
  808. /* Additional methods may be added in future releases */
  809. public sqlite3_io_methods( int iVersion,
  810. dxClose xClose,
  811. dxRead xRead,
  812. dxWrite xWrite,
  813. dxTruncate xTruncate,
  814. dxSync xSync,
  815. dxFileSize xFileSize,
  816. dxLock xLock,
  817. dxUnlock xUnlock,
  818. dxCheckReservedLock xCheckReservedLock,
  819. dxFileControl xFileControl,
  820. dxSectorSize xSectorSize,
  821. dxDeviceCharacteristics xDeviceCharacteristics,
  822. dxShmMap xShmMap,
  823. dxShmLock xShmLock,
  824. dxShmBarrier xShmBarrier,
  825. dxShmUnmap xShmUnmap
  826. )
  827. {
  828. this.iVersion = iVersion;
  829. this.xClose = xClose;
  830. this.xRead = xRead;
  831. this.xWrite = xWrite;
  832. this.xTruncate = xTruncate;
  833. this.xSync = xSync;
  834. this.xFileSize = xFileSize;
  835. this.xLock = xLock;
  836. this.xUnlock = xUnlock;
  837. this.xCheckReservedLock = xCheckReservedLock;
  838. this.xFileControl = xFileControl;
  839. this.xSectorSize = xSectorSize;
  840. this.xDeviceCharacteristics = xDeviceCharacteristics;
  841. this.xShmMap = xShmMap;
  842. this.xShmLock = xShmLock;
  843. this.xShmBarrier = xShmBarrier;
  844. this.xShmUnmap = xShmUnmap;
  845. }
  846. }
  847. /*
  848. ** CAPI3REF: Standard File Control Opcodes
  849. **
  850. ** These integer constants are opcodes for the xFileControl method
  851. ** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
  852. ** interface.
  853. **
  854. ** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
  855. ** opcode causes the xFileControl method to write the current state of
  856. ** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
  857. ** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
  858. ** into an integer that the pArg argument points to. This capability
  859. ** is used during testing and only needs to be supported when SQLITE_TEST
  860. ** is defined.
  861. **
  862. ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
  863. ** layer a hint of how large the database file will grow to be during the
  864. ** current transaction. This hint is not guaranteed to be accurate but it
  865. ** is often close. The underlying VFS might choose to preallocate database
  866. ** file space based on this hint in order to help writes to the database
  867. ** file run faster.
  868. **
  869. ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
  870. ** extends and truncates the database file in chunks of a size specified
  871. ** by the user. The fourth argument to [sqlite3_file_control()] should
  872. ** point to an integer (type int) containing the new chunk-size to use
  873. ** for the nominated database. Allocating database file space in large
  874. ** chunks (say 1MB at a time), may reduce file-system fragmentation and
  875. ** improve performance on some systems.
  876. **
  877. ** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
  878. ** to the [sqlite3_file] object associated with a particular database
  879. ** connection. See the [sqlite3_file_control()] documentation for
  880. ** additional information.
  881. **
  882. ** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by
  883. ** SQLite and sent to all VFSes in place of a call to the xSync method
  884. ** when the database connection has [PRAGMA synchronous] set to OFF.)^
  885. ** Some specialized VFSes need this signal in order to operate correctly
  886. ** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most
  887. ** VFSes do not need this signal and should silently ignore this opcode.
  888. ** Applications should not call [sqlite3_file_control()] with this
  889. ** opcode as doing so may disrupt the operation of the specialized VFSes
  890. ** that do require it.
  891. */
  892. //#define SQLITE_FCNTL_LOCKSTATE 1
  893. //#define SQLITE_GET_LOCKPROXYFILE 2
  894. //#define SQLITE_SET_LOCKPROXYFILE 3
  895. //#define SQLITE_LAST_ERRNO 4
  896. //#define SQLITE_FCNTL_SIZE_HINT 5
  897. //#define SQLITE_FCNTL_CHUNK_SIZE 6
  898. //#define SQLITE_FCNTL_FILE_POINTER 7
  899. //#define SQLITE_FCNTL_SYNC_OMITTED 8
  900. const int SQLITE_FCNTL_LOCKSTATE = 1;
  901. const int SQLITE_GET_LOCKPROXYFILE = 2;
  902. const int SQLITE_SET_LOCKPROXYFILE = 3;
  903. const int SQLITE_LAST_ERRNO = 4;
  904. const int SQLITE_FCNTL_SIZE_HINT = 5;
  905. const int SQLITE_FCNTL_CHUNK_SIZE = 6;
  906. const int SQLITE_FCNTL_FILE_POINTER = 7;
  907. const int SQLITE_FCNTL_SYNC_OMITTED = 8;
  908. /*
  909. ** CAPI3REF: Mutex Handle
  910. **
  911. ** The mutex module within SQLite defines [sqlite3_mutex] to be an
  912. ** abstract type for a mutex object. The SQLite core never looks
  913. ** at the internal representation of an [sqlite3_mutex]. It only
  914. ** deals with pointers to the [sqlite3_mutex] object.
  915. **
  916. ** Mutexes are created using [sqlite3_mutex_alloc()].
  917. */
  918. //typedef struct sqlite3_mutex sqlite3_mutex;
  919. /*
  920. ** CAPI3REF: OS Interface Object
  921. **
  922. ** An instance of the sqlite3_vfs object defines the interface between
  923. ** the SQLite core and the underlying operating system. The "vfs"
  924. ** in the name of the object stands for "virtual file system". See
  925. ** the [VFS | VFS documentation] for further information.
  926. **
  927. ** The value of the iVersion field is initially 1 but may be larger in
  928. ** future versions of SQLite. Additional fields may be appended to this
  929. ** object when the iVersion value is increased. Note that the structure
  930. ** of the sqlite3_vfs object changes in the transaction between
  931. ** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not
  932. ** modified.
  933. **
  934. ** The szOsFile field is the size of the subclassed [sqlite3_file]
  935. ** structure used by this VFS. mxPathname is the maximum length of
  936. ** a pathname in this VFS.
  937. **
  938. ** Registered sqlite3_vfs objects are kept on a linked list formed by
  939. ** the pNext pointer. The [sqlite3_vfs_register()]
  940. ** and [sqlite3_vfs_unregister()] interfaces manage this list
  941. ** in a thread-safe way. The [sqlite3_vfs_find()] interface
  942. ** searches the list. Neither the application code nor the VFS
  943. ** implementation should use the pNext pointer.
  944. **
  945. ** The pNext field is the only field in the sqlite3_vfs
  946. ** structure that SQLite will ever modify. SQLite will only access
  947. ** or modify this field while holding a particular static mutex.
  948. ** The application should never modify anything within the sqlite3_vfs
  949. ** object once the object has been registered.
  950. **
  951. ** The zName field holds the name of the VFS module. The name must
  952. ** be unique across all VFS modules.
  953. **
  954. ** [[sqlite3_vfs.xOpen]
  955. ** ^SQLite guarantees that the zFilename parameter to xOpen
  956. ** is either a NULL pointer or string obtained
  957. ** from xFullPathname() with an optional suffix added.
  958. ** ^If a suffix is added to the zFilename parameter, it will
  959. ** consist of a single "-" character followed by no more than
  960. ** 10 alphanumeric and/or "-" characters.
  961. ** ^SQLite further guarantees that
  962. ** the string will be valid and unchanged until xClose() is
  963. ** called. Because of the previous sentence,
  964. ** the [sqlite3_file] can safely store a pointer to the
  965. ** filename if it needs to remember the filename for some reason.
  966. ** If the zFilename parameter to xOpen is a NULL pointer then xOpen
  967. ** must invent its own temporary name for the file. ^Whenever the
  968. ** xFilename parameter is NULL it will also be the case that the
  969. ** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
  970. **
  971. ** The flags argument to xOpen() includes all bits set in
  972. ** the flags argument to [sqlite3_open_v2()]. Or …

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