0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a /***************
0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 0d 0a 20 2a 20 41 44 *********.. * AD
0040: 4f 2e 4e 45 54 20 32 2e 30 20 44 61 74 61 20 50 O.NET 2.0 Data P
0050: 72 6f 76 69 64 65 72 20 66 6f 72 20 53 51 4c 69 rovider for SQLi
0060: 74 65 20 56 65 72 73 69 6f 6e 20 33 2e 58 0d 0a te Version 3.X..
0070: 20 2a 20 57 72 69 74 74 65 6e 20 62 79 20 52 6f * Written by Ro
0080: 62 65 72 74 20 53 69 6d 70 73 6f 6e 20 28 72 6f bert Simpson (ro
0090: 62 65 72 74 40 62 6c 61 63 6b 63 61 73 74 6c 65 bert@blackcastle
00a0: 73 6f 66 74 2e 63 6f 6d 29 0d 0a 20 2a 0d 0a 20 soft.com).. *..
00b0: 2a 20 52 65 6c 65 61 73 65 64 20 74 6f 20 74 68 * Released to th
00c0: 65 20 70 75 62 6c 69 63 20 64 6f 6d 61 69 6e 2c e public domain,
00d0: 20 75 73 65 20 61 74 20 79 6f 75 72 20 6f 77 6e use at your own
00e0: 20 72 69 73 6b 21 0d 0a 20 2a 2a 2a 2a 2a 2a 2a risk!.. *******
00f0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0100: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0110: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0120: 2a 2f 0d 0a 0d 0a 6e 61 6d 65 73 70 61 63 65 20 */....namespace
0130: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
0140: 74 65 0d 0a 7b 0d 0a 20 20 75 73 69 6e 67 20 53 te..{.. using S
0150: 79 73 74 65 6d 3b 0d 0a 20 20 75 73 69 6e 67 20 ystem;.. using
0160: 53 79 73 74 65 6d 2e 47 6c 6f 62 61 6c 69 7a 61 System.Globaliza
0170: 74 69 6f 6e 3b 0d 0a 0d 0a 23 69 66 20 21 4e 45 tion;....#if !NE
0180: 54 5f 43 4f 4d 50 41 43 54 5f 32 30 20 26 26 20 T_COMPACT_20 &&
0190: 28 54 52 41 43 45 5f 44 45 54 45 43 54 49 4f 4e (TRACE_DETECTION
01a0: 20 7c 7c 20 54 52 41 43 45 5f 53 48 41 52 45 44 || TRACE_SHARED
01b0: 20 7c 7c 20 54 52 41 43 45 5f 50 52 45 4c 4f 41 || TRACE_PRELOA
01c0: 44 20 7c 7c 20 54 52 41 43 45 5f 48 41 4e 44 4c D || TRACE_HANDL
01d0: 45 29 0d 0a 20 20 75 73 69 6e 67 20 53 79 73 74 E).. using Syst
01e0: 65 6d 2e 44 69 61 67 6e 6f 73 74 69 63 73 3b 0d em.Diagnostics;.
01f0: 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 75 73 69 .#endif.... usi
0200: 6e 67 20 53 79 73 74 65 6d 2e 43 6f 6c 6c 65 63 ng System.Collec
0210: 74 69 6f 6e 73 2e 47 65 6e 65 72 69 63 3b 0d 0a tions.Generic;..
0220: 20 20 75 73 69 6e 67 20 53 79 73 74 65 6d 2e 49 using System.I
0230: 4f 3b 0d 0a 20 20 75 73 69 6e 67 20 53 79 73 74 O;.. using Syst
0240: 65 6d 2e 52 65 66 6c 65 63 74 69 6f 6e 3b 0d 0a em.Reflection;..
0250: 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
0260: 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
0270: 20 26 26 20 21 44 45 42 55 47 0d 0a 20 20 75 73 && !DEBUG.. us
0280: 69 6e 67 20 53 79 73 74 65 6d 2e 53 65 63 75 72 ing System.Secur
0290: 69 74 79 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a ity;..#endif....
02a0: 20 20 75 73 69 6e 67 20 53 79 73 74 65 6d 2e 52 using System.R
02b0: 75 6e 74 69 6d 65 2e 49 6e 74 65 72 6f 70 53 65 untime.InteropSe
02c0: 72 76 69 63 65 73 3b 0d 0a 0d 0a 23 69 66 20 21 rvices;....#if !
02d0: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
02e0: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 75 73 69 FRAMEWORK.. usi
02f0: 6e 67 20 53 79 73 74 65 6d 2e 54 65 78 74 3b 0d ng System.Text;.
0300: 0a 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 .#endif....#if !
0310: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
0320: 46 52 41 4d 45 57 4f 52 4b 20 7c 7c 20 43 4f 55 FRAMEWORK || COU
0330: 4e 54 5f 48 41 4e 44 4c 45 0d 0a 20 20 75 73 69 NT_HANDLE.. usi
0340: 6e 67 20 53 79 73 74 65 6d 2e 54 68 72 65 61 64 ng System.Thread
0350: 69 6e 67 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a ing;..#endif....
0360: 20 20 75 73 69 6e 67 20 53 79 73 74 65 6d 2e 58 using System.X
0370: 6d 6c 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 ml;....#if !PLAT
0380: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
0390: 45 57 4f 52 4b 20 26 26 20 21 44 45 42 55 47 0d EWORK && !DEBUG.
03a0: 0a 20 20 5b 53 75 70 70 72 65 73 73 55 6e 6d 61 . [SuppressUnma
03b0: 6e 61 67 65 64 43 6f 64 65 53 65 63 75 72 69 74 nagedCodeSecurit
03c0: 79 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 69 6e y]..#endif.. in
03d0: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 63 6c ternal static cl
03e0: 61 73 73 20 55 6e 73 61 66 65 4e 61 74 69 76 65 ass UnsafeNative
03f0: 4d 65 74 68 6f 64 73 0d 0a 20 20 7b 0d 0a 20 20 Methods.. {..
0400: 20 20 20 20 23 72 65 67 69 6f 6e 20 43 72 69 74 #region Crit
0410: 69 63 61 6c 20 48 61 6e 64 6c 65 20 43 6f 75 6e ical Handle Coun
0420: 74 73 20 28 44 65 62 75 67 20 42 75 69 6c 64 20 ts (Debug Build
0430: 4f 6e 6c 79 29 0d 0a 23 69 66 20 43 4f 55 4e 54 Only)..#if COUNT
0440: 5f 48 41 4e 44 4c 45 0d 0a 20 20 20 20 20 20 2f _HANDLE.. /
0450: 2f 0d 0a 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 /.. // NOTE
0460: 3a 20 54 68 65 73 65 20 63 6f 75 6e 74 73 20 72 : These counts r
0470: 65 70 72 65 73 65 6e 74 20 74 68 65 20 74 6f 74 epresent the tot
0480: 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 6f 75 74 al number of out
0490: 73 74 61 6e 64 69 6e 67 0d 0a 20 20 20 20 20 20 standing..
04a0: 2f 2f 20 20 20 20 20 20 20 28 6e 6f 6e 2d 64 69 // (non-di
04b0: 73 70 6f 73 65 64 29 20 43 72 69 74 69 63 61 6c sposed) Critical
04c0: 48 61 6e 64 6c 65 20 64 65 72 69 76 65 64 20 6f Handle derived o
04d0: 62 6a 65 63 74 20 69 6e 73 74 61 6e 63 65 73 0d bject instances.
04e0: 0a 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 . //
04f0: 63 72 65 61 74 65 64 20 62 79 20 74 68 69 73 20 created by this
0500: 6c 69 62 72 61 72 79 20 61 6e 64 20 61 72 65 20 library and are
0510: 70 72 69 6d 61 72 69 6c 79 20 66 6f 72 20 75 73 primarily for us
0520: 65 20 62 79 0d 0a 20 20 20 20 20 20 2f 2f 20 20 e by.. //
0530: 20 20 20 20 20 74 68 65 20 74 65 73 74 20 73 75 the test su
0540: 69 74 65 2e 20 20 54 68 65 73 65 20 63 6f 75 6e ite. These coun
0550: 74 73 20 61 72 65 20 69 6e 63 72 65 6d 65 6e 74 ts are increment
0560: 65 64 20 62 79 20 74 68 65 0d 0a 20 20 20 20 20 ed by the..
0570: 20 2f 2f 20 20 20 20 20 20 20 61 73 73 6f 63 69 // associ
0580: 61 74 65 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 ated constructor
0590: 73 20 61 6e 64 20 61 72 65 20 64 65 63 72 65 6d s and are decrem
05a0: 65 6e 74 65 64 20 75 70 6f 6e 20 74 68 65 0d 0a ented upon the..
05b0: 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 73 // s
05c0: 75 63 63 65 73 73 66 75 6c 20 63 6f 6d 70 6c 65 uccessful comple
05d0: 74 69 6f 6e 20 6f 66 20 74 68 65 20 61 73 73 6f tion of the asso
05e0: 63 69 61 74 65 64 20 52 65 6c 65 61 73 65 48 61 ciated ReleaseHa
05f0: 6e 64 6c 65 0d 0a 20 20 20 20 20 20 2f 2f 20 20 ndle.. //
0600: 20 20 20 20 20 6d 65 74 68 6f 64 73 2e 0d 0a 20 methods...
0610: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 69 //.. i
0620: 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 69 nternal static i
0630: 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 43 6f 75 nt connectionCou
0640: 6e 74 3b 0d 0a 20 20 20 20 20 20 69 6e 74 65 72 nt;.. inter
0650: 6e 61 6c 20 73 74 61 74 69 63 20 69 6e 74 20 73 nal static int s
0660: 74 61 74 65 6d 65 6e 74 43 6f 75 6e 74 3b 0d 0a tatementCount;..
0670: 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 internal s
0680: 74 61 74 69 63 20 69 6e 74 20 62 61 63 6b 75 70 tatic int backup
0690: 43 6f 75 6e 74 3b 0d 0a 23 65 6e 64 69 66 0d 0a Count;..#endif..
06a0: 20 20 20 20 20 20 23 65 6e 64 72 65 67 69 6f 6e #endregion
06b0: 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f .... //////
06c0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
06d0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
06e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
06f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0700: 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 23 72 65 ///.... #re
0710: 67 69 6f 6e 20 53 68 61 72 65 64 20 4e 61 74 69 gion Shared Nati
0720: 76 65 20 53 51 4c 69 74 65 20 4c 69 62 72 61 72 ve SQLite Librar
0730: 79 20 50 72 65 2d 4c 6f 61 64 69 6e 67 20 43 6f y Pre-Loading Co
0740: 64 65 0d 0a 20 20 20 20 20 20 23 72 65 67 69 6f de.. #regio
0750: 6e 20 50 72 69 76 61 74 65 20 43 6f 6e 73 74 61 n Private Consta
0760: 6e 74 73 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c nts.. /// <
0770: 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 summary>..
0780: 2f 2f 2f 20 54 68 65 20 66 69 6c 65 20 65 78 74 /// The file ext
0790: 65 6e 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 ension used for
07a0: 64 79 6e 61 6d 69 63 20 6c 69 6e 6b 20 6c 69 62 dynamic link lib
07b0: 72 61 72 69 65 73 2e 0d 0a 20 20 20 20 20 20 2f raries... /
07c0: 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 // </summary>..
07d0: 20 20 20 20 20 70 72 69 76 61 74 65 20 73 74 61 private sta
07e0: 74 69 63 20 72 65 61 64 6f 6e 6c 79 20 73 74 72 tic readonly str
07f0: 69 6e 67 20 44 6c 6c 46 69 6c 65 45 78 74 65 6e ing DllFileExten
0800: 73 69 6f 6e 20 3d 20 22 2e 64 6c 6c 22 3b 0d 0a sion = ".dll";..
0810: 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f .. ////////
0820: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0830: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0840: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0850: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0860: 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 75 /.. /// <su
0870: 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f mmary>.. //
0880: 2f 20 54 68 65 20 66 69 6c 65 20 65 78 74 65 6e / The file exten
0890: 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 68 sion used for th
08a0: 65 20 58 4d 4c 20 63 6f 6e 66 69 67 75 72 61 74 e XML configurat
08b0: 69 6f 6e 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 ion file...
08c0: 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d /// </summary>.
08d0: 0a 20 20 20 20 20 20 70 72 69 76 61 74 65 20 73 . private s
08e0: 74 61 74 69 63 20 72 65 61 64 6f 6e 6c 79 20 73 tatic readonly s
08f0: 74 72 69 6e 67 20 43 6f 6e 66 69 67 46 69 6c 65 tring ConfigFile
0900: 45 78 74 65 6e 73 69 6f 6e 20 3d 20 22 2e 63 6f Extension = ".co
0910: 6e 66 69 67 22 3b 0d 0a 0d 0a 20 20 20 20 20 20 nfig";....
0920: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0930: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0940: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0950: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0960: 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 20 /////////..
0970: 20 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a /// <summary>..
0980: 20 20 20 20 20 20 2f 2f 2f 20 54 68 69 73 20 69 /// This i
0990: 73 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 s the name of th
09a0: 65 20 58 4d 4c 20 63 6f 6e 66 69 67 75 72 61 74 e XML configurat
09b0: 69 6f 6e 20 66 69 6c 65 20 73 70 65 63 69 66 69 ion file specifi
09c0: 63 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 20 20 c to the..
09d0: 2f 2f 2f 20 53 79 73 74 65 6d 2e 44 61 74 61 2e /// System.Data.
09e0: 53 51 4c 69 74 65 20 61 73 73 65 6d 62 6c 79 2e SQLite assembly.
09f0: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 .. /// </su
0a00: 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 70 72 mmary>.. pr
0a10: 69 76 61 74 65 20 73 74 61 74 69 63 20 72 65 61 ivate static rea
0a20: 64 6f 6e 6c 79 20 73 74 72 69 6e 67 20 58 6d 6c donly string Xml
0a30: 43 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 20 3d ConfigFileName =
0a40: 0d 0a 20 20 20 20 20 20 20 20 20 20 74 79 70 65 .. type
0a50: 6f 66 28 55 6e 73 61 66 65 4e 61 74 69 76 65 4d of(UnsafeNativeM
0a60: 65 74 68 6f 64 73 29 2e 4e 61 6d 65 73 70 61 63 ethods).Namespac
0a70: 65 20 2b 20 44 6c 6c 46 69 6c 65 45 78 74 65 6e e + DllFileExten
0a80: 73 69 6f 6e 20 2b 0d 0a 20 20 20 20 20 20 20 20 sion +..
0a90: 20 20 43 6f 6e 66 69 67 46 69 6c 65 45 78 74 65 ConfigFileExte
0aa0: 6e 73 69 6f 6e 3b 0d 0a 20 20 20 20 20 20 23 65 nsion;.. #e
0ab0: 6e 64 72 65 67 69 6f 6e 0d 0a 0d 0a 20 20 20 20 ndregion....
0ac0: 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f //////////////
0ad0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0ae0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0af0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0b00: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 ///////////....
0b10: 20 20 20 20 20 23 72 65 67 69 6f 6e 20 50 72 69 #region Pri
0b20: 76 61 74 65 20 44 61 74 61 0d 0a 20 20 20 20 20 vate Data..
0b30: 20 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a /// <summary>..
0b40: 20 20 20 20 20 20 2f 2f 2f 20 54 68 69 73 20 6c /// This l
0b50: 6f 63 6b 20 69 73 20 75 73 65 64 20 74 6f 20 70 ock is used to p
0b60: 72 6f 74 65 63 74 20 74 68 65 20 73 74 61 74 69 rotect the stati
0b70: 63 20 5f 53 51 4c 69 74 65 4e 61 74 69 76 65 4d c _SQLiteNativeM
0b80: 6f 64 75 6c 65 46 69 6c 65 4e 61 6d 65 2c 0d 0a oduleFileName,..
0b90: 20 20 20 20 20 20 2f 2f 2f 20 5f 53 51 4c 69 74 /// _SQLit
0ba0: 65 4e 61 74 69 76 65 4d 6f 64 75 6c 65 48 61 6e eNativeModuleHan
0bb0: 64 6c 65 2c 20 61 6e 64 20 70 72 6f 63 65 73 73 dle, and process
0bc0: 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 50 6c orArchitecturePl
0bd0: 61 74 66 6f 72 6d 73 20 66 69 65 6c 64 73 2e 0d atforms fields..
0be0: 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d . /// </sum
0bf0: 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 70 72 69 mary>.. pri
0c00: 76 61 74 65 20 73 74 61 74 69 63 20 72 65 61 64 vate static read
0c10: 6f 6e 6c 79 20 6f 62 6a 65 63 74 20 73 74 61 74 only object stat
0c20: 69 63 53 79 6e 63 52 6f 6f 74 20 3d 20 6e 65 77 icSyncRoot = new
0c30: 20 6f 62 6a 65 63 74 28 29 3b 0d 0a 0d 0a 23 69 object();....#i
0c40: 66 20 44 45 42 55 47 0d 0a 20 20 20 20 20 20 2f f DEBUG.. /
0c50: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0c60: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0c70: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0c80: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0c90: 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 20 20 ////////..
0ca0: 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 /// <summary>..
0cb0: 20 20 20 20 20 2f 2f 2f 20 54 68 69 73 20 64 69 /// This di
0cc0: 63 74 69 6f 6e 61 72 79 20 73 74 6f 72 65 73 20 ctionary stores
0cd0: 74 68 65 20 72 65 61 64 20 63 6f 75 6e 74 73 20 the read counts
0ce0: 66 6f 72 20 74 68 65 20 72 75 6e 74 69 6d 65 20 for the runtime
0cf0: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0d 0a 20 configuration..
0d00: 20 20 20 20 20 2f 2f 2f 20 73 65 74 74 69 6e 67 /// setting
0d10: 73 2e 20 20 54 68 69 73 20 69 6e 66 6f 72 6d 61 s. This informa
0d20: 74 69 6f 6e 20 69 73 20 6f 6e 6c 79 20 72 65 63 tion is only rec
0d30: 6f 72 64 65 64 20 77 68 65 6e 20 63 6f 6d 70 69 orded when compi
0d40: 6c 65 64 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 led in the..
0d50: 20 20 2f 2f 2f 20 22 44 65 62 75 67 22 20 62 75 /// "Debug" bu
0d60: 69 6c 64 20 63 6f 6e 66 69 67 75 72 61 74 69 6f ild configuratio
0d70: 6e 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f n... /// </
0d80: 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 summary>..
0d90: 70 72 69 76 61 74 65 20 73 74 61 74 69 63 20 44 private static D
0da0: 69 63 74 69 6f 6e 61 72 79 3c 73 74 72 69 6e 67 ictionary<string
0db0: 2c 20 69 6e 74 3e 20 73 65 74 74 69 6e 67 52 65 , int> settingRe
0dc0: 61 64 43 6f 75 6e 74 73 3b 0d 0a 23 65 6e 64 69 adCounts;..#endi
0dd0: 66 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f f.... /////
0de0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0df0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0e00: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0e10: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0e20: 2f 2f 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ////.. ///
0e30: 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 <summary>..
0e40: 20 2f 2f 2f 20 54 68 69 73 20 64 69 63 74 69 6f /// This dictio
0e50: 6e 61 72 79 20 73 74 6f 72 65 73 20 74 68 65 20 nary stores the
0e60: 6d 61 70 70 69 6e 67 73 20 62 65 74 77 65 65 6e mappings between
0e70: 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 processor archi
0e80: 74 65 63 74 75 72 65 0d 0a 20 20 20 20 20 20 2f tecture.. /
0e90: 2f 2f 20 6e 61 6d 65 73 20 61 6e 64 20 70 6c 61 // names and pla
0ea0: 74 66 6f 72 6d 20 6e 61 6d 65 73 2e 20 20 54 68 tform names. Th
0eb0: 65 73 65 20 6d 61 70 70 69 6e 67 73 20 61 72 65 ese mappings are
0ec0: 20 6e 6f 77 20 75 73 65 64 20 66 6f 72 20 74 77 now used for tw
0ed0: 6f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 70 75 72 o.. /// pur
0ee0: 70 6f 73 65 73 2e 20 20 46 69 72 73 74 2c 20 74 poses. First, t
0ef0: 68 65 79 20 61 72 65 20 75 73 65 64 20 74 6f 20 hey are used to
0f00: 64 65 74 65 72 6d 69 6e 65 20 69 66 20 74 68 65 determine if the
0f10: 20 61 73 73 65 6d 62 6c 79 20 63 6f 64 65 0d 0a assembly code..
0f20: 20 20 20 20 20 20 2f 2f 2f 20 62 61 73 65 20 73 /// base s
0f30: 68 6f 75 6c 64 20 62 65 20 75 73 65 64 20 69 6e hould be used in
0f40: 73 74 65 61 64 20 6f 66 20 74 68 65 20 6c 6f 63 stead of the loc
0f50: 61 74 69 6f 6e 2c 20 62 61 73 65 64 20 75 70 6f ation, based upo
0f60: 6e 20 77 68 65 74 68 65 72 20 6f 6e 65 0d 0a 20 n whether one..
0f70: 20 20 20 20 20 2f 2f 2f 20 6f 72 20 6d 6f 72 65 /// or more
0f80: 20 6f 66 20 74 68 65 20 6e 61 6d 65 64 20 73 75 of the named su
0f90: 62 2d 64 69 72 65 63 74 6f 72 69 65 73 20 65 78 b-directories ex
0fa0: 69 73 74 20 77 69 74 68 69 6e 20 74 68 65 20 61 ist within the a
0fb0: 73 73 65 6d 62 6c 79 20 63 6f 64 65 0d 0a 20 20 ssembly code..
0fc0: 20 20 20 20 2f 2f 2f 20 62 61 73 65 2e 20 20 53 /// base. S
0fd0: 65 63 6f 6e 64 2c 20 74 68 65 79 20 61 72 65 20 econd, they are
0fe0: 75 73 65 64 20 74 6f 20 61 73 73 69 73 74 20 69 used to assist i
0ff0: 6e 20 6c 6f 61 64 69 6e 67 20 74 68 65 20 61 70 n loading the ap
1000: 70 72 6f 70 72 69 61 74 65 0d 0a 20 20 20 20 20 propriate..
1010: 20 2f 2f 2f 20 53 51 4c 69 74 65 20 69 6e 74 65 /// SQLite inte
1020: 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 69 6e 74 rop assembly int
1030: 6f 20 74 68 65 20 63 75 72 72 65 6e 74 20 70 72 o the current pr
1040: 6f 63 65 73 73 2e 0d 0a 20 20 20 20 20 20 2f 2f ocess... //
1050: 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 / </summary>..
1060: 20 20 20 20 70 72 69 76 61 74 65 20 73 74 61 74 private stat
1070: 69 63 20 44 69 63 74 69 6f 6e 61 72 79 3c 73 74 ic Dictionary<st
1080: 72 69 6e 67 2c 20 73 74 72 69 6e 67 3e 20 70 72 ring, string> pr
1090: 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 ocessorArchitect
10a0: 75 72 65 50 6c 61 74 66 6f 72 6d 73 3b 0d 0a 20 urePlatforms;..
10b0: 20 20 20 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d #endregion.
10c0: 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f ... ///////
10d0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
10e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
10f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1100: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1110: 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 //.. /// <s
1120: 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f ummary>.. /
1130: 2f 2f 20 46 6f 72 20 6e 6f 77 2c 20 74 68 69 73 // For now, this
1140: 20 6d 65 74 68 6f 64 20 73 69 6d 70 6c 79 20 63 method simply c
1150: 61 6c 6c 73 20 74 68 65 20 49 6e 69 74 69 61 6c alls the Initial
1160: 69 7a 65 20 6d 65 74 68 6f 64 2e 0d 0a 20 20 20 ize method...
1170: 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 /// </summary
1180: 3e 0d 0a 20 20 20 20 20 20 73 74 61 74 69 63 20 >.. static
1190: 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 UnsafeNativeMeth
11a0: 6f 64 73 28 29 0d 0a 20 20 20 20 20 20 7b 0d 0a ods().. {..
11b0: 20 20 20 20 20 20 20 20 20 20 49 6e 69 74 69 61 Initia
11c0: 6c 69 7a 65 28 29 3b 0d 0a 20 20 20 20 20 20 7d lize();.. }
11d0: 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f .... //////
11e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
11f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1200: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1210: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1220: 2f 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c ///.. /// <
1230: 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 summary>..
1240: 2f 2f 2f 20 41 74 74 65 6d 70 74 73 20 74 6f 20 /// Attempts to
1250: 69 6e 69 74 69 61 6c 69 7a 65 20 74 68 69 73 20 initialize this
1260: 63 6c 61 73 73 20 62 79 20 70 72 65 2d 6c 6f 61 class by pre-loa
1270: 64 69 6e 67 20 74 68 65 20 6e 61 74 69 76 65 20 ding the native
1280: 53 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 2f 2f SQLite.. //
1290: 2f 20 6c 69 62 72 61 72 79 20 66 6f 72 20 74 68 / library for th
12a0: 65 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 e processor arch
12b0: 69 74 65 63 74 75 72 65 20 6f 66 20 74 68 65 20 itecture of the
12c0: 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 2e current process.
12d0: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 .. /// </su
12e0: 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 69 6e mmary>.. in
12f0: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 76 6f ternal static vo
1300: 69 64 20 49 6e 69 74 69 61 6c 69 7a 65 28 29 0d id Initialize().
1310: 0a 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 53 51 . {..#if SQ
1320: 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 20 7c 7c LITE_STANDARD ||
1330: 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f 44 4c 4c USE_INTEROP_DLL
1340: 20 7c 7c 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d || PLATFORM_COM
1350: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 23 PACTFRAMEWORK..#
1360: 69 66 20 50 52 45 4c 4f 41 44 5f 4e 41 54 49 56 if PRELOAD_NATIV
1370: 45 5f 4c 49 42 52 41 52 59 0d 0a 20 20 20 20 20 E_LIBRARY..
1380: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 //..
1390: 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 20 74 // NOTE: If t
13a0: 68 65 20 22 4e 6f 5f 50 72 65 4c 6f 61 64 53 51 he "No_PreLoadSQ
13b0: 4c 69 74 65 22 20 65 6e 76 69 72 6f 6e 6d 65 6e Lite" environmen
13c0: 74 20 76 61 72 69 61 62 6c 65 20 69 73 20 73 65 t variable is se
13d0: 74 20 28 74 6f 0d 0a 20 20 20 20 20 20 20 20 20 t (to..
13e0: 20 2f 2f 20 20 20 20 20 20 20 61 6e 79 74 68 69 // anythi
13f0: 6e 67 29 2c 20 73 6b 69 70 20 61 6c 6c 20 6f 75 ng), skip all ou
1400: 72 20 73 70 65 63 69 61 6c 20 63 6f 64 65 20 61 r special code a
1410: 6e 64 20 73 69 6d 70 6c 79 20 72 65 74 75 72 6e nd simply return
1420: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d ... //.
1430: 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 28 47 . if (G
1440: 65 74 53 65 74 74 69 6e 67 56 61 6c 75 65 28 22 etSettingValue("
1450: 4e 6f 5f 50 72 65 4c 6f 61 64 53 51 4c 69 74 65 No_PreLoadSQLite
1460: 22 2c 20 6e 75 6c 6c 29 20 21 3d 20 6e 75 6c 6c ", null) != null
1470: 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 )..
1480: 20 72 65 74 75 72 6e 3b 0d 0a 23 65 6e 64 69 66 return;..#endif
1490: 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 ..#endif....
14a0: 20 20 20 20 20 20 6c 6f 63 6b 20 28 73 74 61 74 lock (stat
14b0: 69 63 53 79 6e 63 52 6f 6f 74 29 0d 0a 20 20 20 icSyncRoot)..
14c0: 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 44 45 {..#if DE
14d0: 42 55 47 0d 0a 20 20 20 20 20 20 20 20 20 20 20 BUG..
14e0: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
14f0: 20 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 43 72 // NOTE: Cr
1500: 65 61 74 65 20 74 68 65 20 6c 69 73 74 20 6f 66 eate the list of
1510: 20 73 74 61 74 69 73 74 69 63 73 20 74 68 61 74 statistics that
1520: 20 77 69 6c 6c 20 63 6f 6e 74 61 69 6e 20 74 68 will contain th
1530: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
1540: 20 2f 2f 20 20 20 20 20 20 20 6e 75 6d 62 65 72 // number
1550: 20 6f 66 20 74 69 6d 65 73 20 65 61 63 68 20 73 of times each s
1560: 65 74 74 69 6e 67 20 76 61 6c 75 65 20 68 61 73 etting value has
1570: 20 62 65 65 6e 20 72 65 61 64 2e 0d 0a 20 20 20 been read...
1580: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 //..
1590: 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
15a0: 28 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e (settingReadCoun
15b0: 74 73 20 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 ts == null)..
15c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 s
15d0: 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 73 ettingReadCounts
15e0: 20 3d 20 6e 65 77 20 44 69 63 74 69 6f 6e 61 72 = new Dictionar
15f0: 79 3c 73 74 72 69 6e 67 2c 20 69 6e 74 3e 28 29 y<string, int>()
1600: 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 ;..#endif....
1610: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 //..
1620: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 //
1630: 54 4f 44 4f 3a 20 4d 61 6b 65 20 73 75 72 65 20 TODO: Make sure
1640: 74 68 69 73 20 6c 69 73 74 20 69 73 20 75 70 64 this list is upd
1650: 61 74 65 64 20 69 66 20 74 68 65 20 73 75 70 70 ated if the supp
1660: 6f 72 74 65 64 0d 0a 20 20 20 20 20 20 20 20 20 orted..
1670: 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 70 72 // pr
1680: 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 63 ocessor architec
1690: 74 75 72 65 20 6e 61 6d 65 73 20 61 6e 64 2f 6f ture names and/o
16a0: 72 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d 65 73 r platform names
16b0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
16c0: 2f 2f 20 20 20 20 20 20 20 63 68 61 6e 67 65 73 // changes
16d0: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
16e0: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 //..
16f0: 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 6f 72 if (processor
1700: 41 72 63 68 69 74 65 63 74 75 72 65 50 6c 61 74 ArchitecturePlat
1710: 66 6f 72 6d 73 20 3d 3d 20 6e 75 6c 6c 29 0d 0a forms == null)..
1720: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d {.
1730: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1740: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
1750: 20 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 // NOTE
1760: 3a 20 43 72 65 61 74 65 20 74 68 65 20 6d 61 70 : Create the map
1770: 20 6f 66 20 70 72 6f 63 65 73 73 6f 72 20 61 72 of processor ar
1780: 63 68 69 74 65 63 74 75 72 65 20 6e 61 6d 65 73 chitecture names
1790: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
17a0: 20 20 20 20 2f 2f 20 20 20 20 20 20 20 74 6f 20 // to
17b0: 70 6c 61 74 66 6f 72 6d 20 6e 61 6d 65 73 20 75 platform names u
17c0: 73 69 6e 67 20 61 20 63 61 73 65 2d 69 6e 73 65 sing a case-inse
17d0: 6e 73 69 74 69 76 65 20 73 74 72 69 6e 67 0d 0a nsitive string..
17e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
17f0: 20 20 2f 2f 20 20 20 20 20 20 20 63 6f 6d 70 61 // compa
1800: 72 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 rer...
1810: 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 //..
1820: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 pr
1830: 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 ocessorArchitect
1840: 75 72 65 50 6c 61 74 66 6f 72 6d 73 20 3d 0d 0a urePlatforms =..
1850: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1860: 20 20 20 20 20 20 6e 65 77 20 44 69 63 74 69 6f new Dictio
1870: 6e 61 72 79 3c 73 74 72 69 6e 67 2c 20 73 74 72 nary<string, str
1880: 69 6e 67 3e 28 0d 0a 20 20 20 20 20 20 20 20 20 ing>(..
1890: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18a0: 20 53 74 72 69 6e 67 43 6f 6d 70 61 72 65 72 2e StringComparer.
18b0: 4f 72 64 69 6e 61 6c 49 67 6e 6f 72 65 43 61 73 OrdinalIgnoreCas
18c0: 65 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 e);....
18d0: 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 //..
18e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f /
18f0: 2f 20 4e 4f 54 45 3a 20 53 65 74 75 70 20 74 68 / NOTE: Setup th
1900: 65 20 6c 69 73 74 20 6f 66 20 70 6c 61 74 66 6f e list of platfo
1910: 72 6d 20 6e 61 6d 65 73 20 61 73 73 6f 63 69 61 rm names associa
1920: 74 65 64 20 77 69 74 68 0d 0a 20 20 20 20 20 20 ted with..
1930: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 //
1940: 20 20 20 20 20 74 68 65 20 73 75 70 70 6f 72 74 the support
1950: 65 64 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 ed processor arc
1960: 68 69 74 65 63 74 75 72 65 73 2e 0d 0a 20 20 20 hitectures...
1970: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f /
1980: 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 /..
1990: 20 20 20 20 20 70 72 6f 63 65 73 73 6f 72 41 72 processorAr
19a0: 63 68 69 74 65 63 74 75 72 65 50 6c 61 74 66 6f chitecturePlatfo
19b0: 72 6d 73 2e 41 64 64 28 22 78 38 36 22 2c 20 22 rms.Add("x86", "
19c0: 57 69 6e 33 32 22 29 3b 0d 0a 20 20 20 20 20 20 Win32");..
19d0: 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 proc
19e0: 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 essorArchitectur
19f0: 65 50 6c 61 74 66 6f 72 6d 73 2e 41 64 64 28 22 ePlatforms.Add("
1a00: 41 4d 44 36 34 22 2c 20 22 78 36 34 22 29 3b 0d AMD64", "x64");.
1a10: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1a20: 20 20 20 70 72 6f 63 65 73 73 6f 72 41 72 63 68 processorArch
1a30: 69 74 65 63 74 75 72 65 50 6c 61 74 66 6f 72 6d itecturePlatform
1a40: 73 2e 41 64 64 28 22 49 41 36 34 22 2c 20 22 49 s.Add("IA64", "I
1a50: 74 61 6e 69 75 6d 22 29 3b 0d 0a 20 20 20 20 20 tanium");..
1a60: 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f pro
1a70: 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 cessorArchitectu
1a80: 72 65 50 6c 61 74 66 6f 72 6d 73 2e 41 64 64 28 rePlatforms.Add(
1a90: 22 41 52 4d 22 2c 20 22 57 69 6e 43 45 22 29 3b "ARM", "WinCE");
1aa0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1ab0: 7d 0d 0a 0d 0a 23 69 66 20 53 51 4c 49 54 45 5f }....#if SQLITE_
1ac0: 53 54 41 4e 44 41 52 44 20 7c 7c 20 55 53 45 5f STANDARD || USE_
1ad0: 49 4e 54 45 52 4f 50 5f 44 4c 4c 20 7c 7c 20 50 INTEROP_DLL || P
1ae0: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
1af0: 52 41 4d 45 57 4f 52 4b 0d 0a 23 69 66 20 50 52 RAMEWORK..#if PR
1b00: 45 4c 4f 41 44 5f 4e 41 54 49 56 45 5f 4c 49 42 ELOAD_NATIVE_LIB
1b10: 52 41 52 59 0d 0a 20 20 20 20 20 20 20 20 20 20 RARY..
1b20: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 //..
1b30: 20 20 20 20 20 20 2f 2f 20 42 55 47 42 55 47 3a // BUGBUG:
1b40: 20 57 68 61 74 20 61 62 6f 75 74 20 6f 74 68 65 What about othe
1b50: 72 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f r application do
1b60: 6d 61 69 6e 73 3f 0d 0a 20 20 20 20 20 20 20 20 mains?..
1b70: 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 //..
1b80: 20 20 20 20 20 20 20 20 69 66 20 28 5f 53 51 4c if (_SQL
1b90: 69 74 65 4e 61 74 69 76 65 4d 6f 64 75 6c 65 48 iteNativeModuleH
1ba0: 61 6e 64 6c 65 20 3d 3d 20 49 6e 74 50 74 72 2e andle == IntPtr.
1bb0: 5a 65 72 6f 29 0d 0a 20 20 20 20 20 20 20 20 20 Zero)..
1bc0: 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
1bd0: 20 20 20 20 20 20 20 20 20 20 73 74 72 69 6e 67 string
1be0: 20 62 61 73 65 44 69 72 65 63 74 6f 72 79 20 3d baseDirectory =
1bf0: 20 6e 75 6c 6c 3b 0d 0a 20 20 20 20 20 20 20 20 null;..
1c00: 20 20 20 20 20 20 20 20 20 20 73 74 72 69 6e 67 string
1c10: 20 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 processorArchit
1c20: 65 63 74 75 72 65 20 3d 20 6e 75 6c 6c 3b 0d 0a ecture = null;..
1c30: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c40: 20 20 20 20 2f 2a 20 49 47 4e 4f 52 45 44 20 2a /* IGNORED *
1c50: 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 /..
1c60: 20 20 20 20 20 53 65 61 72 63 68 46 6f 72 44 69 SearchForDi
1c70: 72 65 63 74 6f 72 79 28 0d 0a 20 20 20 20 20 20 rectory(..
1c80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c90: 72 65 66 20 62 61 73 65 44 69 72 65 63 74 6f 72 ref baseDirector
1ca0: 79 2c 20 72 65 66 20 70 72 6f 63 65 73 73 6f 72 y, ref processor
1cb0: 41 72 63 68 69 74 65 63 74 75 72 65 29 3b 0d 0a Architecture);..
1cc0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1cd0: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 //..
1ce0: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 // NOT
1cf0: 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 70 72 E: Attempt to pr
1d00: 65 2d 6c 6f 61 64 20 74 68 65 20 53 51 4c 69 74 e-load the SQLit
1d10: 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 20 28 e core library (
1d20: 6f 72 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 or..
1d30: 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 69 // i
1d40: 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 29 nterop assembly)
1d50: 20 61 6e 64 20 73 74 6f 72 65 20 62 6f 74 68 20 and store both
1d60: 74 68 65 20 66 69 6c 65 20 6e 61 6d 65 0d 0a 20 the file name..
1d70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d80: 20 2f 2f 20 20 20 20 20 20 20 61 6e 64 20 6e 61 // and na
1d90: 74 69 76 65 20 6d 6f 64 75 6c 65 20 68 61 6e 64 tive module hand
1da0: 6c 65 20 66 6f 72 20 6c 61 74 65 72 20 75 73 61 le for later usa
1db0: 67 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ge...
1dc0: 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 //..
1dd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 /*
1de0: 49 47 4e 4f 52 45 44 20 2a 2f 0d 0a 20 20 20 20 IGNORED */..
1df0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 72 Pr
1e00: 65 4c 6f 61 64 53 51 4c 69 74 65 44 6c 6c 28 0d eLoadSQLiteDll(.
1e10: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1e20: 20 20 20 20 20 20 20 62 61 73 65 44 69 72 65 63 baseDirec
1e30: 74 6f 72 79 2c 20 70 72 6f 63 65 73 73 6f 72 41 tory, processorA
1e40: 72 63 68 69 74 65 63 74 75 72 65 2c 0d 0a 20 20 rchitecture,..
1e50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e60: 20 20 20 20 72 65 66 20 5f 53 51 4c 69 74 65 4e ref _SQLiteN
1e70: 61 74 69 76 65 4d 6f 64 75 6c 65 46 69 6c 65 4e ativeModuleFileN
1e80: 61 6d 65 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 ame,..
1e90: 20 20 20 20 20 20 20 20 20 20 20 20 72 65 66 20 ref
1ea0: 5f 53 51 4c 69 74 65 4e 61 74 69 76 65 4d 6f 64 _SQLiteNativeMod
1eb0: 75 6c 65 48 61 6e 64 6c 65 29 3b 0d 0a 20 20 20 uleHandle);..
1ec0: 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 23 65 }..#e
1ed0: 6e 64 69 66 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 ndif..#endif..
1ee0: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1ef0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f }.... ////
1f00: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1f10: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1f20: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1f30: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1f40: 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f /////.. ///
1f50: 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 <summary>..
1f60: 20 20 2f 2f 2f 20 51 75 65 72 69 65 73 20 61 6e /// Queries an
1f70: 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 58 4d d returns the XM
1f80: 4c 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 L configuration
1f90: 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 74 68 file name for th
1fa0: 65 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 e assembly..
1fb0: 20 20 2f 2f 2f 20 63 6f 6e 74 61 69 6e 69 6e 67 /// containing
1fc0: 20 74 68 65 20 6d 61 6e 61 67 65 64 20 53 79 73 the managed Sys
1fd0: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
1fe0: 63 6f 6d 70 6f 6e 65 6e 74 73 2e 0d 0a 20 20 20 components...
1ff0: 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 /// </summary
2000: 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 72 65 >.. /// <re
2010: 74 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 2f 2f turns>.. //
2020: 2f 20 54 68 65 20 58 4d 4c 20 63 6f 6e 66 69 67 / The XML config
2030: 75 72 61 74 69 6f 6e 20 66 69 6c 65 20 6e 61 6d uration file nam
2040: 65 20 2d 4f 52 2d 20 6e 75 6c 6c 20 69 66 20 69 e -OR- null if i
2050: 74 20 63 61 6e 6e 6f 74 20 62 65 20 64 65 74 65 t cannot be dete
2060: 72 6d 69 6e 65 64 0d 0a 20 20 20 20 20 20 2f 2f rmined.. //
2070: 2f 20 6f 72 20 64 6f 65 73 20 6e 6f 74 20 65 78 / or does not ex
2080: 69 73 74 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ist... ///
2090: 3c 2f 72 65 74 75 72 6e 73 3e 0d 0a 20 20 20 20 </returns>..
20a0: 20 20 70 72 69 76 61 74 65 20 73 74 61 74 69 63 private static
20b0: 20 73 74 72 69 6e 67 20 47 65 74 58 6d 6c 43 6f string GetXmlCo
20c0: 6e 66 69 67 46 69 6c 65 4e 61 6d 65 28 29 0d 0a nfigFileName()..
20d0: 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 {..
20e0: 20 20 20 73 74 72 69 6e 67 20 64 69 72 65 63 74 string direct
20f0: 6f 72 79 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 ory;..
2100: 73 74 72 69 6e 67 20 66 69 6c 65 4e 61 6d 65 3b string fileName;
2110: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
2120: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
2130: 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 64 69 RK.. di
2140: 72 65 63 74 6f 72 79 20 3d 20 41 70 70 44 6f 6d rectory = AppDom
2150: 61 69 6e 2e 43 75 72 72 65 6e 74 44 6f 6d 61 69 ain.CurrentDomai
2160: 6e 2e 42 61 73 65 44 69 72 65 63 74 6f 72 79 3b n.BaseDirectory;
2170: 0d 0a 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 .. file
2180: 4e 61 6d 65 20 3d 20 50 61 74 68 2e 43 6f 6d 62 Name = Path.Comb
2190: 69 6e 65 28 64 69 72 65 63 74 6f 72 79 2c 20 58 ine(directory, X
21a0: 6d 6c 43 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 mlConfigFileName
21b0: 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 );....
21c0: 69 66 20 28 46 69 6c 65 2e 45 78 69 73 74 73 28 if (File.Exists(
21d0: 66 69 6c 65 4e 61 6d 65 29 29 0d 0a 20 20 20 20 fileName))..
21e0: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
21f0: 20 66 69 6c 65 4e 61 6d 65 3b 0d 0a 23 65 6e 64 fileName;..#end
2200: 69 66 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 if....
2210: 64 69 72 65 63 74 6f 72 79 20 3d 20 47 65 74 41 directory = GetA
2220: 73 73 65 6d 62 6c 79 44 69 72 65 63 74 6f 72 79 ssemblyDirectory
2230: 28 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 ();.. f
2240: 69 6c 65 4e 61 6d 65 20 3d 20 50 61 74 68 2e 43 ileName = Path.C
2250: 6f 6d 62 69 6e 65 28 64 69 72 65 63 74 6f 72 79 ombine(directory
2260: 2c 20 58 6d 6c 43 6f 6e 66 69 67 46 69 6c 65 4e , XmlConfigFileN
2270: 61 6d 65 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 ame);....
2280: 20 20 20 69 66 20 28 46 69 6c 65 2e 45 78 69 73 if (File.Exis
2290: 74 73 28 66 69 6c 65 4e 61 6d 65 29 29 0d 0a 20 ts(fileName))..
22a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 ret
22b0: 75 72 6e 20 66 69 6c 65 4e 61 6d 65 3b 0d 0a 0d urn fileName;...
22c0: 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 . retur
22d0: 6e 20 6e 75 6c 6c 3b 0d 0a 20 20 20 20 20 20 7d n null;.. }
22e0: 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f .... //////
22f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2300: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2310: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2320: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2330: 2f 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c ///.. /// <
2340: 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 summary>..
2350: 2f 2f 2f 20 51 75 65 72 69 65 73 20 61 6e 64 20 /// Queries and
2360: 72 65 74 75 72 6e 73 20 74 68 65 20 76 61 6c 75 returns the valu
2370: 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 69 e of the specifi
2380: 65 64 20 73 65 74 74 69 6e 67 2c 20 75 73 69 6e ed setting, usin
2390: 67 20 74 68 65 20 58 4d 4c 0d 0a 20 20 20 20 20 g the XML..
23a0: 20 2f 2f 2f 20 63 6f 6e 66 69 67 75 72 61 74 69 /// configurati
23b0: 6f 6e 20 66 69 6c 65 20 61 6e 64 2f 6f 72 20 74 on file and/or t
23c0: 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 he environment v
23d0: 61 72 69 61 62 6c 65 73 20 66 6f 72 20 74 68 65 ariables for the
23e0: 20 63 75 72 72 65 6e 74 0d 0a 20 20 20 20 20 20 current..
23f0: 2f 2f 2f 20 70 72 6f 63 65 73 73 20 61 6e 64 2f /// process and/
2400: 6f 72 20 74 68 65 20 63 75 72 72 65 6e 74 20 73 or the current s
2410: 79 73 74 65 6d 2c 20 77 68 65 6e 20 61 76 61 69 ystem, when avai
2420: 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 2f 2f lable... //
2430: 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 / </summary>..
2440: 20 20 20 20 2f 2f 2f 20 3c 70 61 72 61 6d 20 6e /// <param n
2450: 61 6d 65 3d 22 6e 61 6d 65 22 3e 0d 0a 20 20 20 ame="name">..
2460: 20 20 20 2f 2f 2f 20 54 68 65 20 6e 61 6d 65 20 /// The name
2470: 6f 66 20 74 68 65 20 73 65 74 74 69 6e 67 2e 0d of the setting..
2480: 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 70 61 72 . /// </par
2490: 61 6d 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c am>.. /// <
24a0: 70 61 72 61 6d 20 6e 61 6d 65 3d 22 64 65 66 61 param name="defa
24b0: 75 6c 74 22 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f ult">.. ///
24c0: 20 54 68 65 20 76 61 6c 75 65 20 74 6f 20 62 65 The value to be
24d0: 20 72 65 74 75 72 6e 65 64 20 69 66 20 74 68 65 returned if the
24e0: 20 73 65 74 74 69 6e 67 20 68 61 73 20 6e 6f 74 setting has not
24f0: 20 62 65 65 6e 20 73 65 74 20 65 78 70 6c 69 63 been set explic
2500: 69 74 6c 79 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 itly.. ///
2510: 6f 72 20 63 61 6e 6e 6f 74 20 62 65 20 64 65 74 or cannot be det
2520: 65 72 6d 69 6e 65 64 2e 0d 0a 20 20 20 20 20 20 ermined...
2530: 2f 2f 2f 20 3c 2f 70 61 72 61 6d 3e 0d 0a 20 20 /// </param>..
2540: 20 20 20 20 2f 2f 2f 20 3c 72 65 74 75 72 6e 73 /// <returns
2550: 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 65 >.. /// The
2560: 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 73 65 value of the se
2570: 74 74 69 6e 67 20 2d 4f 52 2d 20 74 68 65 20 64 tting -OR- the d
2580: 65 66 61 75 6c 74 20 76 61 6c 75 65 20 73 70 65 efault value spe
2590: 63 69 66 69 65 64 20 62 79 0d 0a 20 20 20 20 20 cified by..
25a0: 20 2f 2f 2f 20 3c 70 61 72 61 6d 72 65 66 20 6e /// <paramref n
25b0: 61 6d 65 3d 22 64 65 66 61 75 6c 74 22 20 2f 3e ame="default" />
25c0: 20 69 66 20 69 74 20 68 61 73 20 6e 6f 74 20 62 if it has not b
25d0: 65 65 6e 20 73 65 74 20 65 78 70 6c 69 63 69 74 een set explicit
25e0: 6c 79 20 6f 72 0d 0a 20 20 20 20 20 20 2f 2f 2f ly or.. ///
25f0: 20 63 61 6e 6e 6f 74 20 62 65 20 64 65 74 65 72 cannot be deter
2600: 6d 69 6e 65 64 2e 20 20 42 79 20 64 65 66 61 75 mined. By defau
2610: 6c 74 2c 20 61 6c 6c 20 72 65 66 65 72 65 6e 63 lt, all referenc
2620: 65 73 20 74 6f 20 65 78 69 73 74 69 6e 67 0d 0a es to existing..
2630: 20 20 20 20 20 20 2f 2f 2f 20 65 6e 76 69 72 6f /// enviro
2640: 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20 nment variables
2650: 77 69 6c 6c 20 62 65 20 65 78 70 61 6e 64 65 64 will be expanded
2660: 20 74 6f 20 74 68 65 69 72 20 63 6f 72 72 65 73 to their corres
2670: 70 6f 6e 64 69 6e 67 20 76 61 6c 75 65 73 0d 0a ponding values..
2680: 20 20 20 20 20 20 2f 2f 2f 20 77 69 74 68 69 6e /// within
2690: 20 74 68 65 20 76 61 6c 75 65 20 74 6f 20 62 65 the value to be
26a0: 20 72 65 74 75 72 6e 65 64 20 75 6e 6c 65 73 73 returned unless
26b0: 20 65 69 74 68 65 72 20 74 68 65 20 22 4e 6f 5f either the "No_
26c0: 45 78 70 61 6e 64 22 20 6f 72 0d 0a 20 20 20 20 Expand" or..
26d0: 20 20 2f 2f 2f 20 22 4e 6f 5f 45 78 70 61 6e 64 /// "No_Expand
26e0: 5f 3c 70 61 72 61 6d 72 65 66 20 6e 61 6d 65 3d _<paramref name=
26f0: 22 6e 61 6d 65 22 20 2f 3e 22 20 65 6e 76 69 72 "name" />" envir
2700: 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 20 onment variable
2710: 69 73 20 73 65 74 20 5b 74 6f 0d 0a 20 20 20 20 is set [to..
2720: 20 20 2f 2f 2f 20 61 6e 79 74 68 69 6e 67 5d 2e /// anything].
2730: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 72 65 .. /// </re
2740: 74 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 69 6e turns>.. in
2750: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 73 74 ternal static st
2760: 72 69 6e 67 20 47 65 74 53 65 74 74 69 6e 67 56 ring GetSettingV
2770: 61 6c 75 65 28 0d 0a 20 20 20 20 20 20 20 20 20 alue(..
2780: 20 73 74 72 69 6e 67 20 6e 61 6d 65 2c 20 20 20 string name,
2790: 20 2f 2a 20 69 6e 20 2a 2f 0d 0a 20 20 20 20 20 /* in */..
27a0: 20 20 20 20 20 73 74 72 69 6e 67 20 40 64 65 66 string @def
27b0: 61 75 6c 74 20 2f 2a 20 69 6e 20 2a 2f 0d 0a 20 ault /* in */..
27c0: 20 20 20 20 20 20 20 20 20 29 0d 0a 20 20 20 20 )..
27d0: 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 {.. i
27e0: 66 20 28 6e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 f (name == null)
27f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2800: 72 65 74 75 72 6e 20 40 64 65 66 61 75 6c 74 3b return @default;
2810: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f .... //
2820: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2830: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2840: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2850: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2860: 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ///....
2870: 20 23 72 65 67 69 6f 6e 20 44 65 62 75 67 20 42 #region Debug B
2880: 75 69 6c 64 20 4f 6e 6c 79 0d 0a 23 69 66 20 44 uild Only..#if D
2890: 45 42 55 47 0d 0a 20 20 20 20 20 20 20 20 20 20 EBUG..
28a0: 6c 6f 63 6b 20 28 73 74 61 74 69 63 53 79 6e 63 lock (staticSync
28b0: 52 6f 6f 74 29 0d 0a 20 20 20 20 20 20 20 20 20 Root)..
28c0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
28d0: 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 //..
28e0: 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 55 70 64 // NOTE: Upd
28f0: 61 74 65 20 73 74 61 74 69 73 74 69 63 73 20 66 ate statistics f
2900: 6f 72 20 74 68 69 73 20 73 65 74 74 69 6e 67 20 or this setting
2910: 76 61 6c 75 65 2e 0d 0a 20 20 20 20 20 20 20 20 value...
2920: 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 //..
2930: 20 20 20 20 20 20 20 20 69 66 20 28 73 65 74 74 if (sett
2940: 69 6e 67 52 65 61 64 43 6f 75 6e 74 73 20 21 3d ingReadCounts !=
2950: 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 null)..
2960: 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 {..
2970: 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 63 int c
2980: 6f 75 6e 74 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 ount;....
2990: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 73 if (s
29a0: 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 73 ettingReadCounts
29b0: 2e 54 72 79 47 65 74 56 61 6c 75 65 28 6e 61 6d .TryGetValue(nam
29c0: 65 2c 20 6f 75 74 20 63 6f 75 6e 74 29 29 0d 0a e, out count))..
29d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29e0: 20 20 20 20 20 20 73 65 74 74 69 6e 67 52 65 61 settingRea
29f0: 64 43 6f 75 6e 74 73 5b 6e 61 6d 65 5d 20 3d 20 dCounts[name] =
2a00: 63 6f 75 6e 74 20 2b 20 31 3b 0d 0a 20 20 20 20 count + 1;..
2a10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6c el
2a20: 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 se..
2a30: 20 20 20 20 20 20 20 20 20 20 73 65 74 74 69 6e settin
2a40: 67 52 65 61 64 43 6f 75 6e 74 73 2e 41 64 64 28 gReadCounts.Add(
2a50: 6e 61 6d 65 2c 20 31 29 3b 0d 0a 20 20 20 20 20 name, 1);..
2a60: 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
2a70: 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 0d }..#endif.
2a80: 0a 20 20 20 20 20 20 20 20 20 20 23 65 6e 64 72 . #endr
2a90: 65 67 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 egion....
2aa0: 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////////
2ab0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2ac0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2ad0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
2ae0: 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 ////////....
2af0: 20 20 20 20 20 20 73 74 72 69 6e 67 20 76 61 6c string val
2b00: 75 65 20 3d 20 6e 75 6c 6c 3b 0d 0a 0d 0a 23 69 ue = null;....#i
2b10: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
2b20: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
2b30: 20 20 20 20 20 20 20 20 62 6f 6f 6c 20 65 78 70 bool exp
2b40: 61 6e 64 20 3d 20 74 72 75 65 3b 0d 0a 0d 0a 20 and = true;....
2b50: 20 20 20 20 20 20 20 20 20 69 66 20 28 45 6e 76 if (Env
2b60: 69 72 6f 6e 6d 65 6e 74 2e 47 65 74 45 6e 76 69 ironment.GetEnvi
2b70: 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 28 ronmentVariable(
2b80: 22 4e 6f 5f 45 78 70 61 6e 64 22 29 20 21 3d 20 "No_Expand") !=
2b90: 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 null)..
2ba0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2bb0: 20 20 65 78 70 61 6e 64 20 3d 20 66 61 6c 73 65 expand = false
2bc0: 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ;.. }..
2bd0: 20 20 20 20 20 20 20 20 20 20 65 6c 73 65 20 69 else i
2be0: 66 20 28 45 6e 76 69 72 6f 6e 6d 65 6e 74 2e 47 f (Environment.G
2bf0: 65 74 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 etEnvironmentVar
2c00: 69 61 62 6c 65 28 53 74 72 69 6e 67 2e 46 6f 72 iable(String.For
2c10: 6d 61 74 28 0d 0a 20 20 20 20 20 20 20 20 20 20 mat(..
2c20: 20 20 20 20 20 20 20 20 22 4e 6f 5f 45 78 70 61 "No_Expa
2c30: 6e 64 5f 7b 30 7d 22 2c 20 6e 61 6d 65 29 29 20 nd_{0}", name))
2c40: 21 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 != null)..
2c50: 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
2c60: 20 20 20 20 20 65 78 70 61 6e 64 20 3d 20 66 61 expand = fa
2c70: 6c 73 65 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 lse;..
2c80: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 76 }.... v
2c90: 61 6c 75 65 20 3d 20 45 6e 76 69 72 6f 6e 6d 65 alue = Environme
2ca0: 6e 74 2e 47 65 74 45 6e 76 69 72 6f 6e 6d 65 6e nt.GetEnvironmen
2cb0: 74 56 61 72 69 61 62 6c 65 28 6e 61 6d 65 29 3b tVariable(name);
2cc0: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
2cd0: 20 28 65 78 70 61 6e 64 20 26 26 20 21 53 74 72 (expand && !Str
2ce0: 69 6e 67 2e 49 73 4e 75 6c 6c 4f 72 45 6d 70 74 ing.IsNullOrEmpt
2cf0: 79 28 76 61 6c 75 65 29 29 0d 0a 20 20 20 20 20 y(value))..
2d00: 20 20 20 20 20 20 20 20 20 76 61 6c 75 65 20 3d value =
2d10: 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 2e 45 78 70 Environment.Exp
2d20: 61 6e 64 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 andEnvironmentVa
2d30: 72 69 61 62 6c 65 73 28 76 61 6c 75 65 29 3b 0d riables(value);.
2d40: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
2d50: 28 76 61 6c 75 65 20 21 3d 20 6e 75 6c 6c 29 0d (value != null).
2d60: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 . r
2d70: 65 74 75 72 6e 20 76 61 6c 75 65 3b 0d 0a 23 65 eturn value;..#e
2d80: 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ndif....
2d90: 20 20 74 72 79 0d 0a 20 20 20 20 20 20 20 20 20 try..
2da0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2db0: 20 20 73 74 72 69 6e 67 20 66 69 6c 65 4e 61 6d string fileNam
2dc0: 65 20 3d 20 47 65 74 58 6d 6c 43 6f 6e 66 69 67 e = GetXmlConfig
2dd0: 46 69 6c 65 4e 61 6d 65 28 29 3b 0d 0a 0d 0a 20 FileName();....
2de0: 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
2df0: 28 66 69 6c 65 4e 61 6d 65 20 3d 3d 20 6e 75 6c (fileName == nul
2e00: 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 l)..
2e10: 20 20 20 20 20 20 72 65 74 75 72 6e 20 40 64 65 return @de
2e20: 66 61 75 6c 74 3b 0d 0a 0d 0a 20 20 20 20 20 20 fault;....
2e30: 20 20 20 20 20 20 20 20 58 6d 6c 44 6f 63 75 6d XmlDocum
2e40: 65 6e 74 20 64 6f 63 75 6d 65 6e 74 20 3d 20 6e ent document = n
2e50: 65 77 20 58 6d 6c 44 6f 63 75 6d 65 6e 74 28 29 ew XmlDocument()
2e60: 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ;....
2e70: 20 20 20 64 6f 63 75 6d 65 6e 74 2e 4c 6f 61 64 document.Load
2e80: 28 66 69 6c 65 4e 61 6d 65 29 3b 0d 0a 0d 0a 20 (fileName);....
2e90: 20 20 20 20 20 20 20 20 20 20 20 20 20 58 6d 6c Xml
2ea0: 45 6c 65 6d 65 6e 74 20 65 6c 65 6d 65 6e 74 20 Element element
2eb0: 3d 20 64 6f 63 75 6d 65 6e 74 2e 53 65 6c 65 63 = document.Selec
2ec0: 74 53 69 6e 67 6c 65 4e 6f 64 65 28 53 74 72 69 tSingleNode(Stri
2ed0: 6e 67 2e 46 6f 72 6d 61 74 28 0d 0a 20 20 20 20 ng.Format(..
2ee0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2f "/
2ef0: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2f 61 70 configuration/ap
2f00: 70 53 65 74 74 69 6e 67 73 2f 61 64 64 5b 40 6b pSettings/add[@k
2f10: 65 79 3d 27 7b 30 7d 27 5d 22 2c 20 6e 61 6d 65 ey='{0}']", name
2f20: 29 29 20 61 73 0d 0a 20 20 20 20 20 20 20 20 20 )) as..
2f30: 20 20 20 20 20 20 20 20 20 58 6d 6c 45 6c 65 6d XmlElem
2f40: 65 6e 74 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ent;....
2f50: 20 20 20 20 20 20 69 66 20 28 65 6c 65 6d 65 6e if (elemen
2f60: 74 20 21 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 t != null)..
2f70: 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 {..
2f80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 i
2f90: 66 20 28 65 6c 65 6d 65 6e 74 2e 48 61 73 41 74 f (element.HasAt
2fa0: 74 72 69 62 75 74 65 28 22 76 61 6c 75 65 22 29 tribute("value")
2fb0: 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 )..
2fc0: 20 20 20 20 20 20 20 20 20 76 61 6c 75 65 20 3d value =
2fd0: 20 65 6c 65 6d 65 6e 74 2e 47 65 74 41 74 74 72 element.GetAttr
2fe0: 69 62 75 74 65 28 22 76 61 6c 75 65 22 29 3b 0d ibute("value");.
2ff0: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
3000: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
3010: 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 K..
3020: 20 20 20 20 20 69 66 20 28 65 78 70 61 6e 64 20 if (expand
3030: 26 26 20 21 53 74 72 69 6e 67 2e 49 73 4e 75 6c && !String.IsNul
3040: 6c 4f 72 45 6d 70 74 79 28 76 61 6c 75 65 29 29 lOrEmpty(value))
3050: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
3060: 20 20 20 20 20 20 20 20 76 61 6c 75 65 20 3d 20 value =
3070: 45 6e 76 69 72 6f 6e 6d 65 6e 74 2e 45 78 70 61 Environment.Expa
3080: 6e 64 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 ndEnvironmentVar
3090: 69 61 62 6c 65 73 28 76 61 6c 75 65 29 3b 0d 0a iables(value);..
30a0: 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 20 20 #endif....
30b0: 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 if (
30c0: 76 61 6c 75 65 20 21 3d 20 6e 75 6c 6c 29 0d 0a value != null)..
30d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
30e0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c return val
30f0: 75 65 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ue;..
3100: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
3110: 7d 0d 0a 23 69 66 20 21 4e 45 54 5f 43 4f 4d 50 }..#if !NET_COMP
3120: 41 43 54 5f 32 30 20 26 26 20 54 52 41 43 45 5f ACT_20 && TRACE_
3130: 53 48 41 52 45 44 0d 0a 20 20 20 20 20 20 20 20 SHARED..
3140: 20 20 63 61 74 63 68 20 28 45 78 63 65 70 74 69 catch (Excepti
3150: 6f 6e 20 65 29 0d 0a 23 65 6c 73 65 0d 0a 20 20 on e)..#else..
3160: 20 20 20 20 20 20 20 20 63 61 74 63 68 20 28 45 catch (E
3170: 78 63 65 70 74 69 6f 6e 29 0d 0a 23 65 6e 64 69 xception)..#endi
3180: 66 0d 0a 20 20 20 20 20 20 20 20 20 20 7b 0d 0a f.. {..
3190: 23 69 66 20 21 4e 45 54 5f 43 4f 4d 50 41 43 54 #if !NET_COMPACT
31a0: 5f 32 30 20 26 26 20 54 52 41 43 45 5f 53 48 41 _20 && TRACE_SHA
31b0: 52 45 44 0d 0a 20 20 20 20 20 20 20 20 20 20 20 RED..
31c0: 20 20 20 74 72 79 0d 0a 20 20 20 20 20 20 20 20 try..
31d0: 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 {..
31e0: 20 20 20 20 20 20 20 20 20 20 20 54 72 61 63 65 Trace
31f0: 2e 57 72 69 74 65 4c 69 6e 65 28 53 74 72 69 6e .WriteLine(Strin
3200: 67 2e 46 6f 72 6d 61 74 28 0d 0a 20 20 20 20 20 g.Format(..
3210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3220: 20 43 75 6c 74 75 72 65 49 6e 66 6f 2e 43 75 72 CultureInfo.Cur
3230: 72 65 6e 74 43 75 6c 74 75 72 65 2c 0d 0a 20 20 rentCulture,..
3240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3250: 20 20 20 20 22 4e 61 74 69 76 65 20 6c 69 62 72 "Native libr
3260: 61 72 79 20 70 72 65 2d 6c 6f 61 64 65 72 20 66 ary pre-loader f
3270: 61 69 6c 65 64 20 74 6f 20 67 65 74 20 73 65 74 ailed to get set
3280: 74 69 6e 67 20 22 20 2b 0d 0a 20 20 20 20 20 20 ting " +..
3290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
32a0: 22 5c 22 7b 30 7d 5c 22 20 76 61 6c 75 65 3a 20 "\"{0}\" value:
32b0: 7b 31 7d 22 2c 20 6e 61 6d 65 2c 20 65 29 29 3b {1}", name, e));
32c0: 20 2f 2a 20 74 68 72 6f 77 20 2a 2f 0d 0a 20 20 /* throw */..
32d0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
32e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 74 cat
32f0: 63 68 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ch..
3300: 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 {..
3310: 20 20 20 20 20 20 20 2f 2f 20 64 6f 20 6e 6f 74 // do not
3320: 68 69 6e 67 2e 0d 0a 20 20 20 20 20 20 20 20 20 hing...
3330: 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a }..#endif..
3340: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
3350: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
3360: 40 64 65 66 61 75 6c 74 3b 0d 0a 20 20 20 20 20 @default;..
3370: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f }.... ////
3380: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3390: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
33a0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
33b0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
33c0: 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c /////....#if !PL
33d0: 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
33e0: 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 70 AMEWORK.. p
33f0: 72 69 76 61 74 65 20 73 74 61 74 69 63 20 73 74 rivate static st
3400: 72 69 6e 67 20 4c 69 73 74 54 6f 53 74 72 69 6e ring ListToStrin
3410: 67 28 49 4c 69 73 74 3c 73 74 72 69 6e 67 3e 20 g(IList<string>
3420: 6c 69 73 74 29 0d 0a 20 20 20 20 20 20 7b 0d 0a list).. {..
3430: 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6c 69 if (li
3440: 73 74 20 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 st == null)..
3450: 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
3460: 6e 20 6e 75 6c 6c 3b 0d 0a 0d 0a 20 20 20 20 20 n null;....
3470: 20 20 20 20 20 53 74 72 69 6e 67 42 75 69 6c 64 StringBuild
3480: 65 72 20 72 65 73 75 6c 74 20 3d 20 6e 65 77 20 er result = new
3490: 53 74 72 69 6e 67 42 75 69 6c 64 65 72 28 29 3b StringBuilder();
34a0: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f .... fo
34b0: 72 65 61 63 68 20 28 73 74 72 69 6e 67 20 65 6c reach (string el
34c0: 65 6d 65 6e 74 20 69 6e 20 6c 69 73 74 29 0d 0a ement in list)..
34d0: 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 {..
34e0: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 65 if (e
34f0: 6c 65 6d 65 6e 74 20 3d 3d 20 6e 75 6c 6c 29 0d lement == null).
3500: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
3510: 20 20 20 63 6f 6e 74 69 6e 75 65 3b 0d 0a 0d 0a continue;....
3520: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
3530: 20 28 72 65 73 75 6c 74 2e 4c 65 6e 67 74 68 20 (result.Length
3540: 3e 20 30 29 0d 0a 20 20 20 20 20 20 20 20 20 20 > 0)..
3550: 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 2e 41 result.A
3560: 70 70 65 6e 64 28 27 20 27 29 3b 0d 0a 0d 0a 20 ppend(' ');....
3570: 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 73 res
3580: 75 6c 74 2e 41 70 70 65 6e 64 28 65 6c 65 6d 65 ult.Append(eleme
3590: 6e 74 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 nt);..
35a0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 72 }.... r
35b0: 65 74 75 72 6e 20 72 65 73 75 6c 74 2e 54 6f 53 eturn result.ToS
35c0: 74 72 69 6e 67 28 29 3b 0d 0a 20 20 20 20 20 20 tring();..
35d0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f }.... /////
35e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
35f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3600: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3610: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3620: 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 70 72 ////.... pr
3630: 69 76 61 74 65 20 73 74 61 74 69 63 20 69 6e 74 ivate static int
3640: 20 43 68 65 63 6b 46 6f 72 41 72 63 68 69 74 65 CheckForArchite
3650: 63 74 75 72 65 73 41 6e 64 50 6c 61 74 66 6f 72 cturesAndPlatfor
3660: 6d 73 28 0d 0a 20 20 20 20 20 20 20 20 20 20 73 ms(.. s
3670: 74 72 69 6e 67 20 64 69 72 65 63 74 6f 72 79 2c tring directory,
3680: 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 66 20 .. ref
3690: 4c 69 73 74 3c 73 74 72 69 6e 67 3e 20 6d 61 74 List<string> mat
36a0: 63 68 65 73 0d 0a 20 20 20 20 20 20 20 20 20 20 ches..
36b0: 29 0d 0a 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 ).. {..
36c0: 20 20 20 20 20 20 69 6e 74 20 72 65 73 75 6c 74 int result
36d0: 20 3d 20 30 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 = 0;....
36e0: 20 20 20 69 66 20 28 6d 61 74 63 68 65 73 20 3d if (matches =
36f0: 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 = null)..
3700: 20 20 20 20 20 20 20 6d 61 74 63 68 65 73 20 3d matches =
3710: 20 6e 65 77 20 4c 69 73 74 3c 73 74 72 69 6e 67 new List<string
3720: 3e 28 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 >();....
3730: 20 20 6c 6f 63 6b 20 28 73 74 61 74 69 63 53 79 lock (staticSy
3740: 6e 63 52 6f 6f 74 29 0d 0a 20 20 20 20 20 20 20 ncRoot)..
3750: 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 {..
3760: 20 20 20 20 69 66 20 28 21 53 74 72 69 6e 67 2e if (!String.
3770: 49 73 4e 75 6c 6c 4f 72 45 6d 70 74 79 28 64 69 IsNullOrEmpty(di
3780: 72 65 63 74 6f 72 79 29 20 26 26 0d 0a 20 20 20 rectory) &&..
3790: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 (
37a0: 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 processorArchite
37b0: 63 74 75 72 65 50 6c 61 74 66 6f 72 6d 73 20 21 cturePlatforms !
37c0: 3d 20 6e 75 6c 6c 29 29 0d 0a 20 20 20 20 20 20 = null))..
37d0: 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 {..
37e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 for
37f0: 65 61 63 68 20 28 4b 65 79 56 61 6c 75 65 50 61 each (KeyValuePa
3800: 69 72 3c 73 74 72 69 6e 67 2c 20 73 74 72 69 6e ir<string, strin
3810: 67 3e 20 70 61 69 72 0d 0a 20 20 20 20 20 20 20 g> pair..
3820: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3830: 20 20 20 20 20 69 6e 20 70 72 6f 63 65 73 73 6f in processo
3840: 72 41 72 63 68 69 74 65 63 74 75 72 65 50 6c 61 rArchitecturePla
3850: 74 66 6f 72 6d 73 29 0d 0a 20 20 20 20 20 20 20 tforms)..
3860: 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
3870: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3880: 20 20 20 20 69 66 20 28 44 69 72 65 63 74 6f 72 if (Director
3890: 79 2e 45 78 69 73 74 73 28 50 61 74 68 2e 43 6f y.Exists(Path.Co
38a0: 6d 62 69 6e 65 28 64 69 72 65 63 74 6f 72 79 2c mbine(directory,
38b0: 20 70 61 69 72 2e 4b 65 79 29 29 29 0d 0a 20 20 pair.Key)))..
38c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
38d0: 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
38e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
38f0: 20 6d 61 74 63 68 65 73 2e 41 64 64 28 70 61 69 matches.Add(pai
3900: 72 2e 4b 65 79 29 3b 0d 0a 20 20 20 20 20 20 20 r.Key);..
3910: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3920: 20 20 20 72 65 73 75 6c 74 2b 2b 3b 0d 0a 20 20 result++;..
3930: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3940: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
3950: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 s
3960: 74 72 69 6e 67 20 76 61 6c 75 65 20 3d 20 70 61 tring value = pa
3970: 69 72 2e 56 61 6c 75 65 3b 0d 0a 0d 0a 20 20 20 ir.Value;....
3980: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3990: 20 20 20 69 66 20 28 76 61 6c 75 65 20 3d 3d 20 if (value ==
39a0: 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 null)..
39b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
39c0: 20 63 6f 6e 74 69 6e 75 65 3b 0d 0a 0d 0a 20 20 continue;....
39d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
39e0: 20 20 20 20 69 66 20 28 44 69 72 65 63 74 6f 72 if (Director
39f0: 79 2e 45 78 69 73 74 73 28 50 61 74 68 2e 43 6f y.Exists(Path.Co
3a00: 6d 62 69 6e 65 28 64 69 72 65 63 74 6f 72 79 2c mbine(directory,
3a10: 20 76 61 6c 75 65 29 29 29 0d 0a 20 20 20 20 20 value)))..
3a20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3a30: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
3a40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 61 ma
3a50: 74 63 68 65 73 2e 41 64 64 28 76 61 6c 75 65 29 tches.Add(value)
3a60: 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ;..
3a70: 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 73 res
3a80: 75 6c 74 2b 2b 3b 0d 0a 20 20 20 20 20 20 20 20 ult++;..
3a90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
3aa0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
3ab0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
3ac0: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
3ad0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
3ae0: 72 65 74 75 72 6e 20 72 65 73 75 6c 74 3b 0d 0a return result;..
3af0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
3b00: 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////////
3b10: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3b20: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3b30: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3b40: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 //////////....
3b50: 20 20 20 20 70 72 69 76 61 74 65 20 73 74 61 74 private stat
3b60: 69 63 20 62 6f 6f 6c 20 43 68 65 63 6b 41 73 73 ic bool CheckAss
3b70: 65 6d 62 6c 79 43 6f 64 65 42 61 73 65 28 0d 0a emblyCodeBase(..
3b80: 20 20 20 20 20 20 20 20 20 20 41 73 73 65 6d 62 Assemb
3b90: 6c 79 20 61 73 73 65 6d 62 6c 79 2c 0d 0a 20 20 ly assembly,..
3ba0: 20 20 20 20 20 20 20 20 72 65 66 20 73 74 72 69 ref stri
3bb0: 6e 67 20 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 ng fileName..
3bc0: 20 20 20 20 20 20 20 29 0d 0a 20 20 20 20 20 20 )..
3bd0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 72 79 {.. try
3be0: 0d 0a 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 .. {..
3bf0: 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
3c00: 28 61 73 73 65 6d 62 6c 79 20 3d 3d 20 6e 75 6c (assembly == nul
3c10: 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 l)..
3c20: 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c return fal
3c30: 73 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 se;....
3c40: 20 20 20 20 20 73 74 72 69 6e 67 20 63 6f 64 65 string code
3c50: 42 61 73 65 20 3d 20 61 73 73 65 6d 62 6c 79 2e Base = assembly.
3c60: 43 6f 64 65 42 61 73 65 3b 0d 0a 0d 0a 20 20 20 CodeBase;....
3c70: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 53 if (S
3c80: 74 72 69 6e 67 2e 49 73 4e 75 6c 6c 4f 72 45 6d tring.IsNullOrEm
3c90: 70 74 79 28 63 6f 64 65 42 61 73 65 29 29 0d 0a pty(codeBase))..
3ca0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3cb0: 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 3b 0d return false;.
3cc0: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
3cd0: 20 55 72 69 20 75 72 69 20 3d 20 6e 65 77 20 55 Uri uri = new U
3ce0: 72 69 28 63 6f 64 65 42 61 73 65 29 3b 0d 0a 20 ri(codeBase);..
3cf0: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 72 str
3d00: 69 6e 67 20 6c 6f 63 61 6c 46 69 6c 65 4e 61 6d ing localFileNam
3d10: 65 20 3d 20 75 72 69 2e 4c 6f 63 61 6c 50 61 74 e = uri.LocalPat
3d20: 68 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 h;....
3d30: 20 20 20 20 69 66 20 28 21 46 69 6c 65 2e 45 78 if (!File.Ex
3d40: 69 73 74 73 28 6c 6f 63 61 6c 46 69 6c 65 4e 61 ists(localFileNa
3d50: 6d 65 29 29 0d 0a 20 20 20 20 20 20 20 20 20 20 me))..
3d60: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 return f
3d70: 61 6c 73 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 alse;....
3d80: 20 20 20 20 20 20 20 73 74 72 69 6e 67 20 64 69 string di
3d90: 72 65 63 74 6f 72 79 20 3d 20 50 61 74 68 2e 47 rectory = Path.G
3da0: 65 74 44 69 72 65 63 74 6f 72 79 4e 61 6d 65 28 etDirectoryName(
3db0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
3dc0: 20 20 20 20 6c 6f 63 61 6c 46 69 6c 65 4e 61 6d localFileNam
3dd0: 65 29 3b 20 2f 2a 20 74 68 72 6f 77 20 2a 2f 0d e); /* throw */.
3de0: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
3df0: 20 73 74 72 69 6e 67 20 78 6d 6c 43 6f 6e 66 69 string xmlConfi
3e00: 67 46 69 6c 65 4e 61 6d 65 20 3d 20 50 61 74 68 gFileName = Path
3e10: 2e 43 6f 6d 62 69 6e 65 28 0d 0a 20 20 20 20 20 .Combine(..
3e20: 20 20 20 20 20 20 20 20 20 20 20 20 20 64 69 72 dir
3e30: 65 63 74 6f 72 79 2c 20 58 6d 6c 43 6f 6e 66 69 ectory, XmlConfi
3e40: 67 46 69 6c 65 4e 61 6d 65 29 3b 0d 0a 0d 0a 20 gFileName);....
3e50: 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
3e60: 28 46 69 6c 65 2e 45 78 69 73 74 73 28 78 6d 6c (File.Exists(xml
3e70: 43 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 29 29 ConfigFileName))
3e80: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
3e90: 7b 0d 0a 23 69 66 20 21 4e 45 54 5f 43 4f 4d 50 {..#if !NET_COMP
3ea0: 41 43 54 5f 32 30 20 26 26 20 54 52 41 43 45 5f ACT_20 && TRACE_
3eb0: 44 45 54 45 43 54 49 4f 4e 0d 0a 20 20 20 20 20 DETECTION..
3ec0: 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
3ed0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
3ee0: 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
3ef0: 20 20 20 20 20 20 20 20 20 20 20 20 20 54 72 61 Tra
3f00: 63 65 2e 57 72 69 74 65 4c 69 6e 65 28 53 74 72 ce.WriteLine(Str
3f10: 69 6e 67 2e 46 6f 72 6d 61 74 28 0d 0a 20 20 20 ing.Format(..
3f20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3f30: 20 20 20 20 20 20 20 43 75 6c 74 75 72 65 49 6e CultureIn
3f40: 66 6f 2e 43 75 72 72 65 6e 74 43 75 6c 74 75 72 fo.CurrentCultur
3f50: 65 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 e,..
3f60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 4e "N
3f70: 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 70 72 ative library pr
3f80: 65 2d 6c 6f 61 64 65 72 20 66 6f 75 6e 64 20 58 e-loader found X
3f90: 4d 4c 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e ML configuration
3fa0: 20 66 69 6c 65 20 22 20 2b 0d 0a 20 20 20 20 20 file " +..
3fb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3fc0: 20 20 20 20 20 22 76 69 61 20 63 6f 64 65 20 62 "via code b
3fd0: 61 73 65 20 66 6f 72 20 63 75 72 72 65 6e 74 6c ase for currentl
3fe0: 79 20 65 78 65 63 75 74 69 6e 67 20 61 73 73 65 y executing asse
3ff0: 6d 62 6c 79 3a 20 5c 22 7b 30 7d 5c 22 22 2c 0d mbly: \"{0}\"",.
4000: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
4010: 20 20 20 20 20 20 20 20 20 20 20 78 6d 6c 43 6f xmlCo
4020: 6e 66 69 67 46 69 6c 65 4e 61 6d 65 29 29 3b 20 nfigFileName));
4030: 2f 2a 20 74 68 72 6f 77 20 2a 2f 0d 0a 20 20 20 /* throw */..
4040: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
4050: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
4060: 20 20 20 20 63 61 74 63 68 0d 0a 20 20 20 20 20 catch..
4070: 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a {..
4080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4090: 20 20 20 20 20 20 2f 2f 20 64 6f 20 6e 6f 74 68 // do noth
40a0: 69 6e 67 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ing...
40b0: 20 20 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 }..#endi
40c0: 66 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 f....
40d0: 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 fileName
40e0: 3d 20 6c 6f 63 61 6c 46 69 6c 65 4e 61 6d 65 3b = localFileName;
40f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
4100: 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 3b return true;
4110: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
4120: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }....
4130: 20 20 20 4c 69 73 74 3c 73 74 72 69 6e 67 3e 20 List<string>
4140: 6d 61 74 63 68 65 73 20 3d 20 6e 75 6c 6c 3b 0d matches = null;.
4150: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
4160: 20 69 66 20 28 43 68 65 63 6b 46 6f 72 41 72 63 if (CheckForArc
4170: 68 69 74 65 63 74 75 72 65 73 41 6e 64 50 6c 61 hitecturesAndPla
4180: 74 66 6f 72 6d 73 28 64 69 72 65 63 74 6f 72 79 tforms(directory
4190: 2c 20 72 65 66 20 6d 61 74 63 68 65 73 29 20 3e , ref matches) >
41a0: 20 30 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 0)..
41b0: 20 20 20 7b 0d 0a 23 69 66 20 21 4e 45 54 5f 43 {..#if !NET_C
41c0: 4f 4d 50 41 43 54 5f 32 30 20 26 26 20 54 52 41 OMPACT_20 && TRA
41d0: 43 45 5f 44 45 54 45 43 54 49 4f 4e 0d 0a 20 20 CE_DETECTION..
41e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
41f0: 74 72 79 0d 0a 20 20 20 20 20 20 20 20 20 20 20 try..
4200: 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 {..
4210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4220: 54 72 61 63 65 2e 57 72 69 74 65 4c 69 6e 65 28 Trace.WriteLine(
4230: 53 74 72 69 6e 67 2e 46 6f 72 6d 61 74 28 0d 0a String.Format(..
4240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4250: 20 20 20 20 20 20 20 20 20 20 43 75 6c 74 75 72 Cultur
4260: 65 49 6e 66 6f 2e 43 75 72 72 65 6e 74 43 75 6c eInfo.CurrentCul
4270: 74 75 72 65 2c 0d 0a 20 20 20 20 20 20 20 20 20 ture,..
4280: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4290: 20 22 4e 61 74 69 76 65 20 6c 69 62 72 61 72 79 "Native library
42a0: 20 70 72 65 2d 6c 6f 61 64 65 72 20 66 6f 75 6e pre-loader foun
42b0: 64 20 6e 61 74 69 76 65 20 73 75 62 2d 64 69 72 d native sub-dir
42c0: 65 63 74 6f 72 69 65 73 20 22 20 2b 0d 0a 20 20 ectories " +..
42d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
42e0: 20 20 20 20 20 20 20 20 22 76 69 61 20 63 6f 64 "via cod
42f0: 65 20 62 61 73 65 20 66 6f 72 20 63 75 72 72 65 e base for curre
4300: 6e 74 6c 79 20 65 78 65 63 75 74 69 6e 67 20 61 ntly executing a
4310: 73 73 65 6d 62 6c 79 3a 20 5c 22 7b 30 7d 5c 22 ssembly: \"{0}\"
4320: 22 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ",..
4330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4c 69 Li
4340: 73 74 54 6f 53 74 72 69 6e 67 28 6d 61 74 63 68 stToString(match
4350: 65 73 29 29 29 3b 20 2f 2a 20 74 68 72 6f 77 20 es))); /* throw
4360: 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 */..
4370: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
4380: 20 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 catch
4390: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
43a0: 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
43b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 //
43c0: 64 6f 20 6e 6f 74 68 69 6e 67 2e 0d 0a 20 20 20 do nothing...
43d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
43e0: 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 ..#endif....
43f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 69 fi
4400: 6c 65 4e 61 6d 65 20 3d 20 6c 6f 63 61 6c 46 69 leName = localFi
4410: 6c 65 4e 61 6d 65 3b 0d 0a 20 20 20 20 20 20 20 leName;..
4420: 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
4430: 6e 20 74 72 75 65 3b 0d 0a 20 20 20 20 20 20 20 n true;..
4440: 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
4450: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
4460: 20 66 61 6c 73 65 3b 0d 0a 20 20 20 20 20 20 20 false;..
4470: 20 20 20 7d 0d 0a 23 69 66 20 21 4e 45 54 5f 43 }..#if !NET_C
4480: 4f 4d 50 41 43 54 5f 32 30 20 26 26 20 54 52 41 OMPACT_20 && TRA
4490: 43 45 5f 53 48 41 52 45 44 0d 0a 20 20 20 20 20 CE_SHARED..
44a0: 20 20 20 20 20 63 61 74 63 68 20 28 45 78 63 65 catch (Exce
44b0: 70 74 69 6f 6e 20 65 29 0d 0a 23 65 6c 73 65 0d ption e)..#else.
44c0: 0a 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 . catch
44d0: 20 28 45 78 63 65 70 74 69 6f 6e 29 0d 0a 23 65 (Exception)..#e
44e0: 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 20 20 20 ndif..
44f0: 7b 0d 0a 23 69 66 20 21 4e 45 54 5f 43 4f 4d 50 {..#if !NET_COMP
4500: 41 43 54 5f 32 30 20 26 26 20 54 52 41 43 45 5f ACT_20 && TRACE_
4510: 53 48 41 52 45 44 0d 0a 20 20 20 20 20 20 20 20 SHARED..
4520: 20 20 20 20 20 20 74 72 79 0d 0a 20 20 20 20 20 try..
4530: 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 {..
4540: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 72 Tr
4550: 61 63 65 2e 57 72 69 74 65 4c 69 6e 65 28 53 74 ace.WriteLine(St
4560: 72 69 6e 67 2e 46 6f 72 6d 61 74 28 0d 0a 20 20 ring.Format(..
4570: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4580: 20 20 20 20 43 75 6c 74 75 72 65 49 6e 66 6f 2e CultureInfo.
4590: 43 75 72 72 65 6e 74 43 75 6c 74 75 72 65 2c 0d CurrentCulture,.
45a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
45b0: 20 20 20 20 20 20 20 22 4e 61 74 69 76 65 20 6c "Native l
45c0: 69 62 72 61 72 79 20 70 72 65 2d 6c 6f 61 64 65 ibrary pre-loade
45d0: 72 20 66 61 69 6c 65 64 20 74 6f 20 63 68 65 63 r failed to chec
45e0: 6b 20 63 6f 64 65 20 62 61 73 65 20 22 20 2b 0d k code base " +.
45f0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
4600: 20 20 20 20 20 20 20 22 66 6f 72 20 63 75 72 72 "for curr
4610: 65 6e 74 6c 79 20 65 78 65 63 75 74 69 6e 67 20 ently executing
4620: 61 73 73 65 6d 62 6c 79 3a 20 7b 30 7d 22 2c 20 assembly: {0}",
4630: 65 29 29 3b 20 2f 2a 20 74 68 72 6f 77 20 2a 2f e)); /* throw */
4640: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
4650: 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 }..
4660: 20 63 61 74 63 68 0d 0a 20 20 20 20 20 20 20 20 catch..
4670: 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 {..
4680: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 64 6f // do
4690: 20 6e 6f 74 68 69 6e 67 2e 0d 0a 20 20 20 20 20 nothing...
46a0: 20 20 20 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 }..#end
46b0: 69 66 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d if.. }.
46c0: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 ... ret
46d0: 75 72 6e 20 66 61 6c 73 65 3b 0d 0a 20 20 20 20 urn false;..
46e0: 20 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 }..#endif....
46f0: 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////
4700: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
4710: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
4720: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
4730: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a //////////////..
4740: 20 20 20 20 20 20 2f 2f 2f 20 3c 73 75 6d 6d 61 /// <summa
4750: 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 51 ry>.. /// Q
4760: 75 65 72 69 65 73 20 61 6e 64 20 72 65 74 75 72 ueries and retur
4770: 6e 73 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 ns the directory
4780: 20 66 6f 72 20 74 68 65 20 61 73 73 65 6d 62 6c for the assembl
4790: 79 20 63 75 72 72 65 6e 74 6c 79 20 62 65 69 6e y currently bein
47a0: 67 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 65 78 65 g.. /// exe
47b0: 63 75 74 65 64 2e 0d 0a 20 20 20 20 20 20 2f 2f cuted... //
47c0: 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 / </summary>..
47d0: 20 20 20 20 2f 2f 2f 20 3c 72 65 74 75 72 6e 73 /// <returns
47e0: 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 65 >.. /// The
47f0: 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 20 74 directory for t
4800: 68 65 20 61 73 73 65 6d 62 6c 79 20 63 75 72 72 he assembly curr
4810: 65 6e 74 6c 79 20 62 65 69 6e 67 20 65 78 65 63 ently being exec
4820: 75 74 65 64 20 2d 4f 52 2d 20 6e 75 6c 6c 20 69 uted -OR- null i
4830: 66 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 69 74 20 f.. /// it
4840: 63 61 6e 6e 6f 74 20 62 65 20 64 65 74 65 72 6d cannot be determ
4850: 69 6e 65 64 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f ined... ///
4860: 20 3c 2f 72 65 74 75 72 6e 73 3e 0d 0a 20 20 20 </returns>..
4870: 20 20 20 70 72 69 76 61 74 65 20 73 74 61 74 69 private stati
4880: 63 20 73 74 72 69 6e 67 20 47 65 74 41 73 73 65 c string GetAsse
4890: 6d 62 6c 79 44 69 72 65 63 74 6f 72 79 28 29 0d mblyDirectory().
48a0: 0a 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 . {..
48b0: 20 20 20 20 74 72 79 0d 0a 20 20 20 20 20 20 20 try..
48c0: 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 {..
48d0: 20 20 20 20 41 73 73 65 6d 62 6c 79 20 61 73 73 Assembly ass
48e0: 65 6d 62 6c 79 20 3d 20 41 73 73 65 6d 62 6c 79 embly = Assembly
48f0: 2e 47 65 74 45 78 65 63 75 74 69 6e 67 41 73 73 .GetExecutingAss
4900: 65 6d 62 6c 79 28 29 3b 0d 0a 0d 0a 20 20 20 20 embly();....
4910: 20 20 20 20 20 20 20 20 20 20 69 66 20 28 61 73 if (as
4920: 73 65 6d 62 6c 79 20 3d 3d 20 6e 75 6c 6c 29 0d sembly == null).
4930: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
4940: 20 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 0d return null;.
4950: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
4960: 20 73 74 72 69 6e 67 20 66 69 6c 65 4e 61 6d 65 string fileName
4970: 20 3d 20 6e 75 6c 6c 3b 0d 0a 0d 0a 23 69 66 20 = null;....#if
4980: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
4990: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 FRAMEWORK..
49a0: 20 20 20 20 20 20 20 20 20 41 73 73 65 6d 62 6c Assembl
49b0: 79 4e 61 6d 65 20 61 73 73 65 6d 62 6c 79 4e 61 yName assemblyNa
49c0: 6d 65 20 3d 20 61 73 73 65 6d 62 6c 79 2e 47 65 me = assembly.Ge
49d0: 74 4e 61 6d 65 28 29 3b 0d 0a 0d 0a 20 20 20 20 tName();....
49e0: 20 20 20 20 20 20 20 20 20 20 69 66 20 28 61 73 if (as
49f0: 73 65 6d 62 6c 79 4e 61 6d 65 20 3d 3d 20 6e 75 semblyName == nu
4a00: 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ll)..
4a10: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 75 return nu
4a20: 6c 6c 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ll;....
4a30: 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 3d 20 fileName =
4a40: 61 73 73 65 6d 62 6c 79 4e 61 6d 65 2e 43 6f 64 assemblyName.Cod
4a50: 65 42 61 73 65 3b 0d 0a 23 65 6c 73 65 0d 0a 20 eBase;..#else..
4a60: 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
4a70: 28 21 43 68 65 63 6b 41 73 73 65 6d 62 6c 79 43 (!CheckAssemblyC
4a80: 6f 64 65 42 61 73 65 28 61 73 73 65 6d 62 6c 79 odeBase(assembly
4a90: 2c 20 72 65 66 20 66 69 6c 65 4e 61 6d 65 29 29 , ref fileName))
4aa0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
4ab0: 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 3d 20 61 fileName = a
4ac0: 73 73 65 6d 62 6c 79 2e 4c 6f 63 61 74 69 6f 6e ssembly.Location
4ad0: 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 ;..#endif....
4ae0: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 53 if (S
4af0: 74 72 69 6e 67 2e 49 73 4e 75 6c 6c 4f 72 45 6d tring.IsNullOrEm
4b00: 70 74 79 28 66 69 6c 65 4e 61 6d 65 29 29 0d 0a pty(fileName))..
4b10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
4b20: 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 0d 0a return null;..
4b30: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
4b40: 73 74 72 69 6e 67 20 64 69 72 65 63 74 6f 72 79 string directory
4b50: 20 3d 20 50 61 74 68 2e 47 65 74 44 69 72 65 63 = Path.GetDirec
4b60: 74 6f 72 79 4e 61 6d 65 28 66 69 6c 65 4e 61 6d toryName(fileNam
4b70: 65 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 e);....
4b80: 20 20 20 20 20 69 66 20 28 53 74 72 69 6e 67 2e if (String.
4b90: 49 73 4e 75 6c 6c 4f 72 45 6d 70 74 79 28 64 69 IsNullOrEmpty(di
4ba0: 72 65 63 74 6f 72 79 29 29 0d 0a 20 20 20 20 20 rectory))..
4bb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 ret
4bc0: 75 72 6e 20 6e 75 6c 6c 3b 0d 0a 0d 0a 20 20 20 urn null;....
4bd0: 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
4be0: 6e 20 64 69 72 65 63 74 6f 72 79 3b 0d 0a 20 20 n directory;..
4bf0: 20 20 20 20 20 20 20 20 7d 0d 0a 23 69 66 20 21 }..#if !
4c00: 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 30 20 26 NET_COMPACT_20 &
4c10: 26 20 54 52 41 43 45 5f 53 48 41 52 45 44 0d 0a & TRACE_SHARED..
4c20: 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 catch
4c30: 28 45 78 63 65 70 74 69 6f 6e 20 65 29 0d 0a 23 (Exception e)..#
4c40: 65 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 else..
4c50: 63 61 74 63 68 20 28 45 78 63 65 70 74 69 6f 6e catch (Exception
4c60: 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 )..#endif..
4c70: 20 20 20 20 20 7b 0d 0a 23 69 66 20 21 4e 45 54 {..#if !NET
4c80: 5f 43 4f 4d 50 41 43 54 5f 32 30 20 26 26 20 54 _COMPACT_20 && T
4c90: 52 41 43 45 5f 53 48 41 52 45 44 0d 0a 20 20 20 RACE_SHARED..
4ca0: 20 20 20 20 20 20 20 20 20 20 20 74 72 79 0d 0a try..
4cb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d {.
4cc0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
4cd0: 20 20 20 54 72 61 63 65 2e 57 72 69 74 65 4c 69 Trace.WriteLi
4ce0: 6e 65 28 53 74 72 69 6e 67 2e 46 6f 72 6d 61 74 ne(String.Format
4cf0: 28 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 (..
4d00: 20 20 20 20 20 20 20 20 20 43 75 6c 74 75 72 65 Culture
4d10: 49 6e 66 6f 2e 43 75 72 72 65 6e 74 43 75 6c 74 Info.CurrentCult
4d20: 75 72 65 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 ure,..
4d30: 20 20 20 20 20 20 20 20 20 20 20 20 22 4e 61 74 "Nat
4d40: 69 76 65 20 6c 69 62 72 61 72 79 20 70 72 65 2d ive library pre-
4d50: 6c 6f 61 64 65 72 20 66 61 69 6c 65 64 20 74 6f loader failed to
4d60: 20 67 65 74 20 64 69 72 65 63 74 6f 72 79 20 22 get directory "
4d70: 20 2b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 +..
4d80: 20 20 20 20 20 20 20 20 20 20 22 66 6f 72 20 63 "for c
4d90: 75 72 72 65 6e 74 6c 79 20 65 78 65 63 75 74 69 urrently executi
4da0: 6e 67 20 61 73 73 65 6d 62 6c 79 3a 20 7b 30 7d ng assembly: {0}
4db0: 22 2c 20 65 29 29 3b 20 2f 2a 20 74 68 72 6f 77 ", e)); /* throw
4dc0: 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 */..
4dd0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
4de0: 20 20 20 20 63 61 74 63 68 0d 0a 20 20 20 20 20 catch..
4df0: 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 {..
4e00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
4e10: 20 64 6f 20 6e 6f 74 68 69 6e 67 2e 0d 0a 20 20 do nothing...
4e20: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 23 }..#
4e30: 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 20 20 endif..
4e40: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
4e50: 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 0d 0a 20 20 return null;..
4e60: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 23 65 6e }.. #en
4e70: 64 72 65 67 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 dregion....
4e80: 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////////
4e90: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
4ea0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
4eb0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
4ec0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 //////////....
4ed0: 20 20 20 20 23 72 65 67 69 6f 6e 20 4f 70 74 69 #region Opti
4ee0: 6f 6e 61 6c 20 4e 61 74 69 76 65 20 53 51 4c 69 onal Native SQLi
4ef0: 74 65 20 4c 69 62 72 61 72 79 20 50 72 65 2d 4c te Library Pre-L
4f00: 6f 61 64 69 6e 67 20 43 6f 64 65 0d 0a 20 20 20 oading Code..
4f10: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 20 //.. //
4f20: 4e 4f 54 45 3a 20 49 66 20 77 65 20 61 72 65 20 NOTE: If we are
4f30: 6c 6f 6f 6b 69 6e 67 20 66 6f 72 20 74 68 65 20 looking for the
4f40: 73 74 61 6e 64 61 72 64 20 53 51 4c 69 74 65 20 standard SQLite
4f50: 44 4c 4c 20 28 22 73 71 6c 69 74 65 33 2e 64 6c DLL ("sqlite3.dl
4f60: 6c 22 29 2c 0d 0a 20 20 20 20 20 20 2f 2f 20 20 l"),.. //
4f70: 20 20 20 20 20 74 68 65 20 69 6e 74 65 72 6f 70 the interop
4f80: 20 44 4c 4c 20 28 22 53 51 4c 69 74 65 2e 49 6e DLL ("SQLite.In
4f90: 74 65 72 6f 70 2e 64 6c 6c 22 29 2c 20 6f 72 20 terop.dll"), or
4fa0: 77 65 20 61 72 65 20 72 75 6e 6e 69 6e 67 20 6f we are running o
4fb0: 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 2f 2f 20 n the.. //
4fc0: 20 20 20 20 20 20 2e 4e 45 54 20 43 6f 6d 70 61 .NET Compa
4fd0: 63 74 20 46 72 61 6d 65 77 6f 72 6b 2c 20 77 65 ct Framework, we
4fe0: 20 73 68 6f 75 6c 64 20 69 6e 63 6c 75 64 65 20 should include
4ff0: 74 68 69 73 20 63 6f 64 65 20 28 6f 6e 6c 79 20 this code (only
5000: 69 66 20 74 68 65 0d 0a 20 20 20 20 20 20 2f 2f if the.. //
5010: 20 20 20 20 20 20 20 66 65 61 74 75 72 65 20 68 feature h
5020: 61 73 20 61 63 74 75 61 6c 6c 79 20 62 65 65 6e as actually been
5030: 20 65 6e 61 62 6c 65 64 29 2e 20 20 54 68 69 73 enabled). This
5040: 20 63 6f 64 65 20 77 6f 75 6c 64 20 62 65 20 74 code would be t
5050: 6f 74 61 6c 6c 79 0d 0a 20 20 20 20 20 20 2f 2f otally.. //
5060: 20 20 20 20 20 20 20 72 65 64 75 6e 64 61 6e 74 redundant
5070: 20 69 66 20 74 68 69 73 20 6d 6f 64 75 6c 65 20 if this module
5080: 68 61 73 20 62 65 65 6e 20 62 75 6e 64 6c 65 64 has been bundled
5090: 20 69 6e 74 6f 20 74 68 65 20 6d 69 78 65 64 2d into the mixed-
50a0: 6d 6f 64 65 0d 0a 20 20 20 20 20 20 2f 2f 20 20 mode.. //
50b0: 20 20 20 20 20 61 73 73 65 6d 62 6c 79 2e 0d 0a assembly...
50c0: 20 20 20 20 20 20 2f 2f 0d 0a 23 69 66 20 53 51 //..#if SQ
50d0: 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 20 7c 7c LITE_STANDARD ||
50e0: 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f 44 4c 4c USE_INTEROP_DLL
50f0: 20 7c 7c 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d || PLATFORM_COM
5100: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 0d PACTFRAMEWORK...
5110: 0a 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 . //..
5120: 20 2f 2f 20 4e 4f 54 45 3a 20 4f 6e 6c 79 20 63 // NOTE: Only c
5130: 6f 6d 70 69 6c 65 20 69 6e 20 74 68 65 20 6e 61 ompile in the na
5140: 74 69 76 65 20 6c 69 62 72 61 72 79 20 70 72 65 tive library pre
5150: 2d 6c 6f 61 64 20 63 6f 64 65 20 69 66 20 74 68 -load code if th
5160: 65 20 66 65 61 74 75 72 65 0d 0a 20 20 20 20 20 e feature..
5170: 20 2f 2f 20 20 20 20 20 20 20 68 61 73 20 62 65 // has be
5180: 65 6e 20 65 6e 61 62 6c 65 64 20 66 6f 72 20 74 en enabled for t
5190: 68 69 73 20 62 75 69 6c 64 2e 0d 0a 20 20 20 20 his build...
51a0: 20 20 2f 2f 0d 0a 23 69 66 20 50 52 45 4c 4f 41 //..#if PRELOA
51b0: 44 5f 4e 41 54 49 56 45 5f 4c 49 42 52 41 52 59 D_NATIVE_LIBRARY
51c0: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 75 6d .. /// <sum
51d0: 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f mary>.. ///
51e0: 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 The name of the
51f0: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 environment var
5200: 69 61 62 6c 65 20 63 6f 6e 74 61 69 6e 69 6e 67 iable containing
5210: 20 74 68 65 20 70 72 6f 63 65 73 73 6f 72 0d 0a the processor..
5220: 20 20 20 20 20 20 2f 2f 2f 20 61 72 63 68 69 74 /// archit
5230: 65 63 74 75 72 65 20 6f 66 20 74 68 65 20 63 75 ecture of the cu
5240: 72 72 65 6e 74 20 70 72 6f 63 65 73 73 2e 0d 0a rrent process...
5250: 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d /// </summ
5260: 61 72 79 3e 0d 0a 20 20 20 20 20 20 70 72 69 76 ary>.. priv
5270: 61 74 65 20 73 74 61 74 69 63 20 72 65 61 64 6f ate static reado
5280: 6e 6c 79 20 73 74 72 69 6e 67 20 50 52 4f 43 45 nly string PROCE
5290: 53 53 4f 52 5f 41 52 43 48 49 54 45 43 54 55 52 SSOR_ARCHITECTUR
52a0: 45 20 3d 0d 0a 20 20 20 20 20 20 20 20 20 20 22 E =.. "
52b0: 50 52 4f 43 45 53 53 4f 52 5f 41 52 43 48 49 54 PROCESSOR_ARCHIT
52c0: 45 43 54 55 52 45 22 3b 0d 0a 0d 0a 20 20 20 20 ECTURE";....
52d0: 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f //////////////
52e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
52f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5300: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5310: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 20 20 ///////////..
5320: 20 20 20 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e /// <summary>
5330: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 69 73 .. /// This
5340: 20 69 73 20 74 68 65 20 50 2f 49 6e 76 6f 6b 65 is the P/Invoke
5350: 20 6d 65 74 68 6f 64 20 74 68 61 74 20 77 72 61 method that wra
5360: 70 73 20 74 68 65 20 6e 61 74 69 76 65 20 57 69 ps the native Wi
5370: 6e 33 32 20 4c 6f 61 64 4c 69 62 72 61 72 79 0d n32 LoadLibrary.
5380: 0a 20 20 20 20 20 20 2f 2f 2f 20 66 75 6e 63 74 . /// funct
5390: 69 6f 6e 2e 20 20 53 65 65 20 74 68 65 20 4d 53 ion. See the MS
53a0: 44 4e 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e DN documentation
53b0: 20 66 6f 72 20 66 75 6c 6c 20 64 65 74 61 69 6c for full detail
53c0: 73 20 6f 6e 20 77 68 61 74 20 69 74 0d 0a 20 20 s on what it..
53d0: 20 20 20 20 2f 2f 2f 20 64 6f 65 73 2e 0d 0a 20 /// does...
53e0: 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 /// </summa
53f0: 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c ry>.. /// <
5400: 70 61 72 61 6d 20 6e 61 6d 65 3d 22 66 69 6c 65 param name="file
5410: 4e 61 6d 65 22 3e 0d 0a 20 20 20 20 20 20 2f 2f Name">.. //
5420: 2f 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 / The name of th
5430: 65 20 65 78 65 63 75 74 61 62 6c 65 20 6c 69 62 e executable lib
5440: 72 61 72 79 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f rary... ///
5450: 20 3c 2f 70 61 72 61 6d 3e 0d 0a 20 20 20 20 20 </param>..
5460: 20 2f 2f 2f 20 3c 72 65 74 75 72 6e 73 3e 0d 0a /// <returns>..
5470: 20 20 20 20 20 20 2f 2f 2f 20 54 68 65 20 6e 61 /// The na
5480: 74 69 76 65 20 6d 6f 64 75 6c 65 20 68 61 6e 64 tive module hand
5490: 6c 65 20 75 70 6f 6e 20 73 75 63 63 65 73 73 20 le upon success
54a0: 2d 4f 52 2d 20 49 6e 74 50 74 72 2e 5a 65 72 6f -OR- IntPtr.Zero
54b0: 20 6f 6e 20 66 61 69 6c 75 72 65 2e 0d 0a 20 20 on failure...
54c0: 20 20 20 20 2f 2f 2f 20 3c 2f 72 65 74 75 72 6e /// </return
54d0: 73 3e 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 s>..#if !PLATFOR
54e0: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
54f0: 52 4b 0d 0a 20 20 20 20 20 20 5b 44 6c 6c 49 6d RK.. [DllIm
5500: 70 6f 72 74 28 22 6b 65 72 6e 65 6c 33 32 22 2c port("kernel32",
5510: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 20 20 5b ..#else.. [
5520: 44 6c 6c 49 6d 70 6f 72 74 28 22 63 6f 72 65 64 DllImport("cored
5530: 6c 6c 22 2c 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 ll",..#endif..
5540: 20 20 20 20 20 20 20 20 43 61 6c 6c 69 6e 67 43 CallingC
5550: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
5560: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 57 69 ingConvention.Wi
5570: 6e 61 70 69 2c 20 43 68 61 72 53 65 74 20 3d 20 napi, CharSet =
5580: 43 68 61 72 53 65 74 2e 41 75 74 6f 2c 0d 0a 23 CharSet.Auto,..#
5590: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
55a0: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
55b0: 20 20 20 20 20 20 20 20 20 42 65 73 74 46 69 74 BestFit
55c0: 4d 61 70 70 69 6e 67 20 3d 20 66 61 6c 73 65 2c Mapping = false,
55d0: 20 54 68 72 6f 77 4f 6e 55 6e 6d 61 70 70 61 62 ThrowOnUnmappab
55e0: 6c 65 43 68 61 72 20 3d 20 74 72 75 65 2c 0d 0a leChar = true,..
55f0: 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 20 #endif..
5600: 20 20 53 65 74 4c 61 73 74 45 72 72 6f 72 20 3d SetLastError =
5610: 20 74 72 75 65 29 5d 0d 0a 20 20 20 20 20 20 70 true)].. p
5620: 72 69 76 61 74 65 20 73 74 61 74 69 63 20 65 78 rivate static ex
5630: 74 65 72 6e 20 49 6e 74 50 74 72 20 4c 6f 61 64 tern IntPtr Load
5640: 4c 69 62 72 61 72 79 28 73 74 72 69 6e 67 20 66 Library(string f
5650: 69 6c 65 4e 61 6d 65 29 3b 0d 0a 0d 0a 20 20 20 ileName);....
5660: 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////////
5670: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5680: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5690: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
56a0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a ////////////....
56b0: 23 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d #if PLATFORM_COM
56c0: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
56d0: 20 20 20 20 20 2f 2f 2f 20 3c 73 75 6d 6d 61 72 /// <summar
56e0: 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 y>.. /// Th
56f0: 69 73 20 69 73 20 74 68 65 20 50 2f 49 6e 76 6f is is the P/Invo
5700: 6b 65 20 6d 65 74 68 6f 64 20 74 68 61 74 20 77 ke method that w
5710: 72 61 70 73 20 74 68 65 20 6e 61 74 69 76 65 20 raps the native
5720: 57 69 6e 33 32 20 47 65 74 53 79 73 74 65 6d 49 Win32 GetSystemI
5730: 6e 66 6f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 66 nfo.. /// f
5740: 75 6e 63 74 69 6f 6e 2e 20 20 53 65 65 20 74 68 unction. See th
5750: 65 20 4d 53 44 4e 20 64 6f 63 75 6d 65 6e 74 61 e MSDN documenta
5760: 74 69 6f 6e 20 66 6f 72 20 66 75 6c 6c 20 64 65 tion for full de
5770: 74 61 69 6c 73 20 6f 6e 20 77 68 61 74 20 69 74 tails on what it
5780: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 64 6f 65 73 .. /// does
5790: 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 ... /// </s
57a0: 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f ummary>.. /
57b0: 2f 2f 20 3c 70 61 72 61 6d 20 6e 61 6d 65 3d 22 // <param name="
57c0: 73 79 73 74 65 6d 49 6e 66 6f 22 3e 0d 0a 20 20 systemInfo">..
57d0: 20 20 20 20 2f 2f 2f 20 54 68 65 20 73 79 73 74 /// The syst
57e0: 65 6d 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 73 em information s
57f0: 74 72 75 63 74 75 72 65 20 74 6f 20 62 65 20 66 tructure to be f
5800: 69 6c 6c 65 64 20 69 6e 20 62 79 20 74 68 65 20 illed in by the
5810: 66 75 6e 63 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 function...
5820: 20 2f 2f 2f 20 3c 2f 70 61 72 61 6d 3e 0d 0a 20 /// </param>..
5830: 20 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 [DllImport(
5840: 22 63 6f 72 65 64 6c 6c 22 2c 20 43 61 6c 6c 69 "coredll", Calli
5850: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
5860: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
5870: 2e 57 69 6e 61 70 69 29 5d 0d 0a 20 20 20 20 20 .Winapi)]..
5880: 20 70 72 69 76 61 74 65 20 73 74 61 74 69 63 20 private static
5890: 65 78 74 65 72 6e 20 76 6f 69 64 20 47 65 74 53 extern void GetS
58a0: 79 73 74 65 6d 49 6e 66 6f 28 6f 75 74 20 53 59 ystemInfo(out SY
58b0: 53 54 45 4d 5f 49 4e 46 4f 20 73 79 73 74 65 6d STEM_INFO system
58c0: 49 6e 66 6f 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 Info);....
58d0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
58e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
58f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5900: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5910: 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 20 /////////..
5920: 20 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a /// <summary>..
5930: 20 20 20 20 20 20 2f 2f 2f 20 54 68 69 73 20 65 /// This e
5940: 6e 75 6d 65 72 61 74 69 6f 6e 20 63 6f 6e 74 61 numeration conta
5950: 69 6e 73 20 74 68 65 20 70 6f 73 73 69 62 6c 65 ins the possible
5960: 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 values for the
5970: 70 72 6f 63 65 73 73 6f 72 0d 0a 20 20 20 20 20 processor..
5980: 20 2f 2f 2f 20 61 72 63 68 69 74 65 63 74 75 72 /// architectur
5990: 65 20 66 69 65 6c 64 20 6f 66 20 74 68 65 20 73 e field of the s
59a0: 79 73 74 65 6d 20 69 6e 66 6f 72 6d 61 74 69 6f ystem informatio
59b0: 6e 20 73 74 72 75 63 74 75 72 65 2e 0d 0a 20 20 n structure...
59c0: 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 /// </summar
59d0: 79 3e 0d 0a 20 20 20 20 20 20 70 72 69 76 61 74 y>.. privat
59e0: 65 20 65 6e 75 6d 20 50 72 6f 63 65 73 73 6f 72 e enum Processor
59f0: 41 72 63 68 69 74 65 63 74 75 72 65 20 3a 20 75 Architecture : u
5a00: 73 68 6f 72 74 20 2f 2a 20 43 4f 4d 50 41 54 3a short /* COMPAT:
5a10: 20 57 69 6e 33 32 2e 20 2a 2f 0d 0a 20 20 20 20 Win32. */..
5a20: 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 49 {.. I
5a30: 6e 74 65 6c 20 3d 20 30 2c 0d 0a 20 20 20 20 20 ntel = 0,..
5a40: 20 20 20 20 20 4d 49 50 53 20 3d 20 31 2c 0d 0a MIPS = 1,..
5a50: 20 20 20 20 20 20 20 20 20 20 41 6c 70 68 61 20 Alpha
5a60: 3d 20 32 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 = 2,..
5a70: 50 6f 77 65 72 50 43 20 3d 20 33 2c 0d 0a 20 20 PowerPC = 3,..
5a80: 20 20 20 20 20 20 20 20 53 48 78 20 3d 20 34 2c SHx = 4,
5a90: 0d 0a 20 20 20 20 20 20 20 20 20 20 41 52 4d 20 .. ARM
5aa0: 3d 20 35 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 = 5,..
5ab0: 49 41 36 34 20 3d 20 36 2c 0d 0a 20 20 20 20 20 IA64 = 6,..
5ac0: 20 20 20 20 20 41 6c 70 68 61 36 34 20 3d 20 37 Alpha64 = 7
5ad0: 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 4d 53 49 ,.. MSI
5ae0: 4c 20 3d 20 38 2c 0d 0a 20 20 20 20 20 20 20 20 L = 8,..
5af0: 20 20 41 4d 44 36 34 20 3d 20 39 2c 0d 0a 20 20 AMD64 = 9,..
5b00: 20 20 20 20 20 20 20 20 49 41 33 32 5f 6f 6e 5f IA32_on_
5b10: 57 69 6e 36 34 20 3d 20 31 30 2c 0d 0a 20 20 20 Win64 = 10,..
5b20: 20 20 20 20 20 20 20 55 6e 6b 6e 6f 77 6e 20 3d Unknown =
5b30: 20 30 78 46 46 46 46 0d 0a 20 20 20 20 20 20 7d 0xFFFF.. }
5b40: 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f .... //////
5b50: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5b60: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5b70: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5b80: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5b90: 2f 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c ///.. /// <
5ba0: 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 summary>..
5bb0: 2f 2f 2f 20 54 68 69 73 20 73 74 72 75 63 74 75 /// This structu
5bc0: 72 65 20 63 6f 6e 74 61 69 6e 73 20 69 6e 66 6f re contains info
5bd0: 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 74 68 rmation about th
5be0: 65 20 63 75 72 72 65 6e 74 20 63 6f 6d 70 75 74 e current comput
5bf0: 65 72 2e 20 54 68 69 73 0d 0a 20 20 20 20 20 20 er. This..
5c00: 2f 2f 2f 20 69 6e 63 6c 75 64 65 73 20 74 68 65 /// includes the
5c10: 20 70 72 6f 63 65 73 73 6f 72 20 74 79 70 65 2c processor type,
5c20: 20 70 61 67 65 20 73 69 7a 65 2c 20 6d 65 6d 6f page size, memo
5c30: 72 79 20 61 64 64 72 65 73 73 65 73 2c 20 65 74 ry addresses, et
5c40: 63 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f c... /// </
5c50: 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 summary>..
5c60: 5b 53 74 72 75 63 74 4c 61 79 6f 75 74 28 4c 61 [StructLayout(La
5c70: 79 6f 75 74 4b 69 6e 64 2e 53 65 71 75 65 6e 74 youtKind.Sequent
5c80: 69 61 6c 29 5d 0d 0a 20 20 20 20 20 20 70 72 69 ial)].. pri
5c90: 76 61 74 65 20 73 74 72 75 63 74 20 53 59 53 54 vate struct SYST
5ca0: 45 4d 5f 49 4e 46 4f 0d 0a 20 20 20 20 20 20 7b EM_INFO.. {
5cb0: 0d 0a 20 20 20 20 20 20 20 20 20 20 70 75 62 6c .. publ
5cc0: 69 63 20 50 72 6f 63 65 73 73 6f 72 41 72 63 68 ic ProcessorArch
5cd0: 69 74 65 63 74 75 72 65 20 77 50 72 6f 63 65 73 itecture wProces
5ce0: 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 3b sorArchitecture;
5cf0: 0d 0a 20 20 20 20 20 20 20 20 20 20 70 75 62 6c .. publ
5d00: 69 63 20 75 73 68 6f 72 74 20 77 52 65 73 65 72 ic ushort wReser
5d10: 76 65 64 3b 20 2f 2a 20 4e 4f 54 20 55 53 45 44 ved; /* NOT USED
5d20: 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 70 */.. p
5d30: 75 62 6c 69 63 20 75 69 6e 74 20 64 77 50 61 67 ublic uint dwPag
5d40: 65 53 69 7a 65 3b 20 2f 2a 20 4e 4f 54 20 55 53 eSize; /* NOT US
5d50: 45 44 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 ED */..
5d60: 20 70 75 62 6c 69 63 20 49 6e 74 50 74 72 20 6c public IntPtr l
5d70: 70 4d 69 6e 69 6d 75 6d 41 70 70 6c 69 63 61 74 pMinimumApplicat
5d80: 69 6f 6e 41 64 64 72 65 73 73 3b 20 2f 2a 20 4e ionAddress; /* N
5d90: 4f 54 20 55 53 45 44 20 2a 2f 0d 0a 20 20 20 20 OT USED */..
5da0: 20 20 20 20 20 20 70 75 62 6c 69 63 20 49 6e 74 public Int
5db0: 50 74 72 20 6c 70 4d 61 78 69 6d 75 6d 41 70 70 Ptr lpMaximumApp
5dc0: 6c 69 63 61 74 69 6f 6e 41 64 64 72 65 73 73 3b licationAddress;
5dd0: 20 2f 2a 20 4e 4f 54 20 55 53 45 44 20 2a 2f 0d /* NOT USED */.
5de0: 0a 20 20 20 20 20 20 20 20 20 20 70 75 62 6c 69 . publi
5df0: 63 20 75 69 6e 74 20 64 77 41 63 74 69 76 65 50 c uint dwActiveP
5e00: 72 6f 63 65 73 73 6f 72 4d 61 73 6b 3b 20 2f 2a rocessorMask; /*
5e10: 20 4e 4f 54 20 55 53 45 44 20 2a 2f 0d 0a 20 20 NOT USED */..
5e20: 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 75 public u
5e30: 69 6e 74 20 64 77 4e 75 6d 62 65 72 4f 66 50 72 int dwNumberOfPr
5e40: 6f 63 65 73 73 6f 72 73 3b 20 2f 2a 20 4e 4f 54 ocessors; /* NOT
5e50: 20 55 53 45 44 20 2a 2f 0d 0a 20 20 20 20 20 20 USED */..
5e60: 20 20 20 20 70 75 62 6c 69 63 20 75 69 6e 74 20 public uint
5e70: 64 77 50 72 6f 63 65 73 73 6f 72 54 79 70 65 3b dwProcessorType;
5e80: 20 2f 2a 20 4e 4f 54 20 55 53 45 44 20 2a 2f 0d /* NOT USED */.
5e90: 0a 20 20 20 20 20 20 20 20 20 20 70 75 62 6c 69 . publi
5ea0: 63 20 75 69 6e 74 20 64 77 41 6c 6c 6f 63 61 74 c uint dwAllocat
5eb0: 69 6f 6e 47 72 61 6e 75 6c 61 72 69 74 79 3b 20 ionGranularity;
5ec0: 2f 2a 20 4e 4f 54 20 55 53 45 44 20 2a 2f 0d 0a /* NOT USED */..
5ed0: 20 20 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 public
5ee0: 20 75 73 68 6f 72 74 20 77 50 72 6f 63 65 73 73 ushort wProcess
5ef0: 6f 72 4c 65 76 65 6c 3b 20 2f 2a 20 4e 4f 54 20 orLevel; /* NOT
5f00: 55 53 45 44 20 2a 2f 0d 0a 20 20 20 20 20 20 20 USED */..
5f10: 20 20 20 70 75 62 6c 69 63 20 75 73 68 6f 72 74 public ushort
5f20: 20 77 50 72 6f 63 65 73 73 6f 72 52 65 76 69 73 wProcessorRevis
5f30: 69 6f 6e 3b 20 2f 2a 20 4e 4f 54 20 55 53 45 44 ion; /* NOT USED
5f40: 20 2a 2f 0d 0a 20 20 20 20 20 20 7d 0d 0a 23 65 */.. }..#e
5f50: 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f ndif.... //
5f60: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5f70: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5f80: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5f90: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
5fa0: 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 ///////....
5fb0: 20 23 72 65 67 69 6f 6e 20 50 72 69 76 61 74 65 #region Private
5fc0: 20 44 61 74 61 0d 0a 20 20 20 20 20 20 2f 2f 2f Data.. ///
5fd0: 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 <summary>..
5fe0: 20 20 2f 2f 2f 20 54 68 65 20 6e 61 74 69 76 65 /// The native
5ff0: 20 6d 6f 64 75 6c 65 20 66 69 6c 65 20 6e 61 6d module file nam
6000: 65 20 66 6f 72 20 74 68 65 20 6e 61 74 69 76 65 e for the native
6010: 20 53 51 4c 69 74 65 20 6c 69 62 72 61 72 79 20 SQLite library
6020: 6f 72 20 6e 75 6c 6c 2e 0d 0a 20 20 20 20 20 20 or null...
6030: 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a /// </summary>..
6040: 20 20 20 20 20 20 70 72 69 76 61 74 65 20 73 74 private st
6050: 61 74 69 63 20 73 74 72 69 6e 67 20 5f 53 51 4c atic string _SQL
6060: 69 74 65 4e 61 74 69 76 65 4d 6f 64 75 6c 65 46 iteNativeModuleF
6070: 69 6c 65 4e 61 6d 65 20 3d 20 6e 75 6c 6c 3b 0d ileName = null;.
6080: 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f ... ///////
6090: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
60a0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
60b0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
60c0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
60d0: 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 //.. /// <s
60e0: 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f ummary>.. /
60f0: 2f 2f 20 54 68 65 20 6e 61 74 69 76 65 20 6d 6f // The native mo
6100: 64 75 6c 65 20 68 61 6e 64 6c 65 20 66 6f 72 20 dule handle for
6110: 74 68 65 20 6e 61 74 69 76 65 20 53 51 4c 69 74 the native SQLit
6120: 65 20 6c 69 62 72 61 72 79 20 6f 72 20 74 68 65 e library or the
6130: 20 76 61 6c 75 65 0d 0a 20 20 20 20 20 20 2f 2f value.. //
6140: 2f 20 49 6e 74 50 74 72 2e 5a 65 72 6f 2e 0d 0a / IntPtr.Zero...
6150: 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d /// </summ
6160: 61 72 79 3e 0d 0a 20 20 20 20 20 20 70 72 69 76 ary>.. priv
6170: 61 74 65 20 73 74 61 74 69 63 20 49 6e 74 50 74 ate static IntPt
6180: 72 20 5f 53 51 4c 69 74 65 4e 61 74 69 76 65 4d r _SQLiteNativeM
6190: 6f 64 75 6c 65 48 61 6e 64 6c 65 20 3d 20 49 6e oduleHandle = In
61a0: 74 50 74 72 2e 5a 65 72 6f 3b 0d 0a 20 20 20 20 tPtr.Zero;..
61b0: 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 0d 0a #endregion....
61c0: 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f //////////
61d0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
61e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
61f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
6200: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d ///////////////.
6210: 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 75 6d 6d . /// <summ
6220: 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ary>.. ///
6230: 53 65 61 72 63 68 65 73 20 66 6f 72 20 74 68 65 Searches for the
6240: 20 6e 61 74 69 76 65 20 53 51 4c 69 74 65 20 6c native SQLite l
6250: 69 62 72 61 72 79 20 69 6e 20 74 68 65 20 64 69 ibrary in the di
6260: 72 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 rectory containi
6270: 6e 67 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 74 68 ng.. /// th
6280: 65 20 61 73 73 65 6d 62 6c 79 20 63 75 72 72 65 e assembly curre
6290: 6e 74 6c 79 20 62 65 69 6e 67 20 65 78 65 63 75 ntly being execu
62a0: 74 65 64 20 61 73 20 77 65 6c 6c 20 61 73 20 74 ted as well as t
62b0: 68 65 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 he base director
62c0: 79 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 66 6f 72 y.. /// for
62d0: 20 74 68 65 20 63 75 72 72 65 6e 74 20 61 70 70 the current app
62e0: 6c 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 6e 2e lication domain.
62f0: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 .. /// </su
6300: 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f mmary>.. //
6310: 2f 20 3c 70 61 72 61 6d 20 6e 61 6d 65 3d 22 62 / <param name="b
6320: 61 73 65 44 69 72 65 63 74 6f 72 79 22 3e 0d 0a aseDirectory">..
6330: 20 20 20 20 20 20 2f 2f 2f 20 55 70 6f 6e 20 73 /// Upon s
6340: 75 63 63 65 73 73 2c 20 74 68 69 73 20 70 61 72 uccess, this par
6350: 61 6d 65 74 65 72 20 77 69 6c 6c 20 62 65 20 6d ameter will be m
6360: 6f 64 69 66 69 65 64 20 74 6f 20 72 65 66 65 72 odified to refer
6370: 20 74 6f 20 74 68 65 20 62 61 73 65 0d 0a 20 20 to the base..
6380: 20 20 20 20 2f 2f 2f 20 64 69 72 65 63 74 6f 72 /// director
6390: 79 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 y containing the
63a0: 20 6e 61 74 69 76 65 20 53 51 4c 69 74 65 20 6c native SQLite l
63b0: 69 62 72 61 72 79 2e 0d 0a 20 20 20 20 20 20 2f ibrary... /
63c0: 2f 2f 20 3c 2f 70 61 72 61 6d 3e 0d 0a 20 20 20 // </param>..
63d0: 20 20 20 2f 2f 2f 20 3c 70 61 72 61 6d 20 6e 61 /// <param na
63e0: 6d 65 3d 22 70 72 6f 63 65 73 73 6f 72 41 72 63 me="processorArc
63f0: 68 69 74 65 63 74 75 72 65 22 3e 0d 0a 20 20 20 hitecture">..
6400: 20 20 20 2f 2f 2f 20 55 70 6f 6e 20 73 75 63 63 /// Upon succ
6410: 65 73 73 2c 20 74 68 69 73 20 70 61 72 61 6d 65 ess, this parame
6420: 74 65 72 20 77 69 6c 6c 20 62 65 20 6d 6f 64 69 ter will be modi
6430: 66 69 65 64 20 74 6f 20 72 65 66 65 72 20 74 6f fied to refer to
6440: 20 74 68 65 20 6e 61 6d 65 0d 0a 20 20 20 20 20 the name..
6450: 20 2f 2f 2f 20 6f 66 20 74 68 65 20 69 6d 6d 65 /// of the imme
6460: 64 69 61 74 65 20 64 69 72 65 63 74 6f 72 79 20 diate directory
6470: 28 69 2e 65 2e 20 74 68 65 20 6f 66 66 73 65 74 (i.e. the offset
6480: 20 66 72 6f 6d 20 74 68 65 20 62 61 73 65 20 64 from the base d
6490: 69 72 65 63 74 6f 72 79 29 0d 0a 20 20 20 20 20 irectory)..
64a0: 20 2f 2f 2f 20 63 6f 6e 74 61 69 6e 69 6e 67 20 /// containing
64b0: 74 68 65 20 6e 61 74 69 76 65 20 53 51 4c 69 74 the native SQLit
64c0: 65 20 6c 69 62 72 61 72 79 2e 0d 0a 20 20 20 20 e library...
64d0: 20 20 2f 2f 2f 20 3c 2f 70 61 72 61 6d 3e 0d 0a /// </param>..
64e0: 20 20 20 20 20 20 2f 2f 2f 20 3c 72 65 74 75 72 /// <retur
64f0: 6e 73 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 4e ns>.. /// N
6500: 6f 6e 2d 7a 65 72 6f 20 28 73 75 63 63 65 73 73 on-zero (success
6510: 29 20 69 66 20 74 68 65 20 6e 61 74 69 76 65 20 ) if the native
6520: 53 51 4c 69 74 65 20 6c 69 62 72 61 72 79 20 77 SQLite library w
6530: 61 73 20 66 6f 75 6e 64 3b 20 6f 74 68 65 72 77 as found; otherw
6540: 69 73 65 2c 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ise,.. ///
6550: 7a 65 72 6f 20 28 66 61 69 6c 75 72 65 29 2e 0d zero (failure)..
6560: 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 72 65 74 . /// </ret
6570: 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 70 72 69 urns>.. pri
6580: 76 61 74 65 20 73 74 61 74 69 63 20 62 6f 6f 6c vate static bool
6590: 20 53 65 61 72 63 68 46 6f 72 44 69 72 65 63 74 SearchForDirect
65a0: 6f 72 79 28 0d 0a 20 20 20 20 20 20 20 20 20 20 ory(..
65b0: 72 65 66 20 73 74 72 69 6e 67 20 62 61 73 65 44 ref string baseD
65c0: 69 72 65 63 74 6f 72 79 2c 20 20 20 20 20 20 20 irectory,
65d0: 20 2f 2a 20 6f 75 74 20 2a 2f 0d 0a 20 20 20 20 /* out */..
65e0: 20 20 20 20 20 20 72 65 66 20 73 74 72 69 6e 67 ref string
65f0: 20 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 processorArchit
6600: 65 63 74 75 72 65 20 2f 2a 20 6f 75 74 20 2a 2f ecture /* out */
6610: 0d 0a 20 20 20 20 20 20 20 20 20 20 29 0d 0a 20 .. )..
6620: 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
6630: 20 20 69 66 20 28 47 65 74 53 65 74 74 69 6e 67 if (GetSetting
6640: 56 61 6c 75 65 28 0d 0a 20 20 20 20 20 20 20 20 Value(..
6650: 20 20 20 20 20 20 20 20 22 50 72 65 4c 6f 61 64 "PreLoad
6660: 53 51 4c 69 74 65 5f 4e 6f 53 65 61 72 63 68 46 SQLite_NoSearchF
6670: 6f 72 44 69 72 65 63 74 6f 72 79 22 2c 20 6e 75 orDirectory", nu
6680: 6c 6c 29 20 21 3d 20 6e 75 6c 6c 29 0d 0a 20 20 ll) != null)..
6690: 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 {..
66a0: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
66b0: 66 61 6c 73 65 3b 20 2f 2a 20 44 49 53 41 42 4c false; /* DISABL
66c0: 45 44 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 ED */..
66d0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
66e0: 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f //.. //
66f0: 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 NOTE: Build the
6700: 20 6c 69 73 74 20 6f 66 20 62 61 73 65 20 64 69 list of base di
6710: 72 65 63 74 6f 72 69 65 73 20 61 6e 64 20 70 72 rectories and pr
6720: 6f 63 65 73 73 6f 72 2f 70 6c 61 74 66 6f 72 6d ocessor/platform
6730: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 .. //
6740: 20 20 20 20 20 6e 61 6d 65 73 2e 20 20 54 68 65 names. The
6750: 73 65 20 6c 69 73 74 73 20 77 69 6c 6c 20 62 65 se lists will be
6760: 20 75 73 65 64 20 74 6f 20 68 65 6c 70 20 6c 6f used to help lo
6770: 63 61 74 65 20 74 68 65 20 6e 61 74 69 76 65 0d cate the native.
6780: 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 . //
6790: 20 20 20 20 53 51 4c 69 74 65 20 63 6f 72 65 20 SQLite core
67a0: 6c 69 62 72 61 72 79 20 28 6f 72 20 69 6e 74 65 library (or inte
67b0: 72 6f 70 20 61 73 73 65 6d 62 6c 79 29 20 74 6f rop assembly) to
67c0: 20 70 72 65 2d 6c 6f 61 64 20 69 6e 74 6f 0d 0a pre-load into..
67d0: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
67e0: 20 20 20 74 68 69 73 20 70 72 6f 63 65 73 73 2e this process.
67f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a .. //..
6800: 20 20 20 20 20 20 20 20 20 20 73 74 72 69 6e 67 string
6810: 5b 5d 20 64 69 72 65 63 74 6f 72 69 65 73 20 3d [] directories =
6820: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
6830: 20 20 47 65 74 41 73 73 65 6d 62 6c 79 44 69 72 GetAssemblyDir
6840: 65 63 74 6f 72 79 28 29 2c 0d 0a 23 69 66 20 21 ectory(),..#if !
6850: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
6860: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 FRAMEWORK..
6870: 20 20 20 20 20 20 20 20 20 41 70 70 44 6f 6d 61 AppDoma
6880: 69 6e 2e 43 75 72 72 65 6e 74 44 6f 6d 61 69 6e in.CurrentDomain
6890: 2e 42 61 73 65 44 69 72 65 63 74 6f 72 79 2c 0d .BaseDirectory,.
68a0: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 .#endif..
68b0: 20 20 20 7d 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 };....
68c0: 20 20 20 73 74 72 69 6e 67 5b 5d 20 73 75 62 44 string[] subD
68d0: 69 72 65 63 74 6f 72 69 65 73 20 3d 20 7b 0d 0a irectories = {..
68e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 47 65 Ge
68f0: 74 50 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 tProcessorArchit
6900: 65 63 74 75 72 65 28 29 2c 20 47 65 74 50 6c 61 ecture(), GetPla
6910: 74 66 6f 72 6d 4e 61 6d 65 28 6e 75 6c 6c 29 0d tformName(null).
6920: 0a 20 20 20 20 20 20 20 20 20 20 7d 3b 0d 0a 0d . };...
6930: 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 . forea
6940: 63 68 20 28 73 74 72 69 6e 67 20 64 69 72 65 63 ch (string direc
6950: 74 6f 72 79 20 69 6e 20 64 69 72 65 63 74 6f 72 tory in director
6960: 69 65 73 29 0d 0a 20 20 20 20 20 20 20 20 20 20 ies)..
6970: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
6980: 20 69 66 20 28 64 69 72 65 63 74 6f 72 79 20 3d if (directory =
6990: 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 = null)..
69a0: 20 20 20 20 20 20 20 20 20 20 20 63 6f 6e 74 69 conti
69b0: 6e 75 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 nue;....
69c0: 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 28 73 foreach (s
69d0: 74 72 69 6e 67 20 73 75 62 44 69 72 65 63 74 6f tring subDirecto
69e0: 72 79 20 69 6e 20 73 75 62 44 69 72 65 63 74 6f ry in subDirecto
69f0: 72 69 65 73 29 0d 0a 20 20 20 20 20 20 20 20 20 ries)..
6a00: 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
6a10: 20 20 20 20 20 20 20 20 20 20 69 66 20 28 73 75 if (su
6a20: 62 44 69 72 65 63 74 6f 72 79 20 3d 3d 20 6e 75 bDirectory == nu
6a30: 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ll)..
6a40: 20 20 20 20 20 20 20 20 20 20 20 63 6f 6e 74 69 conti
6a50: 6e 75 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 nue;....
6a60: 20 20 20 20 20 20 20 20 20 20 73 74 72 69 6e 67 string
6a70: 20 66 69 6c 65 4e 61 6d 65 20 3d 20 46 69 78 55 fileName = FixU
6a80: 70 44 6c 6c 46 69 6c 65 4e 61 6d 65 28 50 61 74 pDllFileName(Pat
6a90: 68 2e 43 6f 6d 62 69 6e 65 28 0d 0a 20 20 20 20 h.Combine(..
6aa0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6ab0: 20 20 50 61 74 68 2e 43 6f 6d 62 69 6e 65 28 64 Path.Combine(d
6ac0: 69 72 65 63 74 6f 72 79 2c 20 73 75 62 44 69 72 irectory, subDir
6ad0: 65 63 74 6f 72 79 29 2c 20 53 51 4c 49 54 45 5f ectory), SQLITE_
6ae0: 44 4c 4c 29 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 DLL));....
6af0: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a //..
6b00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6b10: 20 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 20 74 68 // NOTE: If th
6b20: 65 20 53 51 4c 69 74 65 20 44 4c 4c 20 66 69 6c e SQLite DLL fil
6b30: 65 20 65 78 69 73 74 73 2c 20 72 65 74 75 72 6e e exists, return
6b40: 20 73 75 63 63 65 73 73 2e 0d 0a 20 20 20 20 20 success...
6b50: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 //
6b60: 20 20 20 20 20 20 50 72 69 6f 72 20 74 6f 20 72 Prior to r
6b70: 65 74 75 72 6e 69 6e 67 2c 20 73 65 74 20 74 68 eturning, set th
6b80: 65 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 e base directory
6b90: 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 20 20 and..
6ba0: 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 //
6bb0: 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 processor archi
6bc0: 74 65 63 74 75 72 65 20 74 6f 20 72 65 66 6c 65 tecture to refle
6bd0: 63 74 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 0d ct the location.
6be0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
6bf0: 20 20 20 2f 2f 20 20 20 20 20 20 20 77 68 65 72 // wher
6c00: 65 20 69 74 20 77 61 73 20 66 6f 75 6e 64 2e 0d e it was found..
6c10: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
6c20: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
6c30: 20 20 20 20 20 20 20 20 20 69 66 20 28 46 69 6c if (Fil
6c40: 65 2e 45 78 69 73 74 73 28 66 69 6c 65 4e 61 6d e.Exists(fileNam
6c50: 65 29 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e))..
6c60: 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 {..
6c70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6c80: 62 61 73 65 44 69 72 65 63 74 6f 72 79 20 3d 20 baseDirectory =
6c90: 64 69 72 65 63 74 6f 72 79 3b 0d 0a 20 20 20 20 directory;..
6ca0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6cb0: 20 20 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 processorArchi
6cc0: 74 65 63 74 75 72 65 20 3d 20 73 75 62 44 69 72 tecture = subDir
6cd0: 65 63 74 6f 72 79 3b 0d 0a 20 20 20 20 20 20 20 ectory;..
6ce0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 r
6cf0: 65 74 75 72 6e 20 74 72 75 65 3b 20 2f 2a 20 46 eturn true; /* F
6d00: 4f 55 4e 44 20 2a 2f 0d 0a 20 20 20 20 20 20 20 OUND */..
6d10: 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
6d20: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
6d30: 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
6d40: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 return f
6d50: 61 6c 73 65 3b 20 2f 2a 20 4e 4f 54 20 46 4f 55 alse; /* NOT FOU
6d60: 4e 44 20 2a 2f 0d 0a 20 20 20 20 20 20 7d 0d 0a ND */.. }..
6d70: 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f .. ////////
6d80: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
6d90: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
6da0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
6db0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
6dc0: 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 75 /.. /// <su
6dd0: 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f mmary>.. //
6de0: 2f 20 51 75 65 72 69 65 73 20 61 6e 64 20 72 65 / Queries and re
6df0: 74 75 72 6e 73 20 74 68 65 20 62 61 73 65 20 64 turns the base d
6e00: 69 72 65 63 74 6f 72 79 20 6f 66 20 74 68 65 20 irectory of the
6e10: 63 75 72 72 65 6e 74 20 61 70 70 6c 69 63 61 74 current applicat
6e20: 69 6f 6e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 64 ion.. /// d
6e30: 6f 6d 61 69 6e 2e 0d 0a 20 20 20 20 20 20 2f 2f omain... //
6e40: 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 / </summary>..
6e50: 20 20 20 20 2f 2f 2f 20 3c 72 65 74 75 72 6e 73 /// <returns
6e60: 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 65 >.. /// The
6e70: 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 20 base directory
6e80: 66 6f 72 20 74 68 65 20 63 75 72 72 65 6e 74 20 for the current
6e90: 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f 6d 61 application doma
6ea0: 69 6e 20 2d 4f 52 2d 20 6e 75 6c 6c 20 69 66 20 in -OR- null if
6eb0: 69 74 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 63 61 it.. /// ca
6ec0: 6e 6e 6f 74 20 62 65 20 64 65 74 65 72 6d 69 6e nnot be determin
6ed0: 65 64 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c ed... /// <
6ee0: 2f 72 65 74 75 72 6e 73 3e 0d 0a 20 20 20 20 20 /returns>..
6ef0: 20 70 72 69 76 61 74 65 20 73 74 61 74 69 63 20 private static
6f00: 73 74 72 69 6e 67 20 47 65 74 42 61 73 65 44 69 string GetBaseDi
6f10: 72 65 63 74 6f 72 79 28 29 0d 0a 20 20 20 20 20 rectory()..
6f20: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f {.. //
6f30: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e .. // N
6f40: 4f 54 45 3a 20 49 66 20 74 68 65 20 22 50 72 65 OTE: If the "Pre
6f50: 4c 6f 61 64 53 51 4c 69 74 65 5f 42 61 73 65 44 LoadSQLite_BaseD
6f60: 69 72 65 63 74 6f 72 79 22 20 65 6e 76 69 72 6f irectory" enviro
6f70: 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 0d 0a nment variable..
6f80: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
6f90: 20 20 20 69 73 20 73 65 74 2c 20 75 73 65 20 69 is set, use i
6fa0: 74 20 76 65 72 62 61 74 69 6d 20 66 6f 72 20 74 t verbatim for t
6fb0: 68 65 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 he base director
6fc0: 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f y... //
6fd0: 0d 0a 20 20 20 20 20 20 20 20 20 20 73 74 72 69 .. stri
6fe0: 6e 67 20 64 69 72 65 63 74 6f 72 79 20 3d 20 47 ng directory = G
6ff0: 65 74 53 65 74 74 69 6e 67 56 61 6c 75 65 28 22 etSettingValue("
7000: 50 72 65 4c 6f 61 64 53 51 4c 69 74 65 5f 42 61 PreLoadSQLite_Ba
7010: 73 65 44 69 72 65 63 74 6f 72 79 22 2c 0d 0a 20 seDirectory",..
7020: 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 75 6c nul
7030: 6c 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 l);....
7040: 20 69 66 20 28 64 69 72 65 63 74 6f 72 79 20 21 if (directory !
7050: 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 = null)..
7060: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 64 69 return di
7070: 72 65 63 74 6f 72 79 3b 0d 0a 0d 0a 23 69 66 20 rectory;....#if
7080: 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
7090: 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
70a0: 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 //..
70b0: 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 20 // NOTE: If
70c0: 74 68 65 20 22 50 72 65 4c 6f 61 64 53 51 4c 69 the "PreLoadSQLi
70d0: 74 65 5f 55 73 65 41 73 73 65 6d 62 6c 79 44 69 te_UseAssemblyDi
70e0: 72 65 63 74 6f 72 79 22 20 65 6e 76 69 72 6f 6e rectory" environ
70f0: 6d 65 6e 74 0d 0a 20 20 20 20 20 20 20 20 20 20 ment..
7100: 2f 2f 20 20 20 20 20 20 20 76 61 72 69 61 62 6c // variabl
7110: 65 20 69 73 20 73 65 74 20 28 74 6f 20 61 6e 79 e is set (to any
7120: 74 68 69 6e 67 29 2c 20 74 68 65 6e 20 61 74 74 thing), then att
7130: 65 6d 70 74 20 74 6f 20 75 73 65 20 74 68 65 0d empt to use the.
7140: 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 . //
7150: 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 63 6f directory co
7160: 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 63 75 72 ntaining the cur
7170: 72 65 6e 74 6c 79 20 65 78 65 63 75 74 69 6e 67 rently executing
7180: 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 assembly..
7190: 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 28 69 // (i
71a0: 2e 65 2e 20 53 79 73 74 65 6d 2e 44 61 74 61 2e .e. System.Data.
71b0: 53 51 4c 69 74 65 29 20 69 6e 74 73 65 61 64 20 SQLite) intsead
71c0: 6f 66 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 of the applicati
71d0: 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f on.. //
71e0: 20 20 20 20 20 20 20 64 6f 6d 61 69 6e 20 62 61 domain ba
71f0: 73 65 20 64 69 72 65 63 74 6f 72 79 2e 0d 0a 20 se directory...
7200: 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 //..
7210: 20 20 20 20 20 20 20 69 66 20 28 47 65 74 53 65 if (GetSe
7220: 74 74 69 6e 67 56 61 6c 75 65 28 0d 0a 20 20 20 ttingValue(..
7230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
7240: 50 72 65 4c 6f 61 64 53 51 4c 69 74 65 5f 55 73 PreLoadSQLite_Us
7250: 65 41 73 73 65 6d 62 6c 79 44 69 72 65 63 74 6f eAssemblyDirecto
7260: 72 79 22 2c 20 6e 75 6c 6c 29 20 21 3d 20 6e 75 ry", null) != nu
7270: 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 20 7b ll).. {
7280: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
7290: 64 69 72 65 63 74 6f 72 79 20 3d 20 47 65 74 41 directory = GetA
72a0: 73 73 65 6d 62 6c 79 44 69 72 65 63 74 6f 72 79 ssemblyDirectory
72b0: 28 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ();....
72c0: 20 20 20 20 20 69 66 20 28 64 69 72 65 63 74 6f if (directo
72d0: 72 79 20 21 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 ry != null)..
72e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 r
72f0: 65 74 75 72 6e 20 64 69 72 65 63 74 6f 72 79 3b eturn directory;
7300: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d .. }...
7310: 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 . //..
7320: 20 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 // NOTE
7330: 3a 20 4f 74 68 65 72 77 69 73 65 2c 20 66 61 6c : Otherwise, fal
7340: 6c 62 61 63 6b 20 6f 6e 20 75 73 69 6e 67 20 74 lback on using t
7350: 68 65 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 he base director
7360: 79 20 6f 66 20 74 68 65 0d 0a 20 20 20 20 20 20 y of the..
7370: 20 20 20 20 2f 2f 20 20 20 20 20 20 20 63 75 72 // cur
7380: 72 65 6e 74 20 61 70 70 6c 69 63 61 74 69 6f 6e rent application
7390: 20 64 6f 6d 61 69 6e 2e 0d 0a 20 20 20 20 20 20 domain...
73a0: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 //..
73b0: 20 20 72 65 74 75 72 6e 20 41 70 70 44 6f 6d 61 return AppDoma
73c0: 69 6e 2e 43 75 72 72 65 6e 74 44 6f 6d 61 69 6e in.CurrentDomain
73d0: 2e 42 61 73 65 44 69 72 65 63 74 6f 72 79 3b 0d .BaseDirectory;.
73e0: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 .#else..
73f0: 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 //..
7400: 2f 2f 20 4e 4f 54 45 3a 20 4f 74 68 65 72 77 69 // NOTE: Otherwi
7410: 73 65 2c 20 66 61 6c 6c 62 61 63 6b 20 6f 6e 20 se, fallback on
7420: 75 73 69 6e 67 20 74 68 65 20 64 69 72 65 63 74 using the direct
7430: 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 0d 0a ory containing..
7440: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
7450: 20 20 20 74 68 65 20 63 75 72 72 65 6e 74 6c 79 the currently
7460: 20 65 78 65 63 75 74 69 6e 67 20 61 73 73 65 6d executing assem
7470: 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 bly...
7480: 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 //.. re
7490: 74 75 72 6e 20 47 65 74 41 73 73 65 6d 62 6c 79 turn GetAssembly
74a0: 44 69 72 65 63 74 6f 72 79 28 29 3b 0d 0a 23 65 Directory();..#e
74b0: 6e 64 69 66 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d ndif.. }...
74c0: 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f . /////////
74d0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
74e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
74f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
7500: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
7510: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 75 6d .. /// <sum
7520: 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f mary>.. ///
7530: 20 44 65 74 65 72 6d 69 6e 65 73 20 69 66 20 74 Determines if t
7540: 68 65 20 64 79 6e 61 6d 69 63 20 6c 69 6e 6b 20 he dynamic link
7550: 6c 69 62 72 61 72 79 20 66 69 6c 65 20 6e 61 6d library file nam
7560: 65 20 72 65 71 75 69 72 65 73 20 61 20 73 75 66 e requires a suf
7570: 66 69 78 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 61 fix.. /// a
7580: 6e 64 20 61 64 64 73 20 69 74 20 69 66 20 6e 65 nd adds it if ne
7590: 63 65 73 73 61 72 79 2e 0d 0a 20 20 20 20 20 20 cessary...
75a0: 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a /// </summary>..
75b0: 20 20 20 20 20 20 2f 2f 2f 20 3c 70 61 72 61 6d /// <param
75c0: 20 6e 61 6d 65 3d 22 66 69 6c 65 4e 61 6d 65 22 name="fileName"
75d0: 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 65 >.. /// The
75e0: 20 6f 72 69 67 69 6e 61 6c 20 64 79 6e 61 6d 69 original dynami
75f0: 63 20 6c 69 6e 6b 20 6c 69 62 72 61 72 79 20 66 c link library f
7600: 69 6c 65 20 6e 61 6d 65 20 74 6f 20 69 6e 73 70 ile name to insp
7610: 65 63 74 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ect... ///
7620: 3c 2f 70 61 72 61 6d 3e 0d 0a 20 20 20 20 20 20 </param>..
7630: 2f 2f 2f 20 3c 72 65 74 75 72 6e 73 3e 0d 0a 20 /// <returns>..
7640: 20 20 20 20 20 2f 2f 2f 20 54 68 65 20 64 79 6e /// The dyn
7650: 61 6d 69 63 20 6c 69 6e 6b 20 6c 69 62 72 61 72 amic link librar
7660: 79 20 66 69 6c 65 20 6e 61 6d 65 2c 20 70 6f 73 y file name, pos
7670: 73 69 62 6c 79 20 6d 6f 64 69 66 69 65 64 20 74 sibly modified t
7680: 6f 20 69 6e 63 6c 75 64 65 20 61 6e 0d 0a 20 20 o include an..
7690: 20 20 20 20 2f 2f 2f 20 65 78 74 65 6e 73 69 6f /// extensio
76a0: 6e 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f n... /// </
76b0: 72 65 74 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 returns>..
76c0: 70 72 69 76 61 74 65 20 73 74 61 74 69 63 20 73 private static s
76d0: 74 72 69 6e 67 20 46 69 78 55 70 44 6c 6c 46 69 tring FixUpDllFi
76e0: 6c 65 4e 61 6d 65 28 0d 0a 20 20 20 20 20 20 20 leName(..
76f0: 20 20 20 73 74 72 69 6e 67 20 66 69 6c 65 4e 61 string fileNa
7700: 6d 65 20 2f 2a 20 69 6e 20 2a 2f 0d 0a 20 20 20 me /* in */..
7710: 20 20 20 20 20 20 20 29 0d 0a 20 20 20 20 20 20 )..
7720: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
7730: 28 21 53 74 72 69 6e 67 2e 49 73 4e 75 6c 6c 4f (!String.IsNullO
7740: 72 45 6d 70 74 79 28 66 69 6c 65 4e 61 6d 65 29 rEmpty(fileName)
7750: 29 0d 0a 20 20 20 20 20 20 20 20 20 20 7b 0d 0a ).. {..
7760: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 6c Pl
7770: 61 74 66 6f 72 6d 49 44 20 70 6c 61 74 66 6f 72 atformID platfor
7780: 6d 49 64 20 3d 20 45 6e 76 69 72 6f 6e 6d 65 6e mId = Environmen
7790: 74 2e 4f 53 56 65 72 73 69 6f 6e 2e 50 6c 61 74 t.OSVersion.Plat
77a0: 66 6f 72 6d 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 form;....
77b0: 20 20 20 20 20 20 20 69 66 20 28 28 70 6c 61 74 if ((plat
77c0: 66 6f 72 6d 49 64 20 3d 3d 20 50 6c 61 74 66 6f formId == Platfo
77d0: 72 6d 49 44 2e 57 69 6e 33 32 53 29 20 7c 7c 0d rmID.Win32S) ||.
77e0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
77f0: 20 20 20 28 70 6c 61 74 66 6f 72 6d 49 64 20 3d (platformId =
7800: 3d 20 50 6c 61 74 66 6f 72 6d 49 44 2e 57 69 6e = PlatformID.Win
7810: 33 32 57 69 6e 64 6f 77 73 29 20 7c 7c 0d 0a 20 32Windows) ||..
7820: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7830: 20 28 70 6c 61 74 66 6f 72 6d 49 64 20 3d 3d 20 (platformId ==
7840: 50 6c 61 74 66 6f 72 6d 49 44 2e 57 69 6e 33 32 PlatformID.Win32
7850: 4e 54 29 20 7c 7c 0d 0a 20 20 20 20 20 20 20 20 NT) ||..
7860: 20 20 20 20 20 20 20 20 20 20 28 70 6c 61 74 66 (platf
7870: 6f 72 6d 49 64 20 3d 3d 20 50 6c 61 74 66 6f 72 ormId == Platfor
7880: 6d 49 44 2e 57 69 6e 43 45 29 29 0d 0a 20 20 20 mID.WinCE))..
7890: 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
78a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
78b0: 69 66 20 28 21 66 69 6c 65 4e 61 6d 65 2e 45 6e if (!fileName.En
78c0: 64 73 57 69 74 68 28 44 6c 6c 46 69 6c 65 45 78 dsWith(DllFileEx
78d0: 74 65 6e 73 69 6f 6e 2c 0d 0a 20 20 20 20 20 20 tension,..
78e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
78f0: 20 20 20 20 53 74 72 69 6e 67 43 6f 6d 70 61 72 StringCompar
7900: 69 73 6f 6e 2e 4f 72 64 69 6e 61 6c 49 67 6e 6f ison.OrdinalIgno
7910: 72 65 43 61 73 65 29 29 0d 0a 20 20 20 20 20 20 reCase))..
7920: 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 {..
7930: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
7940: 20 20 20 20 20 72 65 74 75 72 6e 20 66 69 6c 65 return file
7950: 4e 61 6d 65 20 2b 20 44 6c 6c 46 69 6c 65 45 78 Name + DllFileEx
7960: 74 65 6e 73 69 6f 6e 3b 0d 0a 20 20 20 20 20 20 tension;..
7970: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
7980: 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
7990: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
79a0: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
79b0: 66 69 6c 65 4e 61 6d 65 3b 0d 0a 20 20 20 20 20 fileName;..
79c0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f }.... ////
79d0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
79e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
79f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
7a00: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
7a10: 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f /////.. ///
7a20: 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 <summary>..
7a30: 20 20 2f 2f 2f 20 51 75 65 72 69 65 73 20 61 6e /// Queries an
7a40: 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 70 72 d returns the pr
7a50: 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 63 ocessor architec
7a60: 74 75 72 65 20 6f 66 20 74 68 65 20 63 75 72 72 ture of the curr
7a70: 65 6e 74 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 70 ent.. /// p
7a80: 72 6f 63 65 73 73 2e 0d 0a 20 20 20 20 20 20 2f rocess... /
7a90: 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 // </summary>..
7aa0: 20 20 20 20 20 2f 2f 2f 20 3c 72 65 74 75 72 6e /// <return
7ab0: 73 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 s>.. /// Th
7ac0: 65 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 e processor arch
7ad0: 69 74 65 63 74 75 72 65 20 6f 66 20 74 68 65 20 itecture of the
7ae0: 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 20 current process
7af0: 2d 4f 52 2d 20 6e 75 6c 6c 20 69 66 20 69 74 0d -OR- null if it.
7b00: 0a 20 20 20 20 20 20 2f 2f 2f 20 63 61 6e 6e 6f . /// canno
7b10: 74 20 62 65 20 64 65 74 65 72 6d 69 6e 65 64 2e t be determined.
7b20: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 72 65 .. /// </re
7b30: 74 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 70 72 turns>.. pr
7b40: 69 76 61 74 65 20 73 74 61 74 69 63 20 73 74 72 ivate static str
7b50: 69 6e 67 20 47 65 74 50 72 6f 63 65 73 73 6f 72 ing GetProcessor
7b60: 41 72 63 68 69 74 65 63 74 75 72 65 28 29 0d 0a Architecture()..
7b70: 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 {..
7b80: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
7b90: 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 // NOTE: If the
7ba0: 20 22 50 72 65 4c 6f 61 64 53 51 4c 69 74 65 5f "PreLoadSQLite_
7bb0: 50 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 ProcessorArchite
7bc0: 63 74 75 72 65 22 20 65 6e 76 69 72 6f 6e 6d 65 cture" environme
7bd0: 6e 74 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f nt.. //
7be0: 20 20 20 20 20 20 20 76 61 72 69 61 62 6c 65 20 variable
7bf0: 69 73 20 73 65 74 2c 20 75 73 65 20 69 74 20 76 is set, use it v
7c00: 65 72 62 61 74 69 6d 20 66 6f 72 20 74 68 65 20 erbatim for the
7c10: 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 6f current processo
7c20: 72 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 r.. //
7c30: 20 20 20 20 20 20 61 72 63 68 69 74 65 63 74 75 architectu
7c40: 72 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 2f re... /
7c50: 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 73 74 72 /.. str
7c60: 69 6e 67 20 70 72 6f 63 65 73 73 6f 72 41 72 63 ing processorArc
7c70: 68 69 74 65 63 74 75 72 65 20 3d 20 47 65 74 53 hitecture = GetS
7c80: 65 74 74 69 6e 67 56 61 6c 75 65 28 0d 0a 20 20 ettingValue(..
7c90: 20 20 20 20 20 20 20 20 20 20 20 20 22 50 72 65 "Pre
7ca0: 4c 6f 61 64 53 51 4c 69 74 65 5f 50 72 6f 63 65 LoadSQLite_Proce
7cb0: 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 ssorArchitecture
7cc0: 22 2c 20 6e 75 6c 6c 29 3b 0d 0a 0d 0a 20 20 20 ", null);....
7cd0: 20 20 20 20 20 20 20 69 66 20 28 70 72 6f 63 65 if (proce
7ce0: 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 ssorArchitecture
7cf0: 20 21 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 != null)..
7d00: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
7d10: 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 processorArchite
7d20: 63 74 75 72 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 cture;....
7d30: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 //..
7d40: 20 20 2f 2f 20 42 55 47 42 55 47 3a 20 57 69 6c // BUGBUG: Wil
7d50: 6c 20 74 68 69 73 20 61 6c 77 61 79 73 20 62 65 l this always be
7d60: 20 72 65 6c 69 61 62 6c 65 3f 0d 0a 20 20 20 20 reliable?..
7d70: 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 //..
7d80: 20 20 20 20 70 72 6f 63 65 73 73 6f 72 41 72 63 processorArc
7d90: 68 69 74 65 63 74 75 72 65 20 3d 20 47 65 74 53 hitecture = GetS
7da0: 65 74 74 69 6e 67 56 61 6c 75 65 28 50 52 4f 43 ettingValue(PROC
7db0: 45 53 53 4f 52 5f 41 52 43 48 49 54 45 43 54 55 ESSOR_ARCHITECTU
7dc0: 52 45 2c 20 6e 75 6c 6c 29 3b 0d 0a 0d 0a 20 20 RE, null);....
7dd0: 20 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f ////////
7de0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
7df0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
7e00: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
7e10: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d /////////////...
7e20: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
7e30: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
7e40: 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 . //..
7e50: 20 20 20 20 20 20 20 20 20 2f 2f 20 48 41 43 4b // HACK
7e60: 3a 20 43 68 65 63 6b 20 66 6f 72 20 61 6e 20 22 : Check for an "
7e70: 69 6d 70 6f 73 73 69 62 6c 65 22 20 73 69 74 75 impossible" situ
7e80: 61 74 69 6f 6e 2e 20 20 49 66 20 74 68 65 20 70 ation. If the p
7e90: 6f 69 6e 74 65 72 20 73 69 7a 65 0d 0a 20 20 20 ointer size..
7ea0: 20 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 //
7eb0: 69 73 20 33 32 2d 62 69 74 73 2c 20 74 68 65 20 is 32-bits, the
7ec0: 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 processor archit
7ed0: 65 63 74 75 72 65 20 63 61 6e 6e 6f 74 20 62 65 ecture cannot be
7ee0: 20 22 41 4d 44 36 34 22 2e 0d 0a 20 20 20 20 20 "AMD64"...
7ef0: 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 49 6e // In
7f00: 20 74 68 61 74 20 63 61 73 65 2c 20 77 65 20 61 that case, we a
7f10: 72 65 20 61 6c 6d 6f 73 74 20 63 65 72 74 61 69 re almost certai
7f20: 6e 6c 79 20 68 69 74 74 69 6e 67 20 61 20 62 75 nly hitting a bu
7f30: 67 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 g in the..
7f40: 20 20 20 20 2f 2f 20 20 20 20 20 20 20 6f 70 65 // ope
7f50: 72 61 74 69 6e 67 20 73 79 73 74 65 6d 20 61 6e rating system an
7f60: 64 2f 6f 72 20 56 69 73 75 61 6c 20 53 74 75 64 d/or Visual Stud
7f70: 69 6f 20 74 68 61 74 20 63 61 75 73 65 73 20 74 io that causes t
7f80: 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f he.. //
7f90: 20 20 20 20 20 20 20 50 52 4f 43 45 53 53 4f 52 PROCESSOR
7fa0: 5f 41 52 43 48 49 54 45 43 54 55 52 45 20 65 6e _ARCHITECTURE en
7fb0: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 vironment variab
7fc0: 6c 65 20 74 6f 20 63 6f 6e 74 61 69 6e 20 74 68 le to contain th
7fd0: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 e.. //
7fe0: 20 20 20 20 20 20 77 72 6f 6e 67 20 76 61 6c 75 wrong valu
7ff0: 65 20 69 6e 20 73 6f 6d 65 20 63 69 72 63 75 6d e in some circum
8000: 73 74 61 6e 63 65 73 2e 20 20 50 6c 65 61 73 65 stances. Please
8010: 20 72 65 66 65 72 20 74 6f 20 74 69 63 6b 65 74 refer to ticket
8020: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 .. //
8030: 20 20 20 20 20 5b 39 61 63 39 38 36 32 36 31 31 [9ac9862611
8040: 5d 20 66 6f 72 20 66 75 72 74 68 65 72 20 69 6e ] for further in
8050: 66 6f 72 6d 61 74 69 6f 6e 2e 0d 0a 20 20 20 20 formation...
8060: 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 //..
8070: 20 20 20 20 69 66 20 28 28 49 6e 74 50 74 72 2e if ((IntPtr.
8080: 53 69 7a 65 20 3d 3d 20 73 69 7a 65 6f 66 28 69 Size == sizeof(i
8090: 6e 74 29 29 20 26 26 0d 0a 20 20 20 20 20 20 20 nt)) &&..
80a0: 20 20 20 20 20 20 20 53 74 72 69 6e 67 2e 45 71 String.Eq
80b0: 75 61 6c 73 28 70 72 6f 63 65 73 73 6f 72 41 72 uals(processorAr
80c0: 63 68 69 74 65 63 74 75 72 65 2c 20 22 41 4d 44 chitecture, "AMD
80d0: 36 34 22 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 64",..
80e0: 20 20 20 20 20 20 20 20 53 74 72 69 6e 67 43 6f StringCo
80f0: 6d 70 61 72 69 73 6f 6e 2e 4f 72 64 69 6e 61 6c mparison.Ordinal
8100: 49 67 6e 6f 72 65 43 61 73 65 29 29 0d 0a 20 20 IgnoreCase))..
8110: 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 21 {..#if !
8120: 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 30 20 26 NET_COMPACT_20 &
8130: 26 20 54 52 41 43 45 5f 44 45 54 45 43 54 49 4f & TRACE_DETECTIO
8140: 4e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 N..
8150: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 //..
8160: 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 57 68 65 6e // NOTE: When
8170: 20 74 72 61 63 69 6e 67 20 69 73 20 65 6e 61 62 tracing is enab
8180: 6c 65 64 2c 20 73 61 76 65 20 74 68 65 20 6f 72 led, save the or
8190: 69 67 69 6e 61 6c 6c 79 20 64 65 74 65 63 74 65 iginally detecte
81a0: 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 d..
81b0: 20 2f 2f 20 20 20 20 20 20 20 70 72 6f 63 65 73 // proces
81c0: 73 6f 72 20 61 72 63 68 69 74 65 63 74 75 72 65 sor architecture
81d0: 20 62 65 66 6f 72 65 20 63 68 61 6e 67 69 6e 67 before changing
81e0: 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 it...
81f0: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 //..
8200: 20 20 20 20 20 20 73 74 72 69 6e 67 20 73 61 76 string sav
8210: 65 64 50 72 6f 63 65 73 73 6f 72 41 72 63 68 69 edProcessorArchi
8220: 74 65 63 74 75 72 65 20 3d 20 70 72 6f 63 65 73 tecture = proces
8230: 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 3b sorArchitecture;
8240: 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 ..#endif....
8250: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
8260: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e // N
8270: 4f 54 45 3a 20 57 65 20 6b 6e 6f 77 20 74 68 61 OTE: We know tha
8280: 74 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74 t operating syst
8290: 65 6d 73 20 74 68 61 74 20 72 65 74 75 72 6e 20 ems that return
82a0: 22 41 4d 44 36 34 22 20 61 73 0d 0a 20 20 20 20 "AMD64" as..
82b0: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
82c0: 20 20 20 74 68 65 20 70 72 6f 63 65 73 73 6f 72 the processor
82d0: 20 61 72 63 68 69 74 65 63 74 75 72 65 20 61 72 architecture ar
82e0: 65 20 61 63 74 75 61 6c 6c 79 20 61 20 73 75 70 e actually a sup
82f0: 65 72 73 65 74 20 6f 66 0d 0a 20 20 20 20 20 20 erset of..
8300: 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 //
8310: 20 74 68 65 20 22 78 38 36 22 20 70 72 6f 63 65 the "x86" proce
8320: 73 73 6f 72 20 61 72 63 68 69 74 65 63 74 75 72 ssor architectur
8330: 65 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 72 65 e; therefore, re
8340: 74 75 72 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 turn..
8350: 20 20 20 20 2f 2f 20 20 20 20 20 20 20 22 78 38 // "x8
8360: 36 22 20 77 68 65 6e 20 74 68 65 20 70 6f 69 6e 6" when the poin
8370: 74 65 72 20 73 69 7a 65 20 69 73 20 33 32 2d 62 ter size is 32-b
8380: 69 74 73 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 its...
8390: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 //..
83a0: 20 20 20 20 20 20 70 72 6f 63 65 73 73 6f 72 41 processorA
83b0: 72 63 68 69 74 65 63 74 75 72 65 20 3d 20 22 78 rchitecture = "x
83c0: 38 36 22 3b 0d 0a 0d 0a 23 69 66 20 21 4e 45 54 86";....#if !NET
83d0: 5f 43 4f 4d 50 41 43 54 5f 32 30 20 26 26 20 54 _COMPACT_20 && T
83e0: 52 41 43 45 5f 44 45 54 45 43 54 49 4f 4e 0d 0a RACE_DETECTION..
83f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 tr
8400: 79 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 y..
8410: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
8420: 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 //..
8430: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e // N
8440: 4f 54 45 3a 20 53 68 6f 77 20 74 68 61 74 20 77 OTE: Show that w
8450: 65 20 68 69 74 20 61 20 66 61 69 72 6c 79 20 75 e hit a fairly u
8460: 6e 75 73 75 61 6c 20 73 69 74 75 61 74 69 6f 6e nusual situation
8470: 20 28 69 2e 65 2e 0d 0a 20 20 20 20 20 20 20 20 (i.e...
8480: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
8490: 20 20 20 74 68 65 20 22 77 72 6f 6e 67 22 20 70 the "wrong" p
84a0: 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 rocessor archite
84b0: 63 74 75 72 65 20 77 61 73 20 64 65 74 65 63 74 cture was detect
84c0: 65 64 29 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ed)...
84d0: 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 //..
84e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 72 Tr
84f0: 61 63 65 2e 57 72 69 74 65 4c 69 6e 65 28 53 74 ace.WriteLine(St
8500: 72 69 6e 67 2e 46 6f 72 6d 61 74 28 0d 0a 20 20 ring.Format(..
8510: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8520: 20 20 20 20 43 75 6c 74 75 72 65 49 6e 66 6f 2e CultureInfo.
8530: 43 75 72 72 65 6e 74 43 75 6c 74 75 72 65 2c 0d CurrentCulture,.
8540: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
8550: 20 20 20 20 20 20 20 22 4e 61 74 69 76 65 20 6c "Native l
8560: 69 62 72 61 72 79 20 70 72 65 2d 6c 6f 61 64 65 ibrary pre-loade
8570: 72 20 64 65 74 65 63 74 65 64 20 7b 30 7d 2d 62 r detected {0}-b
8580: 69 74 20 70 6f 69 6e 74 65 72 20 22 20 2b 0d 0a it pointer " +..
8590: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
85a0: 20 20 20 20 20 20 22 73 69 7a 65 20 77 69 74 68 "size with
85b0: 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 processor archi
85c0: 74 65 63 74 75 72 65 20 5c 22 7b 31 7d 5c 22 2c tecture \"{1}\",
85d0: 20 75 73 69 6e 67 20 22 20 2b 0d 0a 20 20 20 20 using " +..
85e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
85f0: 20 20 22 70 72 6f 63 65 73 73 6f 72 20 61 72 63 "processor arc
8600: 68 69 74 65 63 74 75 72 65 20 5c 22 7b 32 7d 5c hitecture \"{2}\
8610: 22 20 69 6e 73 74 65 61 64 2e 2e 2e 22 2c 0d 0a " instead...",..
8620: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8630: 20 20 20 20 20 20 49 6e 74 50 74 72 2e 53 69 7a IntPtr.Siz
8640: 65 20 2a 20 38 20 2f 2a 20 62 69 74 73 20 2a 2f e * 8 /* bits */
8650: 2c 20 73 61 76 65 64 50 72 6f 63 65 73 73 6f 72 , savedProcessor
8660: 41 72 63 68 69 74 65 63 74 75 72 65 2c 0d 0a 20 Architecture,..
8670: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8680: 20 20 20 20 20 70 72 6f 63 65 73 73 6f 72 41 72 processorAr
8690: 63 68 69 74 65 63 74 75 72 65 29 29 3b 20 2f 2a chitecture)); /*
86a0: 20 74 68 72 6f 77 20 2a 2f 0d 0a 20 20 20 20 20 throw */..
86b0: 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
86c0: 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 0d catch.
86d0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b . {
86e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
86f0: 20 20 20 20 2f 2f 20 64 6f 20 6e 6f 74 68 69 6e // do nothin
8700: 67 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 g...
8710: 20 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 }..#endif..
8720: 20 20 20 20 20 20 20 7d 0d 0a 23 65 6c 73 65 0d }..#else.
8730: 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 28 70 . if (p
8740: 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 rocessorArchitec
8750: 74 75 72 65 20 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 ture == null)..
8760: 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 {..
8770: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
8780: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e // N
8790: 4f 54 45 3a 20 4f 6e 20 74 68 65 20 2e 4e 45 54 OTE: On the .NET
87a0: 20 43 6f 6d 70 61 63 74 20 46 72 61 6d 65 77 6f Compact Framewo
87b0: 72 6b 2c 20 61 74 74 65 6d 70 74 20 74 6f 20 75 rk, attempt to u
87c0: 73 65 20 74 68 65 20 6e 61 74 69 76 65 0d 0a 20 se the native..
87d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 //
87e0: 20 20 20 20 20 20 57 69 6e 33 32 20 41 50 49 20 Win32 API
87f0: 66 75 6e 63 74 69 6f 6e 20 28 76 69 61 20 50 2f function (via P/
8800: 49 6e 76 6f 6b 65 29 20 74 68 61 74 20 63 61 6e Invoke) that can
8810: 20 70 72 6f 76 69 64 65 20 75 73 0d 0a 20 20 20 provide us..
8820: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 //
8830: 20 20 20 20 77 69 74 68 20 74 68 65 20 70 72 6f with the pro
8840: 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 63 74 cessor architect
8850: 75 72 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ure...
8860: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 //..
8870: 20 20 20 20 20 20 74 72 79 0d 0a 20 20 20 20 20 try..
8880: 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 {..
8890: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
88a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
88b0: 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 54 68 65 // NOTE: The
88c0: 20 6f 75 74 70 75 74 20 6f 66 20 74 68 65 20 47 output of the G
88d0: 65 74 53 79 73 74 65 6d 49 6e 66 6f 20 66 75 6e etSystemInfo fun
88e0: 63 74 69 6f 6e 20 77 69 6c 6c 20 62 65 0d 0a 20 ction will be..
88f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8900: 20 2f 2f 20 20 20 20 20 20 20 70 6c 61 63 65 64 // placed
8910: 20 68 65 72 65 2e 20 20 4f 6e 6c 79 20 74 68 65 here. Only the
8920: 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 processor archi
8930: 74 65 63 74 75 72 65 20 66 69 65 6c 64 0d 0a 20 tecture field..
8940: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8950: 20 2f 2f 20 20 20 20 20 20 20 69 73 20 75 73 65 // is use
8960: 64 20 62 79 20 74 68 69 73 20 6d 65 74 68 6f 64 d by this method
8970: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
8980: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 //..
8990: 20 20 20 20 20 20 20 20 20 20 20 53 59 53 54 45 SYSTE
89a0: 4d 5f 49 4e 46 4f 20 73 79 73 74 65 6d 49 6e 66 M_INFO systemInf
89b0: 6f 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 o;....
89c0: 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 //..
89d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
89e0: 20 4e 4f 54 45 3a 20 51 75 65 72 79 20 74 68 65 NOTE: Query the
89f0: 20 73 79 73 74 65 6d 20 69 6e 66 6f 72 6d 61 74 system informat
8a00: 69 6f 6e 20 76 69 61 20 50 2f 49 6e 76 6f 6b 65 ion via P/Invoke
8a10: 2c 20 74 68 75 73 0d 0a 20 20 20 20 20 20 20 20 , thus..
8a20: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
8a30: 20 20 20 66 69 6c 6c 69 6e 67 20 74 68 65 20 73 filling the s
8a40: 74 72 75 63 74 75 72 65 2e 0d 0a 20 20 20 20 20 tructure...
8a50: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d //.
8a60: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
8a70: 20 20 20 47 65 74 53 79 73 74 65 6d 49 6e 66 6f GetSystemInfo
8a80: 28 6f 75 74 20 73 79 73 74 65 6d 49 6e 66 6f 29 (out systemInfo)
8a90: 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ;....
8aa0: 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 //..
8ab0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 //
8ac0: 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 68 65 NOTE: Return the
8ad0: 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 processor archi
8ae0: 74 65 63 74 75 72 65 20 76 61 6c 75 65 20 61 73 tecture value as
8af0: 20 61 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 a string...
8b00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
8b10: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
8b20: 20 20 20 20 70 72 6f 63 65 73 73 6f 72 41 72 63 processorArc
8b30: 68 69 74 65 63 74 75 72 65 20 3d 0d 0a 20 20 20 hitecture =..
8b40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8b50: 20 20 20 73 79 73 74 65 6d 49 6e 66 6f 2e 77 50 systemInfo.wP
8b60: 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 rocessorArchitec
8b70: 74 75 72 65 2e 54 6f 53 74 72 69 6e 67 28 29 3b ture.ToString();
8b80: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
8b90: 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 }..
8ba0: 20 63 61 74 63 68 0d 0a 20 20 20 20 20 20 20 20 catch..
8bb0: 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 {..
8bc0: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 64 6f // do
8bd0: 20 6e 6f 74 68 69 6e 67 2e 0d 0a 20 20 20 20 20 nothing...
8be0: 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
8bf0: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a //..
8c00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
8c10: 20 4e 4f 54 45 3a 20 55 70 6f 6e 20 66 61 69 6c NOTE: Upon fail
8c20: 75 72 65 2c 20 72 65 74 75 72 6e 20 61 6e 20 65 ure, return an e
8c30: 6d 70 74 79 20 73 74 72 69 6e 67 2e 20 20 54 68 mpty string. Th
8c40: 69 73 20 77 69 6c 6c 20 70 72 65 76 65 6e 74 0d is will prevent.
8c50: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f . /
8c60: 2f 20 20 20 20 20 20 20 74 68 65 20 63 61 6c 6c / the call
8c70: 69 6e 67 20 6d 65 74 68 6f 64 20 66 72 6f 6d 20 ing method from
8c80: 63 6f 6e 73 69 64 65 72 69 6e 67 20 74 68 69 73 considering this
8c90: 20 6d 65 74 68 6f 64 20 63 61 6c 6c 20 61 0d 0a method call a..
8ca0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
8cb0: 20 20 20 20 20 20 20 22 66 61 69 6c 75 72 65 22 "failure"
8cc0: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
8cd0: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 //..
8ce0: 20 20 20 70 72 6f 63 65 73 73 6f 72 41 72 63 68 processorArch
8cf0: 69 74 65 63 74 75 72 65 20 3d 20 53 74 72 69 6e itecture = Strin
8d00: 67 2e 45 6d 70 74 79 3b 0d 0a 20 20 20 20 20 20 g.Empty;..
8d10: 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a 0d }..#endif...
8d20: 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 2f 2f 2f . /////
8d30: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
8d40: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
8d50: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
8d60: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
8d70: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 .... re
8d80: 74 75 72 6e 20 70 72 6f 63 65 73 73 6f 72 41 72 turn processorAr
8d90: 63 68 69 74 65 63 74 75 72 65 3b 0d 0a 20 20 20 chitecture;..
8da0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f }.... //
8db0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
8dc0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
8dd0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
8de0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
8df0: 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 20 20 2f ///////.. /
8e00: 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 // <summary>..
8e10: 20 20 20 20 2f 2f 2f 20 47 69 76 65 6e 20 74 68 /// Given th
8e20: 65 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 e processor arch
8e30: 69 74 65 63 74 75 72 65 2c 20 72 65 74 75 72 6e itecture, return
8e40: 73 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 s the name of th
8e50: 65 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a 20 20 20 e platform...
8e60: 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 /// </summary
8e70: 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 70 61 >.. /// <pa
8e80: 72 61 6d 20 6e 61 6d 65 3d 22 70 72 6f 63 65 73 ram name="proces
8e90: 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 22 sorArchitecture"
8ea0: 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 65 >.. /// The
8eb0: 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 processor archi
8ec0: 74 65 63 74 75 72 65 20 74 6f 20 62 65 20 74 72 tecture to be tr
8ed0: 61 6e 73 6c 61 74 65 64 20 74 6f 20 61 20 70 6c anslated to a pl
8ee0: 61 74 66 6f 72 6d 20 6e 61 6d 65 2e 0d 0a 20 20 atform name...
8ef0: 20 20 20 20 2f 2f 2f 20 3c 2f 70 61 72 61 6d 3e /// </param>
8f00: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 72 65 74 .. /// <ret
8f10: 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f urns>.. ///
8f20: 20 54 68 65 20 70 6c 61 74 66 6f 72 6d 20 6e 61 The platform na
8f30: 6d 65 20 66 6f 72 20 74 68 65 20 73 70 65 63 69 me for the speci
8f40: 66 69 65 64 20 70 72 6f 63 65 73 73 6f 72 20 61 fied processor a
8f50: 72 63 68 69 74 65 63 74 75 72 65 20 2d 4f 52 2d rchitecture -OR-
8f60: 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 2f 2f 2f null.. ///
8f70: 20 69 66 20 69 74 20 63 61 6e 6e 6f 74 20 62 65 if it cannot be
8f80: 20 64 65 74 65 72 6d 69 6e 65 64 2e 0d 0a 20 20 determined...
8f90: 20 20 20 20 2f 2f 2f 20 3c 2f 72 65 74 75 72 6e /// </return
8fa0: 73 3e 0d 0a 20 20 20 20 20 20 70 72 69 76 61 74 s>.. privat
8fb0: 65 20 73 74 61 74 69 63 20 73 74 72 69 6e 67 20 e static string
8fc0: 47 65 74 50 6c 61 74 66 6f 72 6d 4e 61 6d 65 28 GetPlatformName(
8fd0: 0d 0a 20 20 20 20 20 20 20 20 20 20 73 74 72 69 .. stri
8fe0: 6e 67 20 70 72 6f 63 65 73 73 6f 72 41 72 63 68 ng processorArch
8ff0: 69 74 65 63 74 75 72 65 20 2f 2a 20 69 6e 20 2a itecture /* in *
9000: 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 29 0d 0a /.. )..
9010: 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 {..
9020: 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 6f 72 if (processor
9030: 41 72 63 68 69 74 65 63 74 75 72 65 20 3d 3d 20 Architecture ==
9040: 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 null)..
9050: 20 20 20 20 20 70 72 6f 63 65 73 73 6f 72 41 72 processorAr
9060: 63 68 69 74 65 63 74 75 72 65 20 3d 20 47 65 74 chitecture = Get
9070: 50 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 ProcessorArchite
9080: 63 74 75 72 65 28 29 3b 0d 0a 0d 0a 20 20 20 20 cture();....
9090: 20 20 20 20 20 20 69 66 20 28 53 74 72 69 6e 67 if (String
90a0: 2e 49 73 4e 75 6c 6c 4f 72 45 6d 70 74 79 28 70 .IsNullOrEmpty(p
90b0: 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 rocessorArchitec
90c0: 74 75 72 65 29 29 0d 0a 20 20 20 20 20 20 20 20 ture))..
90d0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 75 6c return nul
90e0: 6c 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 l;....
90f0: 6c 6f 63 6b 20 28 73 74 61 74 69 63 53 79 6e 63 lock (staticSync
9100: 52 6f 6f 74 29 0d 0a 20 20 20 20 20 20 20 20 20 Root)..
9110: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
9120: 20 20 69 66 20 28 70 72 6f 63 65 73 73 6f 72 41 if (processorA
9130: 72 63 68 69 74 65 63 74 75 72 65 50 6c 61 74 66 rchitecturePlatf
9140: 6f 72 6d 73 20 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 orms == null)..
9150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9160: 20 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 0d 0a 0d return null;...
9170: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 . s
9180: 74 72 69 6e 67 20 70 6c 61 74 66 6f 72 6d 4e 61 tring platformNa
9190: 6d 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 me;....
91a0: 20 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 if (process
91b0: 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 50 6c orArchitecturePl
91c0: 61 74 66 6f 72 6d 73 2e 54 72 79 47 65 74 56 61 atforms.TryGetVa
91d0: 6c 75 65 28 0d 0a 20 20 20 20 20 20 20 20 20 20 lue(..
91e0: 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 proc
91f0: 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 essorArchitectur
9200: 65 2c 20 6f 75 74 20 70 6c 61 74 66 6f 72 6d 4e e, out platformN
9210: 61 6d 65 29 29 0d 0a 20 20 20 20 20 20 20 20 20 ame))..
9220: 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
9230: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
9240: 20 70 6c 61 74 66 6f 72 6d 4e 61 6d 65 3b 0d 0a platformName;..
9250: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
9260: 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
9270: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
9280: 20 6e 75 6c 6c 3b 0d 0a 20 20 20 20 20 20 7d 0d null;.. }.
9290: 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f ... ///////
92a0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
92b0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
92c0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
92d0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
92e0: 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 //.. /// <s
92f0: 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f ummary>.. /
9300: 2f 2f 20 41 74 74 65 6d 70 74 73 20 74 6f 20 6c // Attempts to l
9310: 6f 61 64 20 74 68 65 20 6e 61 74 69 76 65 20 53 oad the native S
9320: 51 4c 69 74 65 20 6c 69 62 72 61 72 79 20 62 61 QLite library ba
9330: 73 65 64 20 6f 6e 20 74 68 65 20 73 70 65 63 69 sed on the speci
9340: 66 69 65 64 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 fied.. ///
9350: 64 69 72 65 63 74 6f 72 79 20 61 6e 64 20 70 72 directory and pr
9360: 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 63 ocessor architec
9370: 74 75 72 65 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f ture... ///
9380: 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 </summary>..
9390: 20 20 20 2f 2f 2f 20 3c 70 61 72 61 6d 20 6e 61 /// <param na
93a0: 6d 65 3d 22 62 61 73 65 44 69 72 65 63 74 6f 72 me="baseDirector
93b0: 79 22 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 y">.. /// T
93c0: 68 65 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 he base director
93d0: 79 20 74 6f 20 75 73 65 2c 20 6e 75 6c 6c 20 66 y to use, null f
93e0: 6f 72 20 64 65 66 61 75 6c 74 20 28 74 68 65 20 or default (the
93f0: 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 20 6f base directory o
9400: 66 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 74 68 65 f.. /// the
9410: 20 63 75 72 72 65 6e 74 20 61 70 70 6c 69 63 61 current applica
9420: 74 69 6f 6e 20 64 6f 6d 61 69 6e 29 2e 20 20 54 tion domain). T
9430: 68 69 73 20 64 69 72 65 63 74 6f 72 79 20 73 68 his directory sh
9440: 6f 75 6c 64 20 63 6f 6e 74 61 69 6e 20 74 68 65 ould contain the
9450: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 70 72 6f 63 .. /// proc
9460: 65 73 73 6f 72 20 61 72 63 68 69 74 65 63 74 75 essor architectu
9470: 72 65 20 73 70 65 63 69 66 69 63 20 73 75 62 2d re specific sub-
9480: 64 69 72 65 63 74 6f 72 69 65 73 2e 0d 0a 20 20 directories...
9490: 20 20 20 20 2f 2f 2f 20 3c 2f 70 61 72 61 6d 3e /// </param>
94a0: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 70 61 72 .. /// <par
94b0: 61 6d 20 6e 61 6d 65 3d 22 70 72 6f 63 65 73 73 am name="process
94c0: 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 22 3e orArchitecture">
94d0: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 65 20 .. /// The
94e0: 72 65 71 75 65 73 74 65 64 20 70 72 6f 63 65 73 requested proces
94f0: 73 6f 72 20 61 72 63 68 69 74 65 63 74 75 72 65 sor architecture
9500: 2c 20 6e 75 6c 6c 20 66 6f 72 20 64 65 66 61 75 , null for defau
9510: 6c 74 20 28 74 68 65 0d 0a 20 20 20 20 20 20 2f lt (the.. /
9520: 2f 2f 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 // processor arc
9530: 68 69 74 65 63 74 75 72 65 20 6f 66 20 74 68 65 hitecture of the
9540: 20 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 current process
9550: 29 2e 20 20 54 68 69 73 20 63 61 6c 6c 65 72 20 ). This caller
9560: 73 68 6f 75 6c 64 0d 0a 20 20 20 20 20 20 2f 2f should.. //
9570: 2f 20 61 6c 6d 6f 73 74 20 61 6c 77 61 79 73 20 / almost always
9580: 73 70 65 63 69 66 79 20 6e 75 6c 6c 20 66 6f 72 specify null for
9590: 20 74 68 69 73 20 70 61 72 61 6d 65 74 65 72 2e this parameter.
95a0: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 70 61 .. /// </pa
95b0: 72 61 6d 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ram>.. ///
95c0: 3c 70 61 72 61 6d 20 6e 61 6d 65 3d 22 6e 61 74 <param name="nat
95d0: 69 76 65 4d 6f 64 75 6c 65 46 69 6c 65 4e 61 6d iveModuleFileNam
95e0: 65 22 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 e">.. /// T
95f0: 68 65 20 63 61 6e 64 69 64 61 74 65 20 6e 61 74 he candidate nat
9600: 69 76 65 20 6d 6f 64 75 6c 65 20 66 69 6c 65 20 ive module file
9610: 6e 61 6d 65 20 74 6f 20 6c 6f 61 64 20 77 69 6c name to load wil
9620: 6c 20 62 65 20 73 74 6f 72 65 64 20 68 65 72 65 l be stored here
9630: 2c 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 69 66 20 ,.. /// if
9640: 6e 65 63 65 73 73 61 72 79 2e 0d 0a 20 20 20 20 necessary...
9650: 20 20 2f 2f 2f 20 3c 2f 70 61 72 61 6d 3e 0d 0a /// </param>..
9660: 20 20 20 20 20 20 2f 2f 2f 20 3c 70 61 72 61 6d /// <param
9670: 20 6e 61 6d 65 3d 22 6e 61 74 69 76 65 4d 6f 64 name="nativeMod
9680: 75 6c 65 48 61 6e 64 6c 65 22 3e 0d 0a 20 20 20 uleHandle">..
9690: 20 20 20 2f 2f 2f 20 54 68 65 20 6e 61 74 69 76 /// The nativ
96a0: 65 20 6d 6f 64 75 6c 65 20 68 61 6e 64 6c 65 20 e module handle
96b0: 61 73 20 72 65 74 75 72 6e 65 64 20 62 79 20 4c as returned by L
96c0: 6f 61 64 4c 69 62 72 61 72 79 20 77 69 6c 6c 20 oadLibrary will
96d0: 62 65 20 73 74 6f 72 65 64 0d 0a 20 20 20 20 20 be stored..
96e0: 20 2f 2f 2f 20 68 65 72 65 2c 20 69 66 20 6e 65 /// here, if ne
96f0: 63 65 73 73 61 72 79 2e 20 20 54 68 69 73 20 76 cessary. This v
9700: 61 6c 75 65 20 77 69 6c 6c 20 62 65 20 49 6e 74 alue will be Int
9710: 50 74 72 2e 5a 65 72 6f 20 69 66 20 74 68 65 20 Ptr.Zero if the
9720: 63 61 6c 6c 20 74 6f 0d 0a 20 20 20 20 20 20 2f call to.. /
9730: 2f 2f 20 4c 6f 61 64 4c 69 62 72 61 72 79 20 66 // LoadLibrary f
9740: 61 69 6c 73 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f ails... ///
9750: 20 3c 2f 70 61 72 61 6d 3e 0d 0a 20 20 20 20 20 </param>..
9760: 20 2f 2f 2f 20 3c 72 65 74 75 72 6e 73 3e 0d 0a /// <returns>..
9770: 20 20 20 20 20 20 2f 2f 2f 20 4e 6f 6e 2d 7a 65 /// Non-ze
9780: 72 6f 20 69 66 20 74 68 65 20 6e 61 74 69 76 65 ro if the native
9790: 20 6d 6f 64 75 6c 65 20 77 61 73 20 6c 6f 61 64 module was load
97a0: 65 64 20 73 75 63 63 65 73 73 66 75 6c 6c 79 3b ed successfully;
97b0: 20 6f 74 68 65 72 77 69 73 65 2c 0d 0a 20 20 20 otherwise,..
97c0: 20 20 20 2f 2f 2f 20 7a 65 72 6f 2e 0d 0a 20 20 /// zero...
97d0: 20 20 20 20 2f 2f 2f 20 3c 2f 72 65 74 75 72 6e /// </return
97e0: 73 3e 0d 0a 20 20 20 20 20 20 70 72 69 76 61 74 s>.. privat
97f0: 65 20 73 74 61 74 69 63 20 62 6f 6f 6c 20 50 72 e static bool Pr
9800: 65 4c 6f 61 64 53 51 4c 69 74 65 44 6c 6c 28 0d eLoadSQLiteDll(.
9810: 0a 20 20 20 20 20 20 20 20 20 20 73 74 72 69 6e . strin
9820: 67 20 62 61 73 65 44 69 72 65 63 74 6f 72 79 2c g baseDirectory,
9830: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 69 /* i
9840: 6e 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 n */..
9850: 73 74 72 69 6e 67 20 70 72 6f 63 65 73 73 6f 72 string processor
9860: 41 72 63 68 69 74 65 63 74 75 72 65 2c 20 20 20 Architecture,
9870: 20 2f 2a 20 69 6e 20 2a 2f 0d 0a 20 20 20 20 20 /* in */..
9880: 20 20 20 20 20 72 65 66 20 73 74 72 69 6e 67 20 ref string
9890: 6e 61 74 69 76 65 4d 6f 64 75 6c 65 46 69 6c 65 nativeModuleFile
98a0: 4e 61 6d 65 2c 20 2f 2a 20 6f 75 74 20 2a 2f 0d Name, /* out */.
98b0: 0a 20 20 20 20 20 20 20 20 20 20 72 65 66 20 49 . ref I
98c0: 6e 74 50 74 72 20 6e 61 74 69 76 65 4d 6f 64 75 ntPtr nativeModu
98d0: 6c 65 48 61 6e 64 6c 65 20 20 20 20 2f 2a 20 6f leHandle /* o
98e0: 75 74 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 ut */..
98f0: 20 29 0d 0a 20 20 20 20 20 20 7b 0d 0a 20 20 20 ).. {..
9900: 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 //..
9910: 20 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 // NOTE: If
9920: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 62 the specified b
9930: 61 73 65 20 64 69 72 65 63 74 6f 72 79 20 69 73 ase directory is
9940: 20 6e 75 6c 6c 2c 20 75 73 65 20 74 68 65 20 64 null, use the d
9950: 65 66 61 75 6c 74 0d 0a 20 20 20 20 20 20 20 20 efault..
9960: 20 20 2f 2f 20 20 20 20 20 20 20 28 69 2e 65 2e // (i.e.
9970: 20 61 74 74 65 6d 70 74 20 74 6f 20 61 75 74 6f attempt to auto
9980: 6d 61 74 69 63 61 6c 6c 79 20 64 65 74 65 63 74 matically detect
9990: 20 69 74 29 2e 0d 0a 20 20 20 20 20 20 20 20 20 it)...
99a0: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 69 //.. i
99b0: 66 20 28 62 61 73 65 44 69 72 65 63 74 6f 72 79 f (baseDirectory
99c0: 20 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 == null)..
99d0: 20 20 20 20 20 20 20 20 20 62 61 73 65 44 69 72 baseDir
99e0: 65 63 74 6f 72 79 20 3d 20 47 65 74 42 61 73 65 ectory = GetBase
99f0: 44 69 72 65 63 74 6f 72 79 28 29 3b 0d 0a 0d 0a Directory();....
9a00: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
9a10: 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 3a // NOTE:
9a20: 20 49 66 20 77 65 20 66 61 69 6c 65 64 20 74 6f If we failed to
9a30: 20 71 75 65 72 79 20 74 68 65 20 62 61 73 65 20 query the base
9a40: 64 69 72 65 63 74 6f 72 79 2c 20 73 74 6f 70 20 directory, stop
9a50: 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 now...
9a60: 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 //.. if
9a70: 20 28 62 61 73 65 44 69 72 65 63 74 6f 72 79 20 (baseDirectory
9a80: 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 == null)..
9a90: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 return f
9aa0: 61 6c 73 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 alse;....
9ab0: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
9ac0: 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 // NOTE: If the
9ad0: 20 6e 61 74 69 76 65 20 53 51 4c 69 74 65 20 6c native SQLite l
9ae0: 69 62 72 61 72 79 20 65 78 69 73 74 73 20 69 6e ibrary exists in
9af0: 20 74 68 65 20 62 61 73 65 20 64 69 72 65 63 74 the base direct
9b00: 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 20 20 2f ory.. /
9b10: 2f 20 20 20 20 20 20 20 69 74 73 65 6c 66 2c 20 / itself,
9b20: 73 74 6f 70 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 stop now...
9b30: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 //..
9b40: 20 20 20 73 74 72 69 6e 67 20 66 69 6c 65 4e 61 string fileNa
9b50: 6d 65 20 3d 20 46 69 78 55 70 44 6c 6c 46 69 6c me = FixUpDllFil
9b60: 65 4e 61 6d 65 28 50 61 74 68 2e 43 6f 6d 62 69 eName(Path.Combi
9b70: 6e 65 28 62 61 73 65 44 69 72 65 63 74 6f 72 79 ne(baseDirectory
9b80: 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ,..
9b90: 20 53 51 4c 49 54 45 5f 44 4c 4c 29 29 3b 0d 0a SQLITE_DLL));..
9ba0: 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 28 .. if (
9bb0: 46 69 6c 65 2e 45 78 69 73 74 73 28 66 69 6c 65 File.Exists(file
9bc0: 4e 61 6d 65 29 29 0d 0a 20 20 20 20 20 20 20 20 Name))..
9bd0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c return fal
9be0: 73 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 se;....
9bf0: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 2f //.. /
9c00: 2f 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 73 / NOTE: If the s
9c10: 70 65 63 69 66 69 65 64 20 70 72 6f 63 65 73 73 pecified process
9c20: 6f 72 20 61 72 63 68 69 74 65 63 74 75 72 65 20 or architecture
9c30: 69 73 20 6e 75 6c 6c 2c 20 75 73 65 20 74 68 65 is null, use the
9c40: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 .. //
9c50: 20 20 20 20 20 64 65 66 61 75 6c 74 2e 0d 0a 20 default...
9c60: 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 //..
9c70: 20 20 20 20 20 20 20 69 66 20 28 70 72 6f 63 65 if (proce
9c80: 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 ssorArchitecture
9c90: 20 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 == null)..
9ca0: 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 73 73 process
9cb0: 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 20 3d orArchitecture =
9cc0: 20 47 65 74 50 72 6f 63 65 73 73 6f 72 41 72 63 GetProcessorArc
9cd0: 68 69 74 65 63 74 75 72 65 28 29 3b 0d 0a 0d 0a hitecture();....
9ce0: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
9cf0: 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 3a // NOTE:
9d00: 20 49 66 20 77 65 20 66 61 69 6c 65 64 20 74 6f If we failed to
9d10: 20 71 75 65 72 79 20 74 68 65 20 70 72 6f 63 65 query the proce
9d20: 73 73 6f 72 20 61 72 63 68 69 74 65 63 74 75 72 ssor architectur
9d30: 65 2c 20 73 74 6f 70 20 6e 6f 77 2e 0d 0a 20 20 e, stop now...
9d40: 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 //..
9d50: 20 20 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 if (proces
9d60: 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 20 sorArchitecture
9d70: 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 == null)..
9d80: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 return f
9d90: 61 6c 73 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 alse;....
9da0: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
9db0: 20 2f 2f 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 // NOTE: Build
9dc0: 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 61 6e the full path an
9dd0: 64 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 d file name for
9de0: 74 68 65 20 6e 61 74 69 76 65 20 53 51 4c 69 74 the native SQLit
9df0: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 e.. //
9e00: 20 20 20 20 20 20 6c 69 62 72 61 72 79 20 75 73 library us
9e10: 69 6e 67 20 74 68 65 20 70 72 6f 63 65 73 73 6f ing the processo
9e20: 72 20 61 72 63 68 69 74 65 63 74 75 72 65 20 6e r architecture n
9e30: 61 6d 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ame...
9e40: 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 66 69 //.. fi
9e50: 6c 65 4e 61 6d 65 20 3d 20 46 69 78 55 70 44 6c leName = FixUpDl
9e60: 6c 46 69 6c 65 4e 61 6d 65 28 50 61 74 68 2e 43 lFileName(Path.C
9e70: 6f 6d 62 69 6e 65 28 50 61 74 68 2e 43 6f 6d 62 ombine(Path.Comb
9e80: 69 6e 65 28 62 61 73 65 44 69 72 65 63 74 6f 72 ine(baseDirector
9e90: 79 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 y,..
9ea0: 20 20 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 processorArchi
9eb0: 74 65 63 74 75 72 65 29 2c 20 53 51 4c 49 54 45 tecture), SQLITE
9ec0: 5f 44 4c 4c 29 29 3b 0d 0a 0d 0a 20 20 20 20 20 _DLL));....
9ed0: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 //..
9ee0: 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 20 74 // NOTE: If t
9ef0: 68 65 20 66 69 6c 65 20 6e 61 6d 65 20 62 61 73 he file name bas
9f00: 65 64 20 6f 6e 20 74 68 65 20 70 72 6f 63 65 73 ed on the proces
9f10: 73 6f 72 20 61 72 63 68 69 74 65 63 74 75 72 65 sor architecture
9f20: 20 6e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 name..
9f30: 20 2f 2f 20 69 73 20 6e 6f 74 20 66 6f 75 6e 64 // is not found
9f40: 2c 20 74 72 79 20 75 73 69 6e 67 20 74 68 65 20 , try using the
9f50: 61 73 73 6f 63 69 61 74 65 64 20 70 6c 61 74 66 associated platf
9f60: 6f 72 6d 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 orm name...
9f70: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 //..
9f80: 20 20 20 69 66 20 28 21 46 69 6c 65 2e 45 78 69 if (!File.Exi
9f90: 73 74 73 28 66 69 6c 65 4e 61 6d 65 29 29 0d 0a sts(fileName))..
9fa0: 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 {..
9fb0: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 //..
9fc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 //
9fd0: 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f NOTE: Attempt to
9fe0: 20 74 72 61 6e 73 6c 61 74 65 20 74 68 65 20 70 translate the p
9ff0: 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 rocessor archite
a000: 63 74 75 72 65 20 74 6f 20 61 0d 0a 20 20 20 20 cture to a..
a010: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
a020: 20 20 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d 65 platform name
a030: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
a040: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 //..
a050: 20 20 20 73 74 72 69 6e 67 20 70 6c 61 74 66 6f string platfo
a060: 72 6d 4e 61 6d 65 20 3d 20 47 65 74 50 6c 61 74 rmName = GetPlat
a070: 66 6f 72 6d 4e 61 6d 65 28 70 72 6f 63 65 73 73 formName(process
a080: 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 29 3b orArchitecture);
a090: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
a0a0: 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 //..
a0b0: 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 20 // NOTE: If
a0c0: 77 65 20 66 61 69 6c 65 64 20 74 6f 20 74 72 61 we failed to tra
a0d0: 6e 73 6c 61 74 65 20 74 68 65 20 70 6c 61 74 66 nslate the platf
a0e0: 6f 72 6d 20 6e 61 6d 65 2c 20 73 74 6f 70 20 6e orm name, stop n
a0f0: 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ow...
a100: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
a110: 20 20 20 20 20 69 66 20 28 70 6c 61 74 66 6f 72 if (platfor
a120: 6d 4e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 0d 0a mName == null)..
a130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
a140: 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 3b 0d return false;.
a150: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
a160: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 //..
a170: 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 42 75 69 6c // NOTE: Buil
a180: 64 20 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 d the full path
a190: 61 6e 64 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f and file name fo
a1a0: 72 20 74 68 65 20 6e 61 74 69 76 65 20 53 51 4c r the native SQL
a1b0: 69 74 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ite..
a1c0: 20 20 20 2f 2f 20 20 20 20 20 20 20 6c 69 62 72 // libr
a1d0: 61 72 79 20 75 73 69 6e 67 20 74 68 65 20 70 6c ary using the pl
a1e0: 61 74 66 6f 72 6d 20 6e 61 6d 65 2e 0d 0a 20 20 atform name...
a1f0: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a //..
a200: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 69 fi
a210: 6c 65 4e 61 6d 65 20 3d 20 46 69 78 55 70 44 6c leName = FixUpDl
a220: 6c 46 69 6c 65 4e 61 6d 65 28 50 61 74 68 2e 43 lFileName(Path.C
a230: 6f 6d 62 69 6e 65 28 50 61 74 68 2e 43 6f 6d 62 ombine(Path.Comb
a240: 69 6e 65 28 0d 0a 20 20 20 20 20 20 20 20 20 20 ine(..
a250: 20 20 20 20 20 20 20 20 62 61 73 65 44 69 72 65 baseDire
a260: 63 74 6f 72 79 2c 20 70 6c 61 74 66 6f 72 6d 4e ctory, platformN
a270: 61 6d 65 29 2c 20 53 51 4c 49 54 45 5f 44 4c 4c ame), SQLITE_DLL
a280: 29 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ));....
a290: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 //..
a2a0: 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 // NOTE:
a2b0: 49 66 20 74 68 65 20 66 69 6c 65 20 64 6f 65 73 If the file does
a2c0: 20 6e 6f 74 20 65 78 69 73 74 2c 20 73 6b 69 70 not exist, skip
a2d0: 20 74 72 79 69 6e 67 20 74 6f 20 6c 6f 61 64 20 trying to load
a2e0: 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 it...
a2f0: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
a300: 20 20 20 20 20 69 66 20 28 21 46 69 6c 65 2e 45 if (!File.E
a310: 78 69 73 74 73 28 66 69 6c 65 4e 61 6d 65 29 29 xists(fileName))
a320: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
a330: 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 return false
a340: 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ;.. }..
a350: 0d 0a 20 20 20 20 20 20 20 20 20 20 74 72 79 0d .. try.
a360: 0a 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 . {..#i
a370: 66 20 21 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 f !NET_COMPACT_2
a380: 30 20 26 26 20 54 52 41 43 45 5f 50 52 45 4c 4f 0 && TRACE_PRELO
a390: 41 44 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 AD..
a3a0: 20 20 74 72 79 0d 0a 20 20 20 20 20 20 20 20 20 try..
a3b0: 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
a3c0: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
a3d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
a3e0: 2f 2f 20 4e 4f 54 45 3a 20 53 68 6f 77 20 65 78 // NOTE: Show ex
a3f0: 61 63 74 6c 79 20 77 68 65 72 65 20 77 65 20 61 actly where we a
a400: 72 65 20 74 72 79 69 6e 67 20 74 6f 20 6c 6f 61 re trying to loa
a410: 64 20 74 68 65 20 6e 61 74 69 76 65 0d 0a 20 20 d the native..
a420: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
a430: 2f 2f 20 20 20 20 20 20 20 53 51 4c 69 74 65 20 // SQLite
a440: 6c 69 62 72 61 72 79 20 66 72 6f 6d 2e 0d 0a 20 library from...
a450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
a460: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 //..
a470: 20 20 20 20 20 20 20 54 72 61 63 65 2e 57 72 69 Trace.Wri
a480: 74 65 4c 69 6e 65 28 53 74 72 69 6e 67 2e 46 6f teLine(String.Fo
a490: 72 6d 61 74 28 0d 0a 20 20 20 20 20 20 20 20 20 rmat(..
a4a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 43 75 6c Cul
a4b0: 74 75 72 65 49 6e 66 6f 2e 43 75 72 72 65 6e 74 tureInfo.Current
a4c0: 43 75 6c 74 75 72 65 2c 0d 0a 20 20 20 20 20 20 Culture,..
a4d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
a4e0: 22 4e 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 "Native library
a4f0: 70 72 65 2d 6c 6f 61 64 65 72 20 69 73 20 74 72 pre-loader is tr
a500: 79 69 6e 67 20 74 6f 20 6c 6f 61 64 20 6e 61 74 ying to load nat
a510: 69 76 65 20 22 20 2b 0d 0a 20 20 20 20 20 20 20 ive " +..
a520: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
a530: 53 51 4c 69 74 65 20 6c 69 62 72 61 72 79 20 5c SQLite library \
a540: 22 7b 30 7d 5c 22 2e 2e 2e 22 2c 20 66 69 6c 65 "{0}\"...", file
a550: 4e 61 6d 65 29 29 3b 20 2f 2a 20 74 68 72 6f 77 Name)); /* throw
a560: 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 */..
a570: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
a580: 20 20 20 20 63 61 74 63 68 0d 0a 20 20 20 20 20 catch..
a590: 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 {..
a5a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
a5b0: 20 64 6f 20 6e 6f 74 68 69 6e 67 2e 0d 0a 20 20 do nothing...
a5c0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 23 }..#
a5d0: 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 20 20 20 endif....
a5e0: 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 //..
a5f0: 20 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 // NOTE
a600: 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 6c 6f 61 : Attempt to loa
a610: 64 20 74 68 65 20 6e 61 74 69 76 65 20 6c 69 62 d the native lib
a620: 72 61 72 79 2e 20 20 54 68 69 73 20 77 69 6c 6c rary. This will
a630: 20 65 69 74 68 65 72 0d 0a 20 20 20 20 20 20 20 either..
a640: 20 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 //
a650: 72 65 74 75 72 6e 20 61 20 76 61 6c 69 64 20 6e return a valid n
a660: 61 74 69 76 65 20 6d 6f 64 75 6c 65 20 68 61 6e ative module han
a670: 64 6c 65 2c 20 72 65 74 75 72 6e 20 49 6e 74 50 dle, return IntP
a680: 74 72 2e 5a 65 72 6f 2c 0d 0a 20 20 20 20 20 20 tr.Zero,..
a690: 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 //
a6a0: 20 6f 72 20 74 68 72 6f 77 20 61 6e 20 65 78 63 or throw an exc
a6b0: 65 70 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 20 eption...
a6c0: 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 //..
a6d0: 20 20 20 20 20 20 20 20 20 6e 61 74 69 76 65 4d nativeM
a6e0: 6f 64 75 6c 65 46 69 6c 65 4e 61 6d 65 20 3d 20 oduleFileName =
a6f0: 66 69 6c 65 4e 61 6d 65 3b 0d 0a 20 20 20 20 20 fileName;..
a700: 20 20 20 20 20 20 20 20 20 6e 61 74 69 76 65 4d nativeM
a710: 6f 64 75 6c 65 48 61 6e 64 6c 65 20 3d 20 4c 6f oduleHandle = Lo
a720: 61 64 4c 69 62 72 61 72 79 28 66 69 6c 65 4e 61 adLibrary(fileNa
a730: 6d 65 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 me);....
a740: 20 20 20 20 20 20 72 65 74 75 72 6e 20 28 6e 61 return (na
a750: 74 69 76 65 4d 6f 64 75 6c 65 48 61 6e 64 6c 65 tiveModuleHandle
a760: 20 21 3d 20 49 6e 74 50 74 72 2e 5a 65 72 6f 29 != IntPtr.Zero)
a770: 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ;.. }..
a780: 23 69 66 20 21 4e 45 54 5f 43 4f 4d 50 41 43 54 #if !NET_COMPACT
a790: 5f 32 30 20 26 26 20 54 52 41 43 45 5f 50 52 45 _20 && TRACE_PRE
a7a0: 4c 4f 41 44 0d 0a 20 20 20 20 20 20 20 20 20 20 LOAD..
a7b0: 63 61 74 63 68 20 28 45 78 63 65 70 74 69 6f 6e catch (Exception
a7c0: 20 65 29 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 e)..#else..
a7d0: 20 20 20 20 20 20 63 61 74 63 68 20 28 45 78 63 catch (Exc
a7e0: 65 70 74 69 6f 6e 29 0d 0a 23 65 6e 64 69 66 0d eption)..#endif.
a7f0: 0a 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 . {..#i
a800: 66 20 21 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 f !NET_COMPACT_2
a810: 30 20 26 26 20 54 52 41 43 45 5f 50 52 45 4c 4f 0 && TRACE_PRELO
a820: 41 44 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 AD..
a830: 20 20 74 72 79 0d 0a 20 20 20 20 20 20 20 20 20 try..
a840: 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
a850: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
a860: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
a870: 2f 2f 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c 20 // NOTE: First,
a880: 67 72 61 62 20 74 68 65 20 6c 61 73 74 20 57 69 grab the last Wi
a890: 6e 33 32 20 65 72 72 6f 72 20 6e 75 6d 62 65 72 n32 error number
a8a0: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
a8b0: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 //..
a8c0: 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 6c int l
a8d0: 61 73 74 45 72 72 6f 72 20 3d 20 4d 61 72 73 68 astError = Marsh
a8e0: 61 6c 2e 47 65 74 4c 61 73 74 57 69 6e 33 32 45 al.GetLastWin32E
a8f0: 72 72 6f 72 28 29 3b 20 2f 2a 20 74 68 72 6f 77 rror(); /* throw
a900: 20 2a 2f 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 */....
a910: 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 //..
a920: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f /
a930: 2f 20 4e 4f 54 45 3a 20 53 68 6f 77 20 77 68 65 / NOTE: Show whe
a940: 72 65 20 77 65 20 66 61 69 6c 65 64 20 74 6f 20 re we failed to
a950: 6c 6f 61 64 20 74 68 65 20 6e 61 74 69 76 65 20 load the native
a960: 53 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 SQLite..
a970: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
a980: 20 20 20 6c 69 62 72 61 72 79 20 66 72 6f 6d 20 library from
a990: 61 6c 6f 6e 67 20 77 69 74 68 20 74 68 65 20 57 along with the W
a9a0: 69 6e 33 32 20 65 72 72 6f 72 20 63 6f 64 65 20 in32 error code
a9b0: 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 and..
a9c0: 20 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 //
a9d0: 65 78 63 65 70 74 69 6f 6e 20 69 6e 66 6f 72 6d exception inform
a9e0: 61 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 20 20 ation...
a9f0: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
aa00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
aa10: 54 72 61 63 65 2e 57 72 69 74 65 4c 69 6e 65 28 Trace.WriteLine(
aa20: 53 74 72 69 6e 67 2e 46 6f 72 6d 61 74 28 0d 0a String.Format(..
aa30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
aa40: 20 20 20 20 20 20 43 75 6c 74 75 72 65 49 6e 66 CultureInf
aa50: 6f 2e 43 75 72 72 65 6e 74 43 75 6c 74 75 72 65 o.CurrentCulture
aa60: 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ,..
aa70: 20 20 20 20 20 20 20 20 20 22 4e 61 74 69 76 65 "Native
aa80: 20 6c 69 62 72 61 72 79 20 70 72 65 2d 6c 6f 61 library pre-loa
aa90: 64 65 72 20 66 61 69 6c 65 64 20 74 6f 20 6c 6f der failed to lo
aaa0: 61 64 20 6e 61 74 69 76 65 20 22 20 2b 0d 0a 20 ad native " +..
aab0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
aac0: 20 20 20 20 20 22 53 51 4c 69 74 65 20 6c 69 62 "SQLite lib
aad0: 72 61 72 79 20 5c 22 7b 30 7d 5c 22 20 28 67 65 rary \"{0}\" (ge
aae0: 74 4c 61 73 74 45 72 72 6f 72 20 3d 20 7b 31 7d tLastError = {1}
aaf0: 29 3a 20 7b 32 7d 22 2c 0d 0a 20 20 20 20 20 20 ): {2}",..
ab00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
ab10: 66 69 6c 65 4e 61 6d 65 2c 20 6c 61 73 74 45 72 fileName, lastEr
ab20: 72 6f 72 2c 20 65 29 29 3b 20 2f 2a 20 74 68 72 ror, e)); /* thr
ab30: 6f 77 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 ow */..
ab40: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
ab50: 20 20 20 20 20 20 63 61 74 63 68 0d 0a 20 20 20 catch..
ab60: 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
ab70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
ab80: 2f 2f 20 64 6f 20 6e 6f 74 68 69 6e 67 2e 0d 0a // do nothing...
ab90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
aba0: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 .#endif..
abb0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
abc0: 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 3b 0d return false;.
abd0: 0a 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 . }..#endif
abe0: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 ..#endif..
abf0: 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 0d 0a 20 20 #endregion....
ac00: 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////
ac10: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
ac20: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
ac30: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
ac40: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d /////////////...
ac50: 0a 23 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 4f .#if PLATFORM_CO
ac60: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
ac70: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 2f 2f 20 4e //.. // N
ac80: 4f 54 45 3a 20 4f 6e 20 74 68 65 20 2e 4e 45 54 OTE: On the .NET
ac90: 20 43 6f 6d 70 61 63 74 20 46 72 61 6d 65 77 6f Compact Framewo
aca0: 72 6b 2c 20 74 68 65 20 6e 61 74 69 76 65 20 69 rk, the native i
acb0: 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 nterop assembly
acc0: 6d 75 73 74 0d 0a 20 20 20 20 2f 2f 20 20 20 20 must.. //
acd0: 20 20 20 62 65 20 75 73 65 64 20 62 65 63 61 75 be used becau
ace0: 73 65 20 69 74 20 70 72 6f 76 69 64 65 73 20 73 se it provides s
acf0: 65 76 65 72 61 6c 20 77 6f 72 6b 61 72 6f 75 6e everal workaroun
ad00: 64 73 20 74 6f 20 2e 4e 45 54 20 43 6f 6d 70 61 ds to .NET Compa
ad10: 63 74 0d 0a 20 20 20 20 2f 2f 20 20 20 20 20 20 ct.. //
ad20: 20 46 72 61 6d 65 77 6f 72 6b 20 6c 69 6d 69 74 Framework limit
ad30: 61 74 69 6f 6e 73 20 69 6d 70 6f 72 74 61 6e 74 ations important
ad40: 20 66 6f 72 20 70 72 6f 70 65 72 20 6f 70 65 72 for proper oper
ad50: 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f 72 ation of the cor
ad60: 65 0d 0a 20 20 20 20 2f 2f 20 20 20 20 20 20 20 e.. //
ad70: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
ad80: 74 65 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 te functionality
ad90: 20 28 65 2e 67 2e 20 62 65 69 6e 67 20 61 62 6c (e.g. being abl
ada0: 65 20 74 6f 20 62 69 6e 64 0d 0a 20 20 20 20 2f e to bind.. /
adb0: 2f 20 20 20 20 20 20 20 70 61 72 61 6d 65 74 65 / paramete
adc0: 72 73 20 61 6e 64 20 68 61 6e 64 6c 65 20 63 6f rs and handle co
add0: 6c 75 6d 6e 20 76 61 6c 75 65 73 20 6f 66 20 74 lumn values of t
ade0: 79 70 65 73 20 49 6e 74 36 34 20 61 6e 64 20 44 ypes Int64 and D
adf0: 6f 75 62 6c 65 29 2e 0d 0a 20 20 20 20 2f 2f 0d ouble)... //.
ae00: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 63 6f . internal co
ae10: 6e 73 74 20 73 74 72 69 6e 67 20 53 51 4c 49 54 nst string SQLIT
ae20: 45 5f 44 4c 4c 20 3d 20 22 53 51 4c 69 74 65 2e E_DLL = "SQLite.
ae30: 49 6e 74 65 72 6f 70 2e 30 39 38 2e 64 6c 6c 22 Interop.098.dll"
ae40: 3b 0d 0a 23 65 6c 69 66 20 53 51 4c 49 54 45 5f ;..#elif SQLITE_
ae50: 53 54 41 4e 44 41 52 44 0d 0a 20 20 20 20 2f 2f STANDARD.. //
ae60: 0d 0a 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 4f .. // NOTE: O
ae70: 74 68 65 72 77 69 73 65 2c 20 69 66 20 74 68 65 therwise, if the
ae80: 20 73 74 61 6e 64 61 72 64 20 53 51 4c 69 74 65 standard SQLite
ae90: 20 6c 69 62 72 61 72 79 20 69 73 20 65 6e 61 62 library is enab
aea0: 6c 65 64 2c 20 75 73 65 20 69 74 2e 0d 0a 20 20 led, use it...
aeb0: 20 20 2f 2f 0d 0a 20 20 20 20 69 6e 74 65 72 6e //.. intern
aec0: 61 6c 20 63 6f 6e 73 74 20 73 74 72 69 6e 67 20 al const string
aed0: 53 51 4c 49 54 45 5f 44 4c 4c 20 3d 20 22 73 71 SQLITE_DLL = "sq
aee0: 6c 69 74 65 33 22 3b 0d 0a 23 65 6c 69 66 20 55 lite3";..#elif U
aef0: 53 45 5f 49 4e 54 45 52 4f 50 5f 44 4c 4c 0d 0a SE_INTEROP_DLL..
af00: 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 2f 2f //.. //
af10: 20 4e 4f 54 45 3a 20 4f 74 68 65 72 77 69 73 65 NOTE: Otherwise
af20: 2c 20 69 66 20 74 68 65 20 6e 61 74 69 76 65 20 , if the native
af30: 53 51 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 SQLite interop a
af40: 73 73 65 6d 62 6c 79 20 69 73 20 65 6e 61 62 6c ssembly is enabl
af50: 65 64 2c 0d 0a 20 20 20 20 2f 2f 20 20 20 20 20 ed,.. //
af60: 20 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 2f use it... /
af70: 2f 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 /.. internal
af80: 63 6f 6e 73 74 20 73 74 72 69 6e 67 20 53 51 4c const string SQL
af90: 49 54 45 5f 44 4c 4c 20 3d 20 22 53 51 4c 69 74 ITE_DLL = "SQLit
afa0: 65 2e 49 6e 74 65 72 6f 70 2e 64 6c 6c 22 3b 0d e.Interop.dll";.
afb0: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 2f 2f 0d 0a .#else.. //..
afc0: 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 46 69 6e // NOTE: Fin
afd0: 61 6c 6c 79 2c 20 61 73 73 75 6d 65 20 74 68 61 ally, assume tha
afe0: 74 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 t the mixed-mode
aff0: 20 61 73 73 65 6d 62 6c 79 20 69 73 20 62 65 69 assembly is bei
b000: 6e 67 20 75 73 65 64 2e 0d 0a 20 20 20 20 2f 2f ng used... //
b010: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 63 .. internal c
b020: 6f 6e 73 74 20 73 74 72 69 6e 67 20 53 51 4c 49 onst string SQLI
b030: 54 45 5f 44 4c 4c 20 3d 20 22 53 79 73 74 65 6d TE_DLL = "System
b040: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c .Data.SQLite.dll
b050: 22 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 ";..#endif....
b060: 20 20 2f 2f 20 54 68 69 73 20 73 65 63 74 69 6f // This sectio
b070: 6e 20 75 73 65 73 20 69 6e 74 65 72 6f 70 20 63 n uses interop c
b080: 61 6c 6c 73 20 74 68 61 74 20 61 6c 73 6f 20 66 alls that also f
b090: 65 74 63 68 20 74 65 78 74 20 6c 65 6e 67 74 68 etch text length
b0a0: 20 74 6f 20 6f 70 74 69 6d 69 7a 65 20 63 6f 6e to optimize con
b0b0: 76 65 72 73 69 6f 6e 2e 0d 0a 20 20 20 20 2f 2f version... //
b0c0: 20 57 68 65 6e 20 75 73 69 6e 67 20 74 68 65 20 When using the
b0d0: 73 74 61 6e 64 61 72 64 20 64 6c 6c 2c 20 77 65 standard dll, we
b0e0: 20 63 61 6e 20 72 65 70 6c 61 63 65 20 74 68 65 can replace the
b0f0: 73 65 20 63 61 6c 6c 73 20 77 69 74 68 20 6e 6f se calls with no
b100: 72 6d 61 6c 20 73 71 6c 69 74 65 20 63 61 6c 6c rmal sqlite call
b110: 73 20 61 6e 64 0d 0a 20 20 20 20 2f 2f 20 64 6f s and.. // do
b120: 20 75 6e 6f 70 74 69 6d 69 7a 65 64 20 63 6f 6e unoptimized con
b130: 76 65 72 73 69 6f 6e 73 20 69 6e 73 74 65 61 64 versions instead
b140: 20 61 66 74 65 72 77 61 72 64 73 0d 0a 20 20 20 afterwards..
b150: 20 23 72 65 67 69 6f 6e 20 69 6e 74 65 72 6f 70 #region interop
b160: 20 61 64 64 65 64 20 74 65 78 74 6c 65 6e 67 74 added textlengt
b170: 68 20 63 61 6c 6c 73 0d 0a 0d 0a 23 69 66 20 21 h calls....#if !
b180: 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 0d SQLITE_STANDARD.
b190: 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 ... [DllImpor
b1a0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
b1b0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
b1c0: 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 tic extern IntPt
b1d0: 72 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 70 r sqlite3_bind_p
b1e0: 61 72 61 6d 65 74 65 72 5f 6e 61 6d 65 5f 69 6e arameter_name_in
b1f0: 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d terop(IntPtr stm
b200: 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 72 65 t, int index, re
b210: 66 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 f int len);....
b220: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
b230: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
b240: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
b250: 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 extern IntPtr sq
b260: 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 64 61 74 lite3_column_dat
b270: 61 62 61 73 65 5f 6e 61 6d 65 5f 69 6e 74 65 72 abase_name_inter
b280: 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 op(IntPtr stmt,
b290: 69 6e 74 20 69 6e 64 65 78 2c 20 72 65 66 20 69 int index, ref i
b2a0: 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 nt len);....
b2b0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
b2c0: 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 E_DLL)].. int
b2d0: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
b2e0: 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 ern IntPtr sqlit
b2f0: 65 33 5f 63 6f 6c 75 6d 6e 5f 64 61 74 61 62 61 e3_column_databa
b300: 73 65 5f 6e 61 6d 65 31 36 5f 69 6e 74 65 72 6f se_name16_intero
b310: 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 p(IntPtr stmt, i
b320: 6e 74 20 69 6e 64 65 78 2c 20 72 65 66 20 69 6e nt index, ref in
b330: 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b t len);.... [
b340: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
b350: 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 _DLL)].. inte
b360: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
b370: 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 rn IntPtr sqlite
b380: 33 5f 63 6f 6c 75 6d 6e 5f 64 65 63 6c 74 79 70 3_column_decltyp
b390: 65 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 e_interop(IntPtr
b3a0: 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 stmt, int index
b3b0: 2c 20 72 65 66 20 69 6e 74 20 6c 65 6e 29 3b 0d , ref int len);.
b3c0: 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 ... [DllImpor
b3d0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
b3e0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
b3f0: 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 tic extern IntPt
b400: 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e r sqlite3_column
b410: 5f 64 65 63 6c 74 79 70 65 31 36 5f 69 6e 74 65 _decltype16_inte
b420: 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c rop(IntPtr stmt,
b430: 20 69 6e 74 20 69 6e 64 65 78 2c 20 72 65 66 20 int index, ref
b440: 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 int len);....
b450: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
b460: 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e TE_DLL)].. in
b470: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
b480: 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 tern IntPtr sqli
b490: 74 65 33 5f 63 6f 6c 75 6d 6e 5f 6e 61 6d 65 5f te3_column_name_
b4a0: 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 interop(IntPtr s
b4b0: 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 tmt, int index,
b4c0: 72 65 66 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d ref int len);...
b4d0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
b4e0: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
b4f0: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
b500: 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 c extern IntPtr
b510: 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 6e sqlite3_column_n
b520: 61 6d 65 31 36 5f 69 6e 74 65 72 6f 70 28 49 6e ame16_interop(In
b530: 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 tPtr stmt, int i
b540: 6e 64 65 78 2c 20 72 65 66 20 69 6e 74 20 6c 65 ndex, ref int le
b550: 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 n);.... [DllI
b560: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
b570: 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c )].. internal
b580: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 static extern I
b590: 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f ntPtr sqlite3_co
b5a0: 6c 75 6d 6e 5f 6f 72 69 67 69 6e 5f 6e 61 6d 65 lumn_origin_name
b5b0: 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 _interop(IntPtr
b5c0: 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c stmt, int index,
b5d0: 20 72 65 66 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a ref int len);..
b5e0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
b5f0: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 (SQLITE_DLL)]..
b600: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
b610: 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 ic extern IntPtr
b620: 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f sqlite3_column_
b630: 6f 72 69 67 69 6e 5f 6e 61 6d 65 31 36 5f 69 6e origin_name16_in
b640: 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d terop(IntPtr stm
b650: 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 72 65 t, int index, re
b660: 66 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 f int len);....
b670: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
b680: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
b690: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
b6a0: 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 extern IntPtr sq
b6b0: 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 74 61 62 lite3_column_tab
b6c0: 6c 65 5f 6e 61 6d 65 5f 69 6e 74 65 72 6f 70 28 le_name_interop(
b6d0: 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 IntPtr stmt, int
b6e0: 20 69 6e 64 65 78 2c 20 72 65 66 20 69 6e 74 20 index, ref int
b6f0: 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c len);.... [Dl
b700: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
b710: 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e LL)].. intern
b720: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
b730: 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f IntPtr sqlite3_
b740: 63 6f 6c 75 6d 6e 5f 74 61 62 6c 65 5f 6e 61 6d column_table_nam
b750: 65 31 36 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 e16_interop(IntP
b760: 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 tr stmt, int ind
b770: 65 78 2c 20 72 65 66 20 69 6e 74 20 6c 65 6e 29 ex, ref int len)
b780: 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ;.... [DllImp
b790: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
b7a0: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
b7b0: 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
b7c0: 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 Ptr sqlite3_colu
b7d0: 6d 6e 5f 74 65 78 74 5f 69 6e 74 65 72 6f 70 28 mn_text_interop(
b7e0: 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 IntPtr stmt, int
b7f0: 20 69 6e 64 65 78 2c 20 72 65 66 20 69 6e 74 20 index, ref int
b800: 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c len);.... [Dl
b810: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
b820: 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e LL)].. intern
b830: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
b840: 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f IntPtr sqlite3_
b850: 63 6f 6c 75 6d 6e 5f 74 65 78 74 31 36 5f 69 6e column_text16_in
b860: 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d terop(IntPtr stm
b870: 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 72 65 t, int index, re
b880: 66 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 f int len);....
b890: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
b8a0: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
b8b0: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
b8c0: 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 extern IntPtr sq
b8d0: 6c 69 74 65 33 5f 65 72 72 6d 73 67 5f 69 6e 74 lite3_errmsg_int
b8e0: 65 72 6f 70 28 49 6e 74 50 74 72 20 64 62 2c 20 erop(IntPtr db,
b8f0: 72 65 66 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d ref int len);...
b900: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
b910: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
b920: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
b930: 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 c extern SQLiteE
b940: 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 rrorCode sqlite3
b950: 5f 70 72 65 70 61 72 65 5f 69 6e 74 65 72 6f 70 _prepare_interop
b960: 28 49 6e 74 50 74 72 20 64 62 2c 20 49 6e 74 50 (IntPtr db, IntP
b970: 74 72 20 70 53 71 6c 2c 20 69 6e 74 20 6e 42 79 tr pSql, int nBy
b980: 74 65 73 2c 20 72 65 66 20 49 6e 74 50 74 72 20 tes, ref IntPtr
b990: 73 74 6d 74 2c 20 72 65 66 20 49 6e 74 50 74 72 stmt, ref IntPtr
b9a0: 20 70 74 72 52 65 6d 61 69 6e 2c 20 72 65 66 20 ptrRemain, ref
b9b0: 69 6e 74 20 6e 52 65 6d 61 69 6e 29 3b 0d 0a 0d int nRemain);...
b9c0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
b9d0: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
b9e0: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
b9f0: 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 c extern SQLiteE
ba00: 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 rrorCode sqlite3
ba10: 5f 74 61 62 6c 65 5f 63 6f 6c 75 6d 6e 5f 6d 65 _table_column_me
ba20: 74 61 64 61 74 61 5f 69 6e 74 65 72 6f 70 28 49 tadata_interop(I
ba30: 6e 74 50 74 72 20 64 62 2c 20 62 79 74 65 5b 5d ntPtr db, byte[]
ba40: 20 64 62 4e 61 6d 65 2c 20 62 79 74 65 5b 5d 20 dbName, byte[]
ba50: 74 62 6c 4e 61 6d 65 2c 20 62 79 74 65 5b 5d 20 tblName, byte[]
ba60: 63 6f 6c 4e 61 6d 65 2c 20 72 65 66 20 49 6e 74 colName, ref Int
ba70: 50 74 72 20 70 74 72 44 61 74 61 54 79 70 65 2c Ptr ptrDataType,
ba80: 20 72 65 66 20 49 6e 74 50 74 72 20 70 74 72 43 ref IntPtr ptrC
ba90: 6f 6c 6c 53 65 71 2c 20 72 65 66 20 69 6e 74 20 ollSeq, ref int
baa0: 6e 6f 74 4e 75 6c 6c 2c 20 72 65 66 20 69 6e 74 notNull, ref int
bab0: 20 70 72 69 6d 61 72 79 4b 65 79 2c 20 72 65 66 primaryKey, ref
bac0: 20 69 6e 74 20 61 75 74 6f 49 6e 63 2c 20 72 65 int autoInc, re
bad0: 66 20 69 6e 74 20 64 74 4c 65 6e 2c 20 72 65 66 f int dtLen, ref
bae0: 20 69 6e 74 20 63 73 4c 65 6e 29 3b 0d 0a 0d 0a int csLen);....
baf0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
bb00: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 QLITE_DLL)]..
bb10: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
bb20: 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 extern IntPtr s
bb30: 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 74 65 78 qlite3_value_tex
bb40: 74 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 t_interop(IntPtr
bb50: 20 70 2c 20 72 65 66 20 69 6e 74 20 6c 65 6e 29 p, ref int len)
bb60: 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ;.... [DllImp
bb70: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
bb80: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
bb90: 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
bba0: 50 74 72 20 73 71 6c 69 74 65 33 5f 76 61 6c 75 Ptr sqlite3_valu
bbb0: 65 5f 74 65 78 74 31 36 5f 69 6e 74 65 72 6f 70 e_text16_interop
bbc0: 28 49 6e 74 50 74 72 20 70 2c 20 72 65 66 20 69 (IntPtr p, ref i
bbd0: 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 nt len);....
bbe0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
bbf0: 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 E_DLL)].. int
bc00: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
bc10: 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f ern int sqlite3_
bc20: 6d 61 6c 6c 6f 63 5f 73 69 7a 65 5f 69 6e 74 65 malloc_size_inte
bc30: 72 6f 70 28 49 6e 74 50 74 72 20 70 29 3b 0d 0a rop(IntPtr p);..
bc40: 0d 0a 23 69 66 20 49 4e 54 45 52 4f 50 5f 4c 4f ..#if INTEROP_LO
bc50: 47 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 G.. [DllImpor
bc60: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
bc70: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
bc80: 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 tic extern SQLit
bc90: 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 eErrorCode sqlit
bca0: 65 33 5f 63 6f 6e 66 69 67 5f 6c 6f 67 5f 69 6e e3_config_log_in
bcb0: 74 65 72 6f 70 28 29 3b 0d 0a 23 65 6e 64 69 66 terop();..#endif
bcc0: 0d 0a 23 65 6e 64 69 66 0d 0a 2f 2f 20 21 53 51 ..#endif..// !SQ
bcd0: 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 0d 0a 0d LITE_STANDARD...
bce0: 0a 20 20 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d . #endregion.
bcf0: 0a 0d 0a 20 20 20 20 2f 2f 20 54 68 65 73 65 20 ... // These
bd00: 66 75 6e 63 74 69 6f 6e 73 20 61 64 64 20 65 78 functions add ex
bd10: 69 73 74 69 6e 67 20 66 75 6e 63 74 69 6f 6e 61 isting functiona
bd20: 6c 69 74 79 20 6f 6e 20 74 6f 70 20 6f 66 20 53 lity on top of S
bd30: 51 4c 69 74 65 20 61 6e 64 20 72 65 71 75 69 72 QLite and requir
bd40: 65 20 61 20 6c 69 74 74 6c 65 20 65 66 66 6f 72 e a little effor
bd50: 74 20 74 6f 0d 0a 20 20 20 20 2f 2f 20 67 65 74 t to.. // get
bd60: 20 77 6f 72 6b 69 6e 67 20 77 68 65 6e 20 75 73 working when us
bd70: 69 6e 67 20 74 68 65 20 73 74 61 6e 64 61 72 64 ing the standard
bd80: 20 53 51 4c 69 74 65 20 6c 69 62 72 61 72 79 2e SQLite library.
bd90: 0d 0a 20 20 20 20 23 72 65 67 69 6f 6e 20 69 6e .. #region in
bda0: 74 65 72 6f 70 20 61 64 64 65 64 20 66 75 6e 63 terop added func
bdb0: 74 69 6f 6e 61 6c 69 74 79 0d 0a 0d 0a 23 69 66 tionality....#if
bdc0: 20 21 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 !SQLITE_STANDAR
bdd0: 44 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 D.... [DllImp
bde0: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
bdf0: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
be00: 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
be10: 50 74 72 20 69 6e 74 65 72 6f 70 5f 6c 69 62 76 Ptr interop_libv
be20: 65 72 73 69 6f 6e 28 29 3b 0d 0a 0d 0a 20 20 20 ersion();....
be30: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
be40: 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e TE_DLL)].. in
be50: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
be60: 74 65 72 6e 20 49 6e 74 50 74 72 20 69 6e 74 65 tern IntPtr inte
be70: 72 6f 70 5f 73 6f 75 72 63 65 69 64 28 29 3b 0d rop_sourceid();.
be80: 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 ... [DllImpor
be90: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
bea0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
beb0: 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 69 tic extern int i
bec0: 6e 74 65 72 6f 70 5f 63 6f 6d 70 69 6c 65 6f 70 nterop_compileop
bed0: 74 69 6f 6e 5f 75 73 65 64 28 49 6e 74 50 74 72 tion_used(IntPtr
bee0: 20 7a 4f 70 74 4e 61 6d 65 29 3b 0d 0a 0d 0a 20 zOptName);....
bef0: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
bf00: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
bf10: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
bf20: 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 69 6e extern IntPtr in
bf30: 74 65 72 6f 70 5f 63 6f 6d 70 69 6c 65 6f 70 74 terop_compileopt
bf40: 69 6f 6e 5f 67 65 74 28 69 6e 74 20 4e 29 3b 0d ion_get(int N);.
bf50: 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 ... [DllImpor
bf60: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
bf70: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
bf80: 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 tic extern SQLit
bf90: 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 eErrorCode sqlit
bfa0: 65 33 5f 63 6c 6f 73 65 5f 69 6e 74 65 72 6f 70 e3_close_interop
bfb0: 28 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a (IntPtr db);....
bfc0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
bfd0: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 QLITE_DLL)]..
bfe0: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
bff0: 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 extern SQLiteEr
c000: 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f rorCode sqlite3_
c010: 63 72 65 61 74 65 5f 66 75 6e 63 74 69 6f 6e 5f create_function_
c020: 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 64 interop(IntPtr d
c030: 62 2c 20 62 79 74 65 5b 5d 20 73 74 72 4e 61 6d b, byte[] strNam
c040: 65 2c 20 69 6e 74 20 6e 41 72 67 73 2c 20 69 6e e, int nArgs, in
c050: 74 20 6e 54 79 70 65 2c 20 49 6e 74 50 74 72 20 t nType, IntPtr
c060: 70 76 55 73 65 72 2c 20 53 51 4c 69 74 65 43 61 pvUser, SQLiteCa
c070: 6c 6c 62 61 63 6b 20 66 75 6e 63 2c 20 53 51 4c llback func, SQL
c080: 69 74 65 43 61 6c 6c 62 61 63 6b 20 66 73 74 65 iteCallback fste
c090: 70 2c 20 53 51 4c 69 74 65 46 69 6e 61 6c 43 61 p, SQLiteFinalCa
c0a0: 6c 6c 62 61 63 6b 20 66 66 69 6e 61 6c 2c 20 69 llback ffinal, i
c0b0: 6e 74 20 6e 65 65 64 43 6f 6c 6c 53 65 71 29 3b nt needCollSeq);
c0c0: 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f .... [DllImpo
c0d0: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
c0e0: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
c0f0: 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 atic extern SQLi
c100: 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 teErrorCode sqli
c110: 74 65 33 5f 66 69 6e 61 6c 69 7a 65 5f 69 6e 74 te3_finalize_int
c120: 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 erop(IntPtr stmt
c130: 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d );.... [DllIm
c140: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
c150: 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 ].. internal
c160: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 static extern SQ
c170: 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 LiteErrorCode sq
c180: 6c 69 74 65 33 5f 62 61 63 6b 75 70 5f 66 69 6e lite3_backup_fin
c190: 69 73 68 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 ish_interop(IntP
c1a0: 74 72 20 62 61 63 6b 75 70 29 3b 0d 0a 0d 0a 20 tr backup);....
c1b0: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
c1c0: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
c1d0: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
c1e0: 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 extern SQLiteErr
c1f0: 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 6f orCode sqlite3_o
c200: 70 65 6e 5f 69 6e 74 65 72 6f 70 28 62 79 74 65 pen_interop(byte
c210: 5b 5d 20 75 74 66 38 46 69 6c 65 6e 61 6d 65 2c [] utf8Filename,
c220: 20 62 79 74 65 5b 5d 20 76 66 73 4e 61 6d 65 2c byte[] vfsName,
c230: 20 53 51 4c 69 74 65 4f 70 65 6e 46 6c 61 67 73 SQLiteOpenFlags
c240: 45 6e 75 6d 20 66 6c 61 67 73 2c 20 69 6e 74 20 Enum flags, int
c250: 65 78 74 46 75 6e 63 73 2c 20 72 65 66 20 49 6e extFuncs, ref In
c260: 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 20 20 20 tPtr db);....
c270: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
c280: 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e TE_DLL)].. in
c290: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
c2a0: 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 tern SQLiteError
c2b0: 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 6f 70 65 Code sqlite3_ope
c2c0: 6e 31 36 5f 69 6e 74 65 72 6f 70 28 62 79 74 65 n16_interop(byte
c2d0: 5b 5d 20 75 74 66 38 46 69 6c 65 6e 61 6d 65 2c [] utf8Filename,
c2e0: 20 62 79 74 65 5b 5d 20 76 66 73 4e 61 6d 65 2c byte[] vfsName,
c2f0: 20 53 51 4c 69 74 65 4f 70 65 6e 46 6c 61 67 73 SQLiteOpenFlags
c300: 45 6e 75 6d 20 66 6c 61 67 73 2c 20 69 6e 74 20 Enum flags, int
c310: 65 78 74 46 75 6e 63 73 2c 20 72 65 66 20 49 6e extFuncs, ref In
c320: 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 20 20 20 tPtr db);....
c330: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
c340: 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e TE_DLL)].. in
c350: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
c360: 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 tern SQLiteError
c370: 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 72 65 73 Code sqlite3_res
c380: 65 74 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 et_interop(IntPt
c390: 72 20 73 74 6d 74 29 3b 0d 0a 0d 0a 20 20 20 20 r stmt);....
c3a0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
c3b0: 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 E_DLL)].. int
c3c0: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
c3d0: 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f ern int sqlite3_
c3e0: 63 68 61 6e 67 65 73 5f 69 6e 74 65 72 6f 70 28 changes_interop(
c3f0: 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 23 65 6e IntPtr db);..#en
c400: 64 69 66 0d 0a 2f 2f 20 21 53 51 4c 49 54 45 5f dif..// !SQLITE_
c410: 53 54 41 4e 44 41 52 44 0d 0a 0d 0a 20 20 20 20 STANDARD....
c420: 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 0d 0a 20 20 #endregion....
c430: 20 20 2f 2f 20 54 68 65 20 73 74 61 6e 64 61 72 // The standar
c440: 64 20 61 70 69 20 63 61 6c 6c 20 65 71 75 69 76 d api call equiv
c450: 61 6c 65 6e 74 73 20 6f 66 20 74 68 65 20 61 62 alents of the ab
c460: 6f 76 65 20 69 6e 74 65 72 6f 70 20 63 61 6c 6c ove interop call
c470: 73 0d 0a 20 20 20 20 23 72 65 67 69 6f 6e 20 73 s.. #region s
c480: 74 61 6e 64 61 72 64 20 76 65 72 73 69 6f 6e 73 tandard versions
c490: 20 6f 66 20 69 6e 74 65 72 6f 70 20 66 75 6e 63 of interop func
c4a0: 74 69 6f 6e 73 0d 0a 0d 0a 23 69 66 20 53 51 4c tions....#if SQL
c4b0: 49 54 45 5f 53 54 41 4e 44 41 52 44 0d 0a 0d 0a ITE_STANDARD....
c4c0: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
c4d0: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
c4e0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
c4f0: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
c500: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
c510: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
c520: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
c530: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
c540: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
c550: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
c560: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
c570: 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 SQLiteErrorCode
c580: 20 73 71 6c 69 74 65 33 5f 63 6c 6f 73 65 28 49 sqlite3_close(I
c590: 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 23 69 ntPtr db);....#i
c5a0: 66 20 21 49 4e 54 45 52 4f 50 5f 4c 45 47 41 43 f !INTEROP_LEGAC
c5b0: 59 5f 43 4c 4f 53 45 0d 0a 23 69 66 20 21 50 4c Y_CLOSE..#if !PL
c5c0: 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
c5d0: 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
c5e0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
c5f0: 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
c600: 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
c610: 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
c620: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
c630: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
c640: 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
c650: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
c660: 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 ic extern SQLite
c670: 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 ErrorCode sqlite
c680: 33 5f 63 6c 6f 73 65 5f 76 32 28 49 6e 74 50 74 3_close_v2(IntPt
c690: 72 20 64 62 29 3b 20 2f 2a 20 33 2e 37 2e 31 34 r db); /* 3.7.14
c6a0: 2b 20 2a 2f 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a + */..#endif....
c6b0: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
c6c0: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
c6d0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
c6e0: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
c6f0: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
c700: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
c710: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
c720: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
c730: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
c740: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
c750: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
c760: 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 SQLiteErrorCode
c770: 20 73 71 6c 69 74 65 33 5f 63 72 65 61 74 65 5f sqlite3_create_
c780: 66 75 6e 63 74 69 6f 6e 28 49 6e 74 50 74 72 20 function(IntPtr
c790: 64 62 2c 20 62 79 74 65 5b 5d 20 73 74 72 4e 61 db, byte[] strNa
c7a0: 6d 65 2c 20 69 6e 74 20 6e 41 72 67 73 2c 20 69 me, int nArgs, i
c7b0: 6e 74 20 6e 54 79 70 65 2c 20 49 6e 74 50 74 72 nt nType, IntPtr
c7c0: 20 70 76 55 73 65 72 2c 20 53 51 4c 69 74 65 43 pvUser, SQLiteC
c7d0: 61 6c 6c 62 61 63 6b 20 66 75 6e 63 2c 20 53 51 allback func, SQ
c7e0: 4c 69 74 65 43 61 6c 6c 62 61 63 6b 20 66 73 74 LiteCallback fst
c7f0: 65 70 2c 20 53 51 4c 69 74 65 46 69 6e 61 6c 43 ep, SQLiteFinalC
c800: 61 6c 6c 62 61 63 6b 20 66 66 69 6e 61 6c 29 3b allback ffinal);
c810: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
c820: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
c830: 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
c840: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
c850: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
c860: 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
c870: 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
c880: 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
c890: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
c8a0: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
c8b0: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
c8c0: 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 tern SQLiteError
c8d0: 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 66 69 6e Code sqlite3_fin
c8e0: 61 6c 69 7a 65 28 49 6e 74 50 74 72 20 73 74 6d alize(IntPtr stm
c8f0: 74 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 t);....#if !PLAT
c900: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
c910: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
c920: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
c930: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
c940: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
c950: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
c960: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
c970: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
c980: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
c990: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
c9a0: 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 extern SQLiteEr
c9b0: 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f rorCode sqlite3_
c9c0: 62 61 63 6b 75 70 5f 66 69 6e 69 73 68 28 49 6e backup_finish(In
c9d0: 74 50 74 72 20 62 61 63 6b 75 70 29 3b 0d 0a 0d tPtr backup);...
c9e0: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
c9f0: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
ca00: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
ca10: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
ca20: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
ca30: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
ca40: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
ca50: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
ca60: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
ca70: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
ca80: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
ca90: 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 n SQLiteErrorCod
caa0: 65 20 73 71 6c 69 74 65 33 5f 72 65 73 65 74 28 e sqlite3_reset(
cab0: 49 6e 74 50 74 72 20 73 74 6d 74 29 3b 0d 0a 0d IntPtr stmt);...
cac0: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
cad0: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
cae0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
caf0: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
cb00: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
cb10: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
cb20: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
cb30: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
cb40: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
cb50: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
cb60: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
cb70: 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 n IntPtr sqlite3
cb80: 5f 62 69 6e 64 5f 70 61 72 61 6d 65 74 65 72 5f _bind_parameter_
cb90: 6e 61 6d 65 28 49 6e 74 50 74 72 20 73 74 6d 74 name(IntPtr stmt
cba0: 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d , int index);...
cbb0: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
cbc0: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
cbd0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
cbe0: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
cbf0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
cc00: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
cc10: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
cc20: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
cc30: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
cc40: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
cc50: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
cc60: 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 n IntPtr sqlite3
cc70: 5f 63 6f 6c 75 6d 6e 5f 64 61 74 61 62 61 73 65 _column_database
cc80: 5f 6e 61 6d 65 28 49 6e 74 50 74 72 20 73 74 6d _name(IntPtr stm
cc90: 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a t, int index);..
cca0: 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
ccb0: 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
ccc0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
ccd0: 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
cce0: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
ccf0: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
cd00: 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
cd10: 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
cd20: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
cd30: 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
cd40: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
cd50: 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 rn IntPtr sqlite
cd60: 33 5f 63 6f 6c 75 6d 6e 5f 64 61 74 61 62 61 73 3_column_databas
cd70: 65 5f 6e 61 6d 65 31 36 28 49 6e 74 50 74 72 20 e_name16(IntPtr
cd80: 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 stmt, int index)
cd90: 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f ;....#if !PLATFO
cda0: 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
cdb0: 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
cdc0: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
cdd0: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
cde0: 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
cdf0: 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 ntion.Cdecl)]..#
ce00: 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d else.. [DllIm
ce10: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
ce20: 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 ]..#endif.. i
ce30: 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 nternal static e
ce40: 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c xtern IntPtr sql
ce50: 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 64 65 63 6c ite3_column_decl
ce60: 74 79 70 65 28 49 6e 74 50 74 72 20 73 74 6d 74 type(IntPtr stmt
ce70: 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d , int index);...
ce80: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
ce90: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
cea0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
ceb0: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
cec0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
ced0: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
cee0: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
cef0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
cf00: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
cf10: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
cf20: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
cf30: 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 n IntPtr sqlite3
cf40: 5f 63 6f 6c 75 6d 6e 5f 64 65 63 6c 74 79 70 65 _column_decltype
cf50: 31 36 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 16(IntPtr stmt,
cf60: 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 int index);....#
cf70: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
cf80: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
cf90: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
cfa0: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
cfb0: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
cfc0: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
cfd0: 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
cfe0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
cff0: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
d000: 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
d010: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
d020: 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 IntPtr sqlite3_c
d030: 6f 6c 75 6d 6e 5f 6e 61 6d 65 28 49 6e 74 50 74 olumn_name(IntPt
d040: 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 r stmt, int inde
d050: 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 x);....#if !PLAT
d060: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
d070: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
d080: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
d090: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
d0a0: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
d0b0: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
d0c0: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
d0d0: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
d0e0: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
d0f0: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
d100: 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 extern IntPtr s
d110: 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 6e 61 qlite3_column_na
d120: 6d 65 31 36 28 49 6e 74 50 74 72 20 73 74 6d 74 me16(IntPtr stmt
d130: 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d , int index);...
d140: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
d150: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
d160: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
d170: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
d180: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
d190: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
d1a0: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
d1b0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
d1c0: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
d1d0: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
d1e0: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
d1f0: 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 n IntPtr sqlite3
d200: 5f 63 6f 6c 75 6d 6e 5f 6f 72 69 67 69 6e 5f 6e _column_origin_n
d210: 61 6d 65 28 49 6e 74 50 74 72 20 73 74 6d 74 2c ame(IntPtr stmt,
d220: 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a int index);....
d230: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
d240: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
d250: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
d260: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
d270: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
d280: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
d290: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
d2a0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
d2b0: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
d2c0: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
d2d0: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
d2e0: 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f IntPtr sqlite3_
d2f0: 63 6f 6c 75 6d 6e 5f 6f 72 69 67 69 6e 5f 6e 61 column_origin_na
d300: 6d 65 31 36 28 49 6e 74 50 74 72 20 73 74 6d 74 me16(IntPtr stmt
d310: 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d , int index);...
d320: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
d330: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
d340: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
d350: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
d360: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
d370: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
d380: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
d390: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
d3a0: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
d3b0: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
d3c0: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
d3d0: 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 n IntPtr sqlite3
d3e0: 5f 63 6f 6c 75 6d 6e 5f 74 61 62 6c 65 5f 6e 61 _column_table_na
d3f0: 6d 65 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 me(IntPtr stmt,
d400: 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 int index);....#
d410: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
d420: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
d430: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
d440: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
d450: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
d460: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
d470: 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
d480: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
d490: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
d4a0: 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
d4b0: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
d4c0: 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 IntPtr sqlite3_c
d4d0: 6f 6c 75 6d 6e 5f 74 61 62 6c 65 5f 6e 61 6d 65 olumn_table_name
d4e0: 31 36 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 16(IntPtr stmt,
d4f0: 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 int index);....#
d500: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
d510: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
d520: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
d530: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
d540: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
d550: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
d560: 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
d570: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
d580: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
d590: 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
d5a0: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
d5b0: 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 IntPtr sqlite3_c
d5c0: 6f 6c 75 6d 6e 5f 74 65 78 74 28 49 6e 74 50 74 olumn_text(IntPt
d5d0: 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 r stmt, int inde
d5e0: 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 x);....#if !PLAT
d5f0: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
d600: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
d610: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
d620: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
d630: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
d640: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
d650: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
d660: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
d670: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
d680: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
d690: 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 extern IntPtr s
d6a0: 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 74 65 qlite3_column_te
d6b0: 78 74 31 36 28 49 6e 74 50 74 72 20 73 74 6d 74 xt16(IntPtr stmt
d6c0: 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d , int index);...
d6d0: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
d6e0: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
d6f0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
d700: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
d710: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
d720: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
d730: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
d740: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
d750: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
d760: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
d770: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
d780: 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 n IntPtr sqlite3
d790: 5f 65 72 72 6d 73 67 28 49 6e 74 50 74 72 20 64 _errmsg(IntPtr d
d7a0: 62 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 b);....#if !PLAT
d7b0: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
d7c0: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
d7d0: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
d7e0: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
d7f0: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
d800: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
d810: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
d820: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
d830: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
d840: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
d850: 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 extern SQLiteEr
d860: 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f rorCode sqlite3_
d870: 70 72 65 70 61 72 65 28 49 6e 74 50 74 72 20 64 prepare(IntPtr d
d880: 62 2c 20 49 6e 74 50 74 72 20 70 53 71 6c 2c 20 b, IntPtr pSql,
d890: 69 6e 74 20 6e 42 79 74 65 73 2c 20 72 65 66 20 int nBytes, ref
d8a0: 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 72 65 66 IntPtr stmt, ref
d8b0: 20 49 6e 74 50 74 72 20 70 74 72 52 65 6d 61 69 IntPtr ptrRemai
d8c0: 6e 29 3b 0d 0a 0d 0a 23 69 66 20 55 53 45 5f 50 n);....#if USE_P
d8d0: 52 45 50 41 52 45 5f 56 32 0d 0a 23 69 66 20 21 REPARE_V2..#if !
d8e0: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
d8f0: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
d900: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
d910: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
d920: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
d930: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
d940: 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
d950: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
d960: 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
d970: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
d980: 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 atic extern SQLi
d990: 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 teErrorCode sqli
d9a0: 74 65 33 5f 70 72 65 70 61 72 65 5f 76 32 28 49 te3_prepare_v2(I
d9b0: 6e 74 50 74 72 20 64 62 2c 20 49 6e 74 50 74 72 ntPtr db, IntPtr
d9c0: 20 70 53 71 6c 2c 20 69 6e 74 20 6e 42 79 74 65 pSql, int nByte
d9d0: 73 2c 20 72 65 66 20 49 6e 74 50 74 72 20 73 74 s, ref IntPtr st
d9e0: 6d 74 2c 20 72 65 66 20 49 6e 74 50 74 72 20 70 mt, ref IntPtr p
d9f0: 74 72 52 65 6d 61 69 6e 29 3b 0d 0a 23 65 6e 64 trRemain);..#end
da00: 69 66 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 if....#if !PLATF
da10: 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
da20: 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
da30: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
da40: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
da50: 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
da60: 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
da70: 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
da80: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
da90: 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
daa0: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
dab0: 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 extern SQLiteErr
dac0: 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 74 orCode sqlite3_t
dad0: 61 62 6c 65 5f 63 6f 6c 75 6d 6e 5f 6d 65 74 61 able_column_meta
dae0: 64 61 74 61 28 49 6e 74 50 74 72 20 64 62 2c 20 data(IntPtr db,
daf0: 62 79 74 65 5b 5d 20 64 62 4e 61 6d 65 2c 20 62 byte[] dbName, b
db00: 79 74 65 5b 5d 20 74 62 6c 4e 61 6d 65 2c 20 62 yte[] tblName, b
db10: 79 74 65 5b 5d 20 63 6f 6c 4e 61 6d 65 2c 20 72 yte[] colName, r
db20: 65 66 20 49 6e 74 50 74 72 20 70 74 72 44 61 74 ef IntPtr ptrDat
db30: 61 54 79 70 65 2c 20 72 65 66 20 49 6e 74 50 74 aType, ref IntPt
db40: 72 20 70 74 72 43 6f 6c 6c 53 65 71 2c 20 72 65 r ptrCollSeq, re
db50: 66 20 69 6e 74 20 6e 6f 74 4e 75 6c 6c 2c 20 72 f int notNull, r
db60: 65 66 20 69 6e 74 20 70 72 69 6d 61 72 79 4b 65 ef int primaryKe
db70: 79 2c 20 72 65 66 20 69 6e 74 20 61 75 74 6f 49 y, ref int autoI
db80: 6e 63 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 nc);....#if !PLA
db90: 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
dba0: 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
dbb0: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
dbc0: 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
dbd0: 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
dbe0: 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
dbf0: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c ..#else.. [Dl
dc00: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
dc10: 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 LL)]..#endif..
dc20: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
dc30: 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 c extern IntPtr
dc40: 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 74 65 sqlite3_value_te
dc50: 78 74 28 49 6e 74 50 74 72 20 70 29 3b 0d 0a 0d xt(IntPtr p);...
dc60: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
dc70: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
dc80: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
dc90: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
dca0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
dcb0: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
dcc0: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
dcd0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
dce0: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
dcf0: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
dd00: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
dd10: 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 n IntPtr sqlite3
dd20: 5f 76 61 6c 75 65 5f 74 65 78 74 31 36 28 49 6e _value_text16(In
dd30: 74 50 74 72 20 70 29 3b 0d 0a 0d 0a 23 65 6e 64 tPtr p);....#end
dd40: 69 66 0d 0a 20 20 20 20 2f 2f 20 53 51 4c 49 54 if.. // SQLIT
dd50: 45 5f 53 54 41 4e 44 41 52 44 0d 0a 0d 0a 20 20 E_STANDARD....
dd60: 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 0d 0a #endregion....
dd70: 20 20 20 20 2f 2f 20 54 68 65 73 65 20 66 75 6e // These fun
dd80: 63 74 69 6f 6e 73 20 61 72 65 20 63 75 73 74 6f ctions are custo
dd90: 6d 20 61 6e 64 20 68 61 76 65 20 6e 6f 20 65 71 m and have no eq
dda0: 75 69 76 61 6c 65 6e 74 20 73 74 61 6e 64 61 72 uivalent standar
ddb0: 64 20 6c 69 62 72 61 72 79 20 6d 65 74 68 6f 64 d library method
ddc0: 2e 0d 0a 20 20 20 20 2f 2f 20 41 6c 6c 20 6f 66 ... // All of
ddd0: 20 74 68 65 6d 20 61 72 65 20 22 6e 69 63 65 20 them are "nice
dde0: 74 6f 20 68 61 76 65 73 22 20 61 6e 64 20 6e 6f to haves" and no
ddf0: 74 20 6e 65 63 65 73 73 61 72 69 6c 79 20 22 6e t necessarily "n
de00: 65 65 64 20 74 6f 20 68 61 76 65 73 22 2e 0d 0a eed to haves"...
de10: 20 20 20 20 23 72 65 67 69 6f 6e 20 6e 6f 20 65 #region no e
de20: 71 75 69 76 61 6c 65 6e 74 20 73 74 61 6e 64 61 quivalent standa
de30: 72 64 20 6d 65 74 68 6f 64 0d 0a 0d 0a 23 69 66 rd method....#if
de40: 20 21 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 !SQLITE_STANDAR
de50: 44 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 D.... [DllImp
de60: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
de70: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
de80: 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
de90: 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6e 74 Ptr sqlite3_cont
dea0: 65 78 74 5f 63 6f 6c 6c 73 65 71 5f 69 6e 74 65 ext_collseq_inte
deb0: 72 6f 70 28 49 6e 74 50 74 72 20 63 6f 6e 74 65 rop(IntPtr conte
dec0: 78 74 2c 20 72 65 66 20 69 6e 74 20 74 79 70 65 xt, ref int type
ded0: 2c 20 72 65 66 20 69 6e 74 20 65 6e 63 2c 20 72 , ref int enc, r
dee0: 65 66 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a ef int len);....
def0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
df00: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 QLITE_DLL)]..
df10: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
df20: 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 extern int sqli
df30: 74 65 33 5f 63 6f 6e 74 65 78 74 5f 63 6f 6c 6c te3_context_coll
df40: 63 6f 6d 70 61 72 65 5f 69 6e 74 65 72 6f 70 28 compare_interop(
df50: 49 6e 74 50 74 72 20 63 6f 6e 74 65 78 74 2c 20 IntPtr context,
df60: 62 79 74 65 5b 5d 20 70 31 2c 20 69 6e 74 20 70 byte[] p1, int p
df70: 31 6c 65 6e 2c 20 62 79 74 65 5b 5d 20 70 32 2c 1len, byte[] p2,
df80: 20 69 6e 74 20 70 32 6c 65 6e 29 3b 0d 0a 0d 0a int p2len);....
df90: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
dfa0: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 QLITE_DLL)]..
dfb0: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
dfc0: 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 extern SQLiteEr
dfd0: 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f rorCode sqlite3_
dfe0: 63 75 72 73 6f 72 5f 72 6f 77 69 64 5f 69 6e 74 cursor_rowid_int
dff0: 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 erop(IntPtr stmt
e000: 2c 20 69 6e 74 20 63 75 72 73 6f 72 2c 20 72 65 , int cursor, re
e010: 66 20 6c 6f 6e 67 20 72 6f 77 69 64 29 3b 0d 0a f long rowid);..
e020: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
e030: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 (SQLITE_DLL)]..
e040: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
e050: 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 ic extern SQLite
e060: 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 ErrorCode sqlite
e070: 33 5f 69 6e 64 65 78 5f 63 6f 6c 75 6d 6e 5f 69 3_index_column_i
e080: 6e 66 6f 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 nfo_interop(IntP
e090: 74 72 20 64 62 2c 20 62 79 74 65 5b 5d 20 63 61 tr db, byte[] ca
e0a0: 74 61 6c 6f 67 2c 20 62 79 74 65 5b 5d 20 49 6e talog, byte[] In
e0b0: 64 65 78 4e 61 6d 65 2c 20 62 79 74 65 5b 5d 20 dexName, byte[]
e0c0: 43 6f 6c 75 6d 6e 4e 61 6d 65 2c 20 72 65 66 20 ColumnName, ref
e0d0: 69 6e 74 20 73 6f 72 74 4f 72 64 65 72 2c 20 72 int sortOrder, r
e0e0: 65 66 20 69 6e 74 20 6f 6e 45 72 72 6f 72 2c 20 ef int onError,
e0f0: 72 65 66 20 49 6e 74 50 74 72 20 43 6f 6c 6c 61 ref IntPtr Colla
e100: 74 69 6f 6e 2c 20 72 65 66 20 69 6e 74 20 63 6f tion, ref int co
e110: 6c 6c 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b lllen);.... [
e120: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
e130: 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 _DLL)].. inte
e140: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
e150: 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 74 rn int sqlite3_t
e160: 61 62 6c 65 5f 63 75 72 73 6f 72 5f 69 6e 74 65 able_cursor_inte
e170: 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c rop(IntPtr stmt,
e180: 20 69 6e 74 20 64 62 2c 20 69 6e 74 20 74 61 62 int db, int tab
e190: 6c 65 52 6f 6f 74 50 61 67 65 29 3b 0d 0a 0d 0a leRootPage);....
e1a0: 23 65 6e 64 69 66 0d 0a 2f 2f 20 21 53 51 4c 49 #endif..// !SQLI
e1b0: 54 45 5f 53 54 41 4e 44 41 52 44 0d 0a 0d 0a 20 TE_STANDARD....
e1c0: 20 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 0d #endregion...
e1d0: 0a 20 20 20 20 2f 2f 20 53 74 61 6e 64 61 72 64 . // Standard
e1e0: 20 41 50 49 20 63 61 6c 6c 73 20 67 6c 6f 62 61 API calls globa
e1f0: 6c 20 61 63 72 6f 73 73 20 76 65 72 73 69 6f 6e l across version
e200: 73 2e 20 20 54 68 65 72 65 20 61 72 65 20 61 20 s. There are a
e210: 66 65 77 20 69 6e 73 74 61 6e 63 65 73 20 6f 66 few instances of
e220: 20 69 6e 74 65 72 6f 70 20 63 61 6c 6c 73 0d 0a interop calls..
e230: 20 20 20 20 2f 2f 20 73 63 61 74 74 65 72 65 64 // scattered
e240: 20 69 6e 20 68 65 72 65 2c 20 62 75 74 20 74 68 in here, but th
e250: 65 79 20 61 72 65 20 6f 6e 6c 79 20 61 63 74 69 ey are only acti
e260: 76 65 20 77 68 65 6e 20 50 4c 41 54 46 4f 52 4d ve when PLATFORM
e270: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
e280: 4b 20 69 73 20 64 65 63 6c 61 72 65 64 2e 0d 0a K is declared...
e290: 20 20 20 20 23 72 65 67 69 6f 6e 20 73 74 61 6e #region stan
e2a0: 64 61 72 64 20 73 71 6c 69 74 65 20 61 70 69 20 dard sqlite api
e2b0: 63 61 6c 6c 73 0d 0a 0d 0a 23 69 66 20 21 50 4c calls....#if !PL
e2c0: 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
e2d0: 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
e2e0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
e2f0: 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
e300: 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
e310: 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
e320: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
e330: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
e340: 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
e350: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
e360: 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 ic extern IntPtr
e370: 20 73 71 6c 69 74 65 33 5f 6c 69 62 76 65 72 73 sqlite3_libvers
e380: 69 6f 6e 28 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 ion();....#if !P
e390: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
e3a0: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
e3b0: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
e3c0: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
e3d0: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
e3e0: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
e3f0: 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
e400: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
e410: 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
e420: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
e430: 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 tic extern int s
e440: 71 6c 69 74 65 33 5f 6c 69 62 76 65 72 73 69 6f qlite3_libversio
e450: 6e 5f 6e 75 6d 62 65 72 28 29 3b 0d 0a 0d 0a 23 n_number();....#
e460: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
e470: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
e480: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
e490: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
e4a0: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
e4b0: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
e4c0: 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
e4d0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
e4e0: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
e4f0: 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
e500: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
e510: 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 73 IntPtr sqlite3_s
e520: 6f 75 72 63 65 69 64 28 29 3b 0d 0a 0d 0a 23 69 ourceid();....#i
e530: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
e540: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
e550: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
e560: 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
e570: 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
e580: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
e590: 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
e5a0: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
e5b0: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
e5c0: 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
e5d0: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 static extern i
e5e0: 6e 74 20 73 71 6c 69 74 65 33 5f 63 6f 6d 70 69 nt sqlite3_compi
e5f0: 6c 65 6f 70 74 69 6f 6e 5f 75 73 65 64 28 49 6e leoption_used(In
e600: 74 50 74 72 20 7a 4f 70 74 4e 61 6d 65 29 3b 0d tPtr zOptName);.
e610: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
e620: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
e630: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
e640: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
e650: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
e660: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
e670: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
e680: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
e690: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
e6a0: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
e6b0: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
e6c0: 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 ern IntPtr sqlit
e6d0: 65 33 5f 63 6f 6d 70 69 6c 65 6f 70 74 69 6f 6e e3_compileoption
e6e0: 5f 67 65 74 28 69 6e 74 20 4e 29 3b 0d 0a 0d 0a _get(int N);....
e6f0: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
e700: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
e710: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
e720: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
e730: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
e740: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
e750: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
e760: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
e770: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
e780: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
e790: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
e7a0: 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 SQLiteErrorCode
e7b0: 20 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c 65 5f sqlite3_enable_
e7c0: 73 68 61 72 65 64 5f 63 61 63 68 65 28 0d 0a 20 shared_cache(..
e7d0: 20 20 20 20 20 20 20 69 6e 74 20 65 6e 61 62 6c int enabl
e7e0: 65 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 e);....#if !PLAT
e7f0: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
e800: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
e810: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
e820: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
e830: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
e840: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
e850: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
e860: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
e870: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
e880: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
e890: 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 extern SQLiteEr
e8a0: 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f rorCode sqlite3_
e8b0: 65 6e 61 62 6c 65 5f 6c 6f 61 64 5f 65 78 74 65 enable_load_exte
e8c0: 6e 73 69 6f 6e 28 0d 0a 20 20 20 20 20 20 20 20 nsion(..
e8d0: 49 6e 74 50 74 72 20 64 62 2c 20 69 6e 74 20 65 IntPtr db, int e
e8e0: 6e 61 62 6c 65 29 3b 0d 0a 0d 0a 23 69 66 20 21 nable);....#if !
e8f0: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
e900: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
e910: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
e920: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
e930: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
e940: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
e950: 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
e960: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
e970: 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
e980: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
e990: 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 atic extern SQLi
e9a0: 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 teErrorCode sqli
e9b0: 74 65 33 5f 6c 6f 61 64 5f 65 78 74 65 6e 73 69 te3_load_extensi
e9c0: 6f 6e 28 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 on(.. Int
e9d0: 50 74 72 20 64 62 2c 20 62 79 74 65 5b 5d 20 66 Ptr db, byte[] f
e9e0: 69 6c 65 4e 61 6d 65 2c 20 62 79 74 65 5b 5d 20 ileName, byte[]
e9f0: 70 72 6f 63 4e 61 6d 65 2c 20 72 65 66 20 49 6e procName, ref In
ea00: 74 50 74 72 20 70 45 72 72 6f 72 29 3b 0d 0a 0d tPtr pError);...
ea10: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
ea20: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
ea30: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
ea40: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
ea50: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
ea60: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
ea70: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
ea80: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
ea90: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
eaa0: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
eab0: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
eac0: 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 n SQLiteErrorCod
ead0: 65 20 73 71 6c 69 74 65 33 5f 6f 76 65 72 6c 6f e sqlite3_overlo
eae0: 61 64 5f 66 75 6e 63 74 69 6f 6e 28 49 6e 74 50 ad_function(IntP
eaf0: 74 72 20 64 62 2c 20 49 6e 74 50 74 72 20 7a 4e tr db, IntPtr zN
eb00: 61 6d 65 2c 20 69 6e 74 20 6e 41 72 67 73 29 3b ame, int nArgs);
eb10: 0d 0a 0d 0a 23 69 66 20 57 49 4e 44 4f 57 53 0d ....#if WINDOWS.
eb20: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
eb30: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
eb40: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
eb50: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
eb60: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
eb70: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
eb80: 6e 2e 43 64 65 63 6c 2c 20 43 68 61 72 53 65 74 n.Cdecl, CharSet
eb90: 20 3d 20 43 68 61 72 53 65 74 2e 55 6e 69 63 6f = CharSet.Unico
eba0: 64 65 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 de)]..#else..
ebb0: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
ebc0: 54 45 5f 44 4c 4c 2c 20 43 68 61 72 53 65 74 20 TE_DLL, CharSet
ebd0: 3d 20 43 68 61 72 53 65 74 2e 55 6e 69 63 6f 64 = CharSet.Unicod
ebe0: 65 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 e)]..#endif..
ebf0: 20 2f 2f 0d 0a 20 20 20 20 2f 2f 20 4e 4f 54 45 //.. // NOTE
ec00: 3a 20 54 68 65 20 22 73 71 6c 69 74 65 33 5f 77 : The "sqlite3_w
ec10: 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f in32_set_directo
ec20: 72 79 22 20 53 51 4c 69 74 65 20 63 6f 72 65 20 ry" SQLite core
ec30: 6c 69 62 72 61 72 79 20 66 75 6e 63 74 69 6f 6e library function
ec40: 20 69 73 0d 0a 20 20 20 20 2f 2f 20 20 20 20 20 is.. //
ec50: 20 20 6f 6e 6c 79 20 73 75 70 70 6f 72 74 65 64 only supported
ec60: 20 6f 6e 20 57 69 6e 64 6f 77 73 2e 0d 0a 20 20 on Windows...
ec70: 20 20 2f 2f 0d 0a 20 20 20 20 69 6e 74 65 72 6e //.. intern
ec80: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
ec90: 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 SQLiteErrorCode
eca0: 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 sqlite3_win32_s
ecb0: 65 74 5f 64 69 72 65 63 74 6f 72 79 28 75 69 6e et_directory(uin
ecc0: 74 20 74 79 70 65 2c 20 73 74 72 69 6e 67 20 76 t type, string v
ecd0: 61 6c 75 65 29 3b 0d 0a 0d 0a 23 69 66 20 21 44 alue);....#if !D
ece0: 45 42 55 47 20 2f 2f 20 4e 4f 54 45 3a 20 53 68 EBUG // NOTE: Sh
ecf0: 6f 75 6c 64 20 62 65 20 22 57 49 4e 33 32 48 45 ould be "WIN32HE
ed00: 41 50 20 26 26 20 21 4d 45 4d 44 45 42 55 47 22 AP && !MEMDEBUG"
ed10: 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
ed20: 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
ed30: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
ed40: 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
ed50: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
ed60: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
ed70: 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
ed80: 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
ed90: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
eda0: 23 65 6e 64 69 66 0d 0a 20 20 20 20 2f 2f 0d 0a #endif.. //..
edb0: 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 54 68 65 // NOTE: The
edc0: 20 22 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f "sqlite3_win32_
edd0: 72 65 73 65 74 5f 68 65 61 70 22 20 53 51 4c 69 reset_heap" SQLi
ede0: 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 20 te core library
edf0: 66 75 6e 63 74 69 6f 6e 20 69 73 0d 0a 20 20 20 function is..
ee00: 20 2f 2f 20 20 20 20 20 20 20 6f 6e 6c 79 20 73 // only s
ee10: 75 70 70 6f 72 74 65 64 20 6f 6e 20 57 69 6e 64 upported on Wind
ee20: 6f 77 73 20 77 68 65 6e 20 74 68 65 20 57 69 6e ows when the Win
ee30: 33 32 20 6e 61 74 69 76 65 20 61 6c 6c 6f 63 61 32 native alloca
ee40: 74 6f 72 20 69 73 20 69 6e 0d 0a 20 20 20 20 2f tor is in.. /
ee50: 2f 20 20 20 20 20 20 20 75 73 65 20 28 69 2e 65 / use (i.e
ee60: 2e 20 62 79 20 64 65 66 61 75 6c 74 2c 20 69 6e . by default, in
ee70: 20 22 52 65 6c 65 61 73 65 22 20 62 75 69 6c 64 "Release" build
ee80: 73 20 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 61 s of System.Data
ee90: 2e 53 51 4c 69 74 65 0d 0a 20 20 20 20 2f 2f 20 .SQLite.. //
eea0: 20 20 20 20 20 20 6f 6e 6c 79 29 2e 20 20 42 79 only). By
eeb0: 20 64 65 66 61 75 6c 74 2c 20 69 6e 20 22 44 65 default, in "De
eec0: 62 75 67 22 20 62 75 69 6c 64 73 20 6f 66 20 53 bug" builds of S
eed0: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
eee0: 65 2c 20 74 68 65 0d 0a 20 20 20 20 2f 2f 20 20 e, the.. //
eef0: 20 20 20 20 20 4d 45 4d 44 45 42 55 47 20 61 6c MEMDEBUG al
ef00: 6c 6f 63 61 74 6f 72 20 69 73 20 75 73 65 64 2e locator is used.
ef10: 0d 0a 20 20 20 20 2f 2f 0d 0a 20 20 20 20 69 6e .. //.. in
ef20: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
ef30: 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 tern SQLiteError
ef40: 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 77 69 6e Code sqlite3_win
ef50: 33 32 5f 72 65 73 65 74 5f 68 65 61 70 28 29 3b 32_reset_heap();
ef60: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
ef70: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
ef80: 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
ef90: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
efa0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
efb0: 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
efc0: 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
efd0: 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
efe0: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
eff0: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 2f 2f ..#endif.. //
f000: 0d 0a 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 54 .. // NOTE: T
f010: 68 65 20 22 73 71 6c 69 74 65 33 5f 77 69 6e 33 he "sqlite3_win3
f020: 32 5f 63 6f 6d 70 61 63 74 5f 68 65 61 70 22 20 2_compact_heap"
f030: 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 SQLite core libr
f040: 61 72 79 20 66 75 6e 63 74 69 6f 6e 20 69 73 0d ary function is.
f050: 0a 20 20 20 20 2f 2f 20 20 20 20 20 20 20 6f 6e . // on
f060: 6c 79 20 73 75 70 70 6f 72 74 65 64 20 6f 6e 20 ly supported on
f070: 57 69 6e 64 6f 77 73 20 77 68 65 6e 20 74 68 65 Windows when the
f080: 20 57 69 6e 33 32 20 6e 61 74 69 76 65 20 61 6c Win32 native al
f090: 6c 6f 63 61 74 6f 72 20 69 73 20 69 6e 0d 0a 20 locator is in..
f0a0: 20 20 20 2f 2f 20 20 20 20 20 20 20 75 73 65 20 // use
f0b0: 28 69 2e 65 2e 20 62 79 20 64 65 66 61 75 6c 74 (i.e. by default
f0c0: 2c 20 69 6e 20 22 52 65 6c 65 61 73 65 22 20 62 , in "Release" b
f0d0: 75 69 6c 64 73 20 6f 66 20 53 79 73 74 65 6d 2e uilds of System.
f0e0: 44 61 74 61 2e 53 51 4c 69 74 65 0d 0a 20 20 20 Data.SQLite..
f0f0: 20 2f 2f 20 20 20 20 20 20 20 6f 6e 6c 79 29 2e // only).
f100: 20 20 42 79 20 64 65 66 61 75 6c 74 2c 20 69 6e By default, in
f110: 20 22 44 65 62 75 67 22 20 62 75 69 6c 64 73 20 "Debug" builds
f120: 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 of System.Data.S
f130: 51 4c 69 74 65 2c 20 74 68 65 0d 0a 20 20 20 20 QLite, the..
f140: 2f 2f 20 20 20 20 20 20 20 4d 45 4d 44 45 42 55 // MEMDEBU
f150: 47 20 61 6c 6c 6f 63 61 74 6f 72 20 69 73 20 75 G allocator is u
f160: 73 65 64 2e 0d 0a 20 20 20 20 2f 2f 0d 0a 20 20 sed... //..
f170: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
f180: 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 c extern SQLiteE
f190: 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 rrorCode sqlite3
f1a0: 5f 77 69 6e 33 32 5f 63 6f 6d 70 61 63 74 5f 68 _win32_compact_h
f1b0: 65 61 70 28 72 65 66 20 75 69 6e 74 20 6c 61 72 eap(ref uint lar
f1c0: 67 65 73 74 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a gest);..#endif..
f1d0: 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 #endif....#if !P
f1e0: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
f1f0: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
f200: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
f210: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
f220: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
f230: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
f240: 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
f250: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
f260: 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
f270: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
f280: 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 tic extern IntPt
f290: 72 20 73 71 6c 69 74 65 33 5f 6d 61 6c 6c 6f 63 r sqlite3_malloc
f2a0: 28 69 6e 74 20 6e 29 3b 0d 0a 0d 0a 23 69 66 20 (int n);....#if
f2b0: 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
f2c0: 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
f2d0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
f2e0: 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
f2f0: 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
f300: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
f310: 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
f320: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
f330: 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
f340: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
f350: 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
f360: 50 74 72 20 73 71 6c 69 74 65 33 5f 72 65 61 6c Ptr sqlite3_real
f370: 6c 6f 63 28 49 6e 74 50 74 72 20 70 2c 20 69 6e loc(IntPtr p, in
f380: 74 20 6e 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c t n);....#if !PL
f390: 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
f3a0: 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
f3b0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
f3c0: 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
f3d0: 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
f3e0: 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
f3f0: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
f400: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
f410: 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
f420: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
f430: 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 ic extern void s
f440: 71 6c 69 74 65 33 5f 66 72 65 65 28 49 6e 74 50 qlite3_free(IntP
f450: 74 72 20 70 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 tr p);....#if !P
f460: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
f470: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
f480: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
f490: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
f4a0: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
f4b0: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
f4c0: 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
f4d0: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
f4e0: 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
f4f0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
f500: 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 tic extern SQLit
f510: 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 eErrorCode sqlit
f520: 65 33 5f 6f 70 65 6e 5f 76 32 28 62 79 74 65 5b e3_open_v2(byte[
f530: 5d 20 75 74 66 38 46 69 6c 65 6e 61 6d 65 2c 20 ] utf8Filename,
f540: 72 65 66 20 49 6e 74 50 74 72 20 64 62 2c 20 53 ref IntPtr db, S
f550: 51 4c 69 74 65 4f 70 65 6e 46 6c 61 67 73 45 6e QLiteOpenFlagsEn
f560: 75 6d 20 66 6c 61 67 73 2c 20 62 79 74 65 5b 5d um flags, byte[]
f570: 20 76 66 73 4e 61 6d 65 29 3b 0d 0a 0d 0a 23 69 vfsName);....#i
f580: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
f590: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
f5a0: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
f5b0: 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
f5c0: 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
f5d0: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
f5e0: 64 65 63 6c 2c 20 43 68 61 72 53 65 74 20 3d 20 decl, CharSet =
f5f0: 43 68 61 72 53 65 74 2e 55 6e 69 63 6f 64 65 29 CharSet.Unicode)
f600: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
f610: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
f620: 44 4c 4c 2c 20 43 68 61 72 53 65 74 20 3d 20 43 DLL, CharSet = C
f630: 68 61 72 53 65 74 2e 55 6e 69 63 6f 64 65 29 5d harSet.Unicode)]
f640: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
f650: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
f660: 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 tern SQLiteError
f670: 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 6f 70 65 Code sqlite3_ope
f680: 6e 31 36 28 73 74 72 69 6e 67 20 66 69 6c 65 4e n16(string fileN
f690: 61 6d 65 2c 20 72 65 66 20 49 6e 74 50 74 72 20 ame, ref IntPtr
f6a0: 64 62 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 db);....#if !PLA
f6b0: 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
f6c0: 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
f6d0: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
f6e0: 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
f6f0: 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
f700: 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
f710: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c ..#else.. [Dl
f720: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
f730: 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 LL)]..#endif..
f740: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
f750: 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 71 c extern void sq
f760: 6c 69 74 65 33 5f 69 6e 74 65 72 72 75 70 74 28 lite3_interrupt(
f770: 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 23 IntPtr db);....#
f780: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
f790: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
f7a0: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
f7b0: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
f7c0: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
f7d0: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
f7e0: 43 64 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 Cdecl)].. int
f7f0: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
f800: 65 72 6e 20 6c 6f 6e 67 20 73 71 6c 69 74 65 33 ern long sqlite3
f810: 5f 6c 61 73 74 5f 69 6e 73 65 72 74 5f 72 6f 77 _last_insert_row
f820: 69 64 28 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a id(IntPtr db);..
f830: 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 #endif....#if !P
f840: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
f850: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
f860: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
f870: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
f880: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
f890: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
f8a0: 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
f8b0: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
f8c0: 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
f8d0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
f8e0: 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 tic extern int s
f8f0: 71 6c 69 74 65 33 5f 63 68 61 6e 67 65 73 28 49 qlite3_changes(I
f900: 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 23 69 ntPtr db);....#i
f910: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
f920: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
f930: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
f940: 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
f950: 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
f960: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
f970: 64 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 decl)].. inte
f980: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
f990: 72 6e 20 6c 6f 6e 67 20 73 71 6c 69 74 65 33 5f rn long sqlite3_
f9a0: 6d 65 6d 6f 72 79 5f 75 73 65 64 28 29 3b 0d 0a memory_used();..
f9b0: 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 #endif....#if !P
f9c0: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
f9d0: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
f9e0: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
f9f0: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
fa00: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
fa10: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
fa20: 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c )].. internal
fa30: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 6c static extern l
fa40: 6f 6e 67 20 73 71 6c 69 74 65 33 5f 6d 65 6d 6f ong sqlite3_memo
fa50: 72 79 5f 68 69 67 68 77 61 74 65 72 28 69 6e 74 ry_highwater(int
fa60: 20 72 65 73 65 74 46 6c 61 67 29 3b 0d 0a 23 65 resetFlag);..#e
fa70: 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 ndif....#if !PLA
fa80: 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
fa90: 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
faa0: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
fab0: 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
fac0: 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
fad0: 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
fae0: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c ..#else.. [Dl
faf0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
fb00: 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 LL)]..#endif..
fb10: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
fb20: 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 c extern SQLiteE
fb30: 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 rrorCode sqlite3
fb40: 5f 73 68 75 74 64 6f 77 6e 28 29 3b 0d 0a 0d 0a _shutdown();....
fb50: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
fb60: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
fb70: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
fb80: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
fb90: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
fba0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
fbb0: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
fbc0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
fbd0: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
fbe0: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
fbf0: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
fc00: 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 SQLiteErrorCode
fc10: 20 73 71 6c 69 74 65 33 5f 62 75 73 79 5f 74 69 sqlite3_busy_ti
fc20: 6d 65 6f 75 74 28 49 6e 74 50 74 72 20 64 62 2c meout(IntPtr db,
fc30: 20 69 6e 74 20 6d 73 29 3b 0d 0a 0d 0a 23 69 66 int ms);....#if
fc40: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
fc50: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
fc60: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
fc70: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
fc80: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
fc90: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
fca0: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
fcb0: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
fcc0: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
fcd0: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
fce0: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 static extern SQ
fcf0: 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 LiteErrorCode sq
fd00: 6c 69 74 65 33 5f 62 69 6e 64 5f 62 6c 6f 62 28 lite3_bind_blob(
fd10: 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 IntPtr stmt, int
fd20: 20 69 6e 64 65 78 2c 20 42 79 74 65 5b 5d 20 76 index, Byte[] v
fd30: 61 6c 75 65 2c 20 69 6e 74 20 6e 53 69 7a 65 2c alue, int nSize,
fd40: 20 49 6e 74 50 74 72 20 6e 54 72 61 6e 73 69 65 IntPtr nTransie
fd50: 6e 74 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 nt);....#if !PLA
fd60: 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
fd70: 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
fd80: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
fd90: 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
fda0: 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
fdb0: 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
fdc0: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
fdd0: 74 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c tatic extern SQL
fde0: 69 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c iteErrorCode sql
fdf0: 69 74 65 33 5f 62 69 6e 64 5f 64 6f 75 62 6c 65 ite3_bind_double
fe00: 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e (IntPtr stmt, in
fe10: 74 20 69 6e 64 65 78 2c 20 64 6f 75 62 6c 65 20 t index, double
fe20: 76 61 6c 75 65 29 3b 0d 0a 23 65 6e 64 69 66 0d value);..#endif.
fe30: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
fe40: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
fe50: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
fe60: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
fe70: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
fe80: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
fe90: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
fea0: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
feb0: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
fec0: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
fed0: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
fee0: 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 ern SQLiteErrorC
fef0: 6f 64 65 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 ode sqlite3_bind
ff00: 5f 69 6e 74 28 49 6e 74 50 74 72 20 73 74 6d 74 _int(IntPtr stmt
ff10: 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 69 6e 74 , int index, int
ff20: 20 76 61 6c 75 65 29 3b 0d 0a 0d 0a 20 20 20 20 value);....
ff30: 2f 2f 0d 0a 20 20 20 20 2f 2f 20 4e 4f 54 45 3a //.. // NOTE:
ff40: 20 54 68 69 73 20 72 65 61 6c 6c 79 20 6a 75 73 This really jus
ff50: 74 20 63 61 6c 6c 73 20 22 73 71 6c 69 74 65 33 t calls "sqlite3
ff60: 5f 62 69 6e 64 5f 69 6e 74 22 3b 20 68 6f 77 65 _bind_int"; howe
ff70: 76 65 72 2c 20 69 74 20 68 61 73 20 74 68 65 0d ver, it has the.
ff80: 0a 20 20 20 20 2f 2f 20 20 20 20 20 20 20 63 6f . // co
ff90: 72 72 65 63 74 20 74 79 70 65 20 73 69 67 6e 61 rrect type signa
ffa0: 74 75 72 65 20 66 6f 72 20 61 6e 20 75 6e 73 69 ture for an unsi
ffb0: 67 6e 65 64 20 28 33 32 2d 62 69 74 29 20 69 6e gned (32-bit) in
ffc0: 74 65 67 65 72 2e 0d 0a 20 20 20 20 2f 2f 0d 0a teger... //..
ffd0: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
ffe0: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
fff0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
10000 51 4c 49 54 45 5f 44 4c 4c 2c 20 45 6e 74 72 79 QLITE_DLL, Entry
10010 50 6f 69 6e 74 20 3d 20 22 73 71 6c 69 74 65 33 Point = "sqlite3
10020 5f 62 69 6e 64 5f 69 6e 74 22 2c 20 43 61 6c 6c _bind_int", Call
10030 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
10040 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
10050 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
10060 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
10070 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 45 6e 74 (SQLITE_DLL, Ent
10080 72 79 50 6f 69 6e 74 20 3d 20 22 73 71 6c 69 74 ryPoint = "sqlit
10090 65 33 5f 62 69 6e 64 5f 69 6e 74 22 29 5d 0d 0a e3_bind_int")]..
100a0 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
100b0 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
100c0 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f rn SQLiteErrorCo
100d0 64 65 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f de sqlite3_bind_
100e0 75 69 6e 74 28 49 6e 74 50 74 72 20 73 74 6d 74 uint(IntPtr stmt
100f0 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 75 69 6e , int index, uin
10100 74 20 76 61 6c 75 65 29 3b 0d 0a 0d 0a 23 69 66 t value);....#if
10110 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
10120 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
10130 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
10140 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
10150 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
10160 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
10170 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 ecl)].. inter
10180 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
10190 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 n SQLiteErrorCod
101a0 65 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 69 e sqlite3_bind_i
101b0 6e 74 36 34 28 49 6e 74 50 74 72 20 73 74 6d 74 nt64(IntPtr stmt
101c0 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 6c 6f 6e , int index, lon
101d0 67 20 76 61 6c 75 65 29 3b 0d 0a 23 65 6e 64 69 g value);..#endi
101e0 66 0d 0a 0d 0a 20 20 20 20 2f 2f 0d 0a 20 20 20 f.... //..
101f0 20 2f 2f 20 4e 4f 54 45 3a 20 54 68 69 73 20 72 // NOTE: This r
10200 65 61 6c 6c 79 20 6a 75 73 74 20 63 61 6c 6c 73 eally just calls
10210 20 22 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 69 "sqlite3_bind_i
10220 6e 74 36 34 22 3b 20 68 6f 77 65 76 65 72 2c 20 nt64"; however,
10230 69 74 20 68 61 73 20 74 68 65 0d 0a 20 20 20 20 it has the..
10240 2f 2f 20 20 20 20 20 20 20 63 6f 72 72 65 63 74 // correct
10250 20 74 79 70 65 20 73 69 67 6e 61 74 75 72 65 20 type signature
10260 66 6f 72 20 61 6e 20 75 6e 73 69 67 6e 65 64 20 for an unsigned
10270 6c 6f 6e 67 20 28 36 34 2d 62 69 74 29 20 69 6e long (64-bit) in
10280 74 65 67 65 72 2e 0d 0a 20 20 20 20 2f 2f 0d 0a teger... //..
10290 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
102a0 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
102b0 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
102c0 51 4c 49 54 45 5f 44 4c 4c 2c 20 45 6e 74 72 79 QLITE_DLL, Entry
102d0 50 6f 69 6e 74 20 3d 20 22 73 71 6c 69 74 65 33 Point = "sqlite3
102e0 5f 62 69 6e 64 5f 69 6e 74 36 34 22 2c 20 43 61 _bind_int64", Ca
102f0 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
10300 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
10310 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 20 20 20 ion.Cdecl)]..
10320 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
10330 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 extern SQLiteEr
10340 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f rorCode sqlite3_
10350 62 69 6e 64 5f 75 69 6e 74 36 34 28 49 6e 74 50 bind_uint64(IntP
10360 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 tr stmt, int ind
10370 65 78 2c 20 75 6c 6f 6e 67 20 76 61 6c 75 65 29 ex, ulong value)
10380 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 ;..#endif....#if
10390 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
103a0 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
103b0 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
103c0 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
103d0 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
103e0 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
103f0 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
10400 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
10410 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
10420 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
10430 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 static extern SQ
10440 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 LiteErrorCode sq
10450 6c 69 74 65 33 5f 62 69 6e 64 5f 6e 75 6c 6c 28 lite3_bind_null(
10460 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 IntPtr stmt, int
10470 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 20 index);....#if
10480 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
10490 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
104a0 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
104b0 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
104c0 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
104d0 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
104e0 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
104f0 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
10500 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
10510 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
10520 74 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c tatic extern SQL
10530 69 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c iteErrorCode sql
10540 69 74 65 33 5f 62 69 6e 64 5f 74 65 78 74 28 49 ite3_bind_text(I
10550 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 ntPtr stmt, int
10560 69 6e 64 65 78 2c 20 62 79 74 65 5b 5d 20 76 61 index, byte[] va
10570 6c 75 65 2c 20 69 6e 74 20 6e 6c 65 6e 2c 20 49 lue, int nlen, I
10580 6e 74 50 74 72 20 70 76 52 65 73 65 72 76 65 64 ntPtr pvReserved
10590 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 );....#if !PLATF
105a0 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
105b0 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
105c0 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
105d0 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
105e0 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
105f0 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
10600 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
10610 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
10620 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
10630 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
10640 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 extern int sqlit
10650 65 33 5f 62 69 6e 64 5f 70 61 72 61 6d 65 74 65 e3_bind_paramete
10660 72 5f 63 6f 75 6e 74 28 49 6e 74 50 74 72 20 73 r_count(IntPtr s
10670 74 6d 74 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c tmt);....#if !PL
10680 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
10690 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
106a0 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
106b0 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
106c0 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
106d0 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
106e0 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
106f0 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
10700 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
10710 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
10720 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 ic extern int sq
10730 6c 69 74 65 33 5f 62 69 6e 64 5f 70 61 72 61 6d lite3_bind_param
10740 65 74 65 72 5f 69 6e 64 65 78 28 49 6e 74 50 74 eter_index(IntPt
10750 72 20 73 74 6d 74 2c 20 62 79 74 65 5b 5d 20 73 r stmt, byte[] s
10760 74 72 4e 61 6d 65 29 3b 0d 0a 0d 0a 23 69 66 20 trName);....#if
10770 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
10780 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
10790 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
107a0 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
107b0 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
107c0 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
107d0 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
107e0 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
107f0 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
10800 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
10810 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 tatic extern int
10820 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f sqlite3_column_
10830 63 6f 75 6e 74 28 49 6e 74 50 74 72 20 73 74 6d count(IntPtr stm
10840 74 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 t);....#if !PLAT
10850 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
10860 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
10870 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
10880 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
10890 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
108a0 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
108b0 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
108c0 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
108d0 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
108e0 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
108f0 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 extern SQLiteEr
10900 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f rorCode sqlite3_
10910 73 74 65 70 28 49 6e 74 50 74 72 20 73 74 6d 74 step(IntPtr stmt
10920 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 );....#if !PLATF
10930 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
10940 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
10950 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
10960 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
10970 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
10980 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
10990 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
109a0 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
109b0 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
109c0 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
109d0 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 extern int sqlit
109e0 65 33 5f 73 74 6d 74 5f 72 65 61 64 6f 6e 6c 79 e3_stmt_readonly
109f0 28 49 6e 74 50 74 72 20 73 74 6d 74 29 3b 20 2f (IntPtr stmt); /
10a00 2a 20 33 2e 37 2e 34 2b 20 2a 2f 0d 0a 0d 0a 23 * 3.7.4+ */....#
10a10 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
10a20 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
10a30 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
10a40 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
10a50 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
10a60 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
10a70 43 64 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 Cdecl)].. int
10a80 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
10a90 65 72 6e 20 64 6f 75 62 6c 65 20 73 71 6c 69 74 ern double sqlit
10aa0 65 33 5f 63 6f 6c 75 6d 6e 5f 64 6f 75 62 6c 65 e3_column_double
10ab0 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e (IntPtr stmt, in
10ac0 74 20 69 6e 64 65 78 29 3b 0d 0a 23 65 6e 64 69 t index);..#endi
10ad0 66 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f f....#if !PLATFO
10ae0 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
10af0 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
10b00 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
10b10 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
10b20 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
10b30 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 ntion.Cdecl)]..#
10b40 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d else.. [DllIm
10b50 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
10b60 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 ]..#endif.. i
10b70 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 nternal static e
10b80 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 xtern int sqlite
10b90 33 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 28 49 6e 74 3_column_int(Int
10ba0 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e Ptr stmt, int in
10bb0 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c dex);....#if !PL
10bc0 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
10bd0 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
10be0 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
10bf0 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
10c00 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
10c10 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
10c20 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 ].. internal
10c30 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 6c 6f static extern lo
10c40 6e 67 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d ng sqlite3_colum
10c50 6e 5f 69 6e 74 36 34 28 49 6e 74 50 74 72 20 73 n_int64(IntPtr s
10c60 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b tmt, int index);
10c70 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 ..#endif....#if
10c80 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
10c90 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
10ca0 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
10cb0 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
10cc0 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
10cd0 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
10ce0 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
10cf0 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
10d00 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
10d10 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
10d20 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
10d30 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 Ptr sqlite3_colu
10d40 6d 6e 5f 62 6c 6f 62 28 49 6e 74 50 74 72 20 73 mn_blob(IntPtr s
10d50 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b tmt, int index);
10d60 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
10d70 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
10d80 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
10d90 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
10da0 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
10db0 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
10dc0 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
10dd0 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
10de0 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
10df0 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
10e00 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
10e10 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 tern int sqlite3
10e20 5f 63 6f 6c 75 6d 6e 5f 62 79 74 65 73 28 49 6e _column_bytes(In
10e30 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 tPtr stmt, int i
10e40 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 ndex);....#if !P
10e50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
10e60 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
10e70 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
10e80 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
10e90 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
10ea0 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
10eb0 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
10ec0 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
10ed0 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
10ee0 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
10ef0 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 tic extern int s
10f00 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 62 79 qlite3_column_by
10f10 74 65 73 31 36 28 49 6e 74 50 74 72 20 73 74 6d tes16(IntPtr stm
10f20 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a t, int index);..
10f30 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
10f40 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
10f50 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
10f60 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
10f70 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
10f80 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
10f90 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
10fa0 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
10fb0 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
10fc0 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
10fd0 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
10fe0 72 6e 20 54 79 70 65 41 66 66 69 6e 69 74 79 20 rn TypeAffinity
10ff0 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 74 sqlite3_column_t
11000 79 70 65 28 49 6e 74 50 74 72 20 73 74 6d 74 2c ype(IntPtr stmt,
11010 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a int index);....
11020 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
11030 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
11040 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
11050 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
11060 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
11070 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
11080 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
11090 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
110a0 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
110b0 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
110c0 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
110d0 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 SQLiteErrorCode
110e0 20 73 71 6c 69 74 65 33 5f 63 72 65 61 74 65 5f sqlite3_create_
110f0 63 6f 6c 6c 61 74 69 6f 6e 28 49 6e 74 50 74 72 collation(IntPtr
11100 20 64 62 2c 20 62 79 74 65 5b 5d 20 73 74 72 4e db, byte[] strN
11110 61 6d 65 2c 20 69 6e 74 20 6e 54 79 70 65 2c 20 ame, int nType,
11120 49 6e 74 50 74 72 20 70 76 55 73 65 72 2c 20 53 IntPtr pvUser, S
11130 51 4c 69 74 65 43 6f 6c 6c 61 74 69 6f 6e 20 66 QLiteCollation f
11140 75 6e 63 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c unc);....#if !PL
11150 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
11160 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
11170 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
11180 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
11190 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
111a0 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
111b0 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
111c0 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
111d0 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
111e0 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
111f0 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 ic extern int sq
11200 6c 69 74 65 33 5f 61 67 67 72 65 67 61 74 65 5f lite3_aggregate_
11210 63 6f 75 6e 74 28 49 6e 74 50 74 72 20 63 6f 6e count(IntPtr con
11220 74 65 78 74 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 text);....#if !P
11230 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
11240 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
11250 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
11260 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
11270 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
11280 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
11290 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
112a0 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
112b0 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
112c0 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
112d0 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 tic extern IntPt
112e0 72 20 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f r sqlite3_value_
112f0 62 6c 6f 62 28 49 6e 74 50 74 72 20 70 29 3b 0d blob(IntPtr p);.
11300 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
11310 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
11320 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
11330 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
11340 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
11350 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
11360 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
11370 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
11380 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
11390 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
113a0 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
113b0 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f ern int sqlite3_
113c0 76 61 6c 75 65 5f 62 79 74 65 73 28 49 6e 74 50 value_bytes(IntP
113d0 74 72 20 70 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 tr p);....#if !P
113e0 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
113f0 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
11400 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
11410 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
11420 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
11430 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
11440 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
11450 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
11460 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
11470 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
11480 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 tic extern int s
11490 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 62 79 74 qlite3_value_byt
114a0 65 73 31 36 28 49 6e 74 50 74 72 20 70 29 3b 0d es16(IntPtr p);.
114b0 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
114c0 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
114d0 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
114e0 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
114f0 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
11500 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
11510 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 20 20 20 ion.Cdecl)]..
11520 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
11530 20 65 78 74 65 72 6e 20 64 6f 75 62 6c 65 20 73 extern double s
11540 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 64 6f 75 qlite3_value_dou
11550 62 6c 65 28 49 6e 74 50 74 72 20 70 29 3b 0d 0a ble(IntPtr p);..
11560 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 #endif....#if !P
11570 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
11580 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
11590 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
115a0 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
115b0 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
115c0 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
115d0 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
115e0 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
115f0 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
11600 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
11610 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 tic extern int s
11620 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 69 6e 74 qlite3_value_int
11630 28 49 6e 74 50 74 72 20 70 29 3b 0d 0a 0d 0a 23 (IntPtr p);....#
11640 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
11650 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
11660 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
11670 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
11680 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
11690 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
116a0 43 64 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 Cdecl)].. int
116b0 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
116c0 65 72 6e 20 6c 6f 6e 67 20 73 71 6c 69 74 65 33 ern long sqlite3
116d0 5f 76 61 6c 75 65 5f 69 6e 74 36 34 28 49 6e 74 _value_int64(Int
116e0 50 74 72 20 70 29 3b 0d 0a 23 65 6e 64 69 66 0d Ptr p);..#endif.
116f0 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
11700 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
11710 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
11720 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
11730 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
11740 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
11750 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
11760 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
11770 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
11780 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
11790 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
117a0 65 72 6e 20 54 79 70 65 41 66 66 69 6e 69 74 79 ern TypeAffinity
117b0 20 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 74 sqlite3_value_t
117c0 79 70 65 28 49 6e 74 50 74 72 20 70 29 3b 0d 0a ype(IntPtr p);..
117d0 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
117e0 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
117f0 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
11800 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
11810 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
11820 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
11830 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
11840 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
11850 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
11860 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
11870 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
11880 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f rn void sqlite3_
11890 72 65 73 75 6c 74 5f 62 6c 6f 62 28 49 6e 74 50 result_blob(IntP
118a0 74 72 20 63 6f 6e 74 65 78 74 2c 20 62 79 74 65 tr context, byte
118b0 5b 5d 20 76 61 6c 75 65 2c 20 69 6e 74 20 6e 53 [] value, int nS
118c0 69 7a 65 2c 20 49 6e 74 50 74 72 20 70 76 52 65 ize, IntPtr pvRe
118d0 73 65 72 76 65 64 29 3b 0d 0a 0d 0a 23 69 66 20 served);....#if
118e0 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
118f0 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
11900 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
11910 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
11920 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
11930 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
11940 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e cl)].. intern
11950 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
11960 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 void sqlite3_re
11970 73 75 6c 74 5f 64 6f 75 62 6c 65 28 49 6e 74 50 sult_double(IntP
11980 74 72 20 63 6f 6e 74 65 78 74 2c 20 64 6f 75 62 tr context, doub
11990 6c 65 20 76 61 6c 75 65 29 3b 0d 0a 23 65 6e 64 le value);..#end
119a0 69 66 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 if....#if !PLATF
119b0 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
119c0 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
119d0 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
119e0 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
119f0 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
11a00 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
11a10 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
11a20 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
11a30 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
11a40 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
11a50 65 78 74 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 extern void sqli
11a60 74 65 33 5f 72 65 73 75 6c 74 5f 65 72 72 6f 72 te3_result_error
11a70 28 49 6e 74 50 74 72 20 63 6f 6e 74 65 78 74 2c (IntPtr context,
11a80 20 62 79 74 65 5b 5d 20 73 74 72 45 72 72 2c 20 byte[] strErr,
11a90 69 6e 74 20 6e 4c 65 6e 29 3b 0d 0a 0d 0a 23 69 int nLen);....#i
11aa0 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
11ab0 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
11ac0 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
11ad0 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
11ae0 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
11af0 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
11b00 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
11b10 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
11b20 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
11b30 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
11b40 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 static extern v
11b50 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 73 75 oid sqlite3_resu
11b60 6c 74 5f 65 72 72 6f 72 5f 63 6f 64 65 28 49 6e lt_error_code(In
11b70 74 50 74 72 20 63 6f 6e 74 65 78 74 2c 20 53 51 tPtr context, SQ
11b80 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 76 61 LiteErrorCode va
11b90 6c 75 65 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c lue);....#if !PL
11ba0 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
11bb0 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
11bc0 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
11bd0 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
11be0 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
11bf0 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
11c00 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
11c10 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
11c20 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
11c30 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
11c40 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 ic extern void s
11c50 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 65 72 qlite3_result_er
11c60 72 6f 72 5f 74 6f 6f 62 69 67 28 49 6e 74 50 74 ror_toobig(IntPt
11c70 72 20 63 6f 6e 74 65 78 74 29 3b 0d 0a 0d 0a 23 r context);....#
11c80 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
11c90 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
11ca0 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
11cb0 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
11cc0 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
11cd0 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
11ce0 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
11cf0 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
11d00 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
11d10 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
11d20 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
11d30 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 73 void sqlite3_res
11d40 75 6c 74 5f 65 72 72 6f 72 5f 6e 6f 6d 65 6d 28 ult_error_nomem(
11d50 49 6e 74 50 74 72 20 63 6f 6e 74 65 78 74 29 3b IntPtr context);
11d60 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
11d70 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
11d80 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
11d90 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
11da0 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
11db0 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
11dc0 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
11dd0 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
11de0 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
11df0 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
11e00 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
11e10 74 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 tern void sqlite
11e20 33 5f 72 65 73 75 6c 74 5f 76 61 6c 75 65 28 49 3_result_value(I
11e30 6e 74 50 74 72 20 63 6f 6e 74 65 78 74 2c 20 49 ntPtr context, I
11e40 6e 74 50 74 72 20 76 61 6c 75 65 29 3b 0d 0a 0d ntPtr value);...
11e50 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
11e60 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
11e70 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
11e80 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
11e90 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
11ea0 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
11eb0 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
11ec0 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
11ed0 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
11ee0 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
11ef0 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
11f00 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 n void sqlite3_r
11f10 65 73 75 6c 74 5f 7a 65 72 6f 62 6c 6f 62 28 49 esult_zeroblob(I
11f20 6e 74 50 74 72 20 63 6f 6e 74 65 78 74 2c 20 69 ntPtr context, i
11f30 6e 74 20 6e 4c 65 6e 29 3b 0d 0a 0d 0a 23 69 66 nt nLen);....#if
11f40 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
11f50 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
11f60 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
11f70 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
11f80 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
11f90 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
11fa0 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
11fb0 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
11fc0 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
11fd0 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
11fe0 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 6f static extern vo
11ff0 69 64 20 73 71 6c 69 74 65 33 5f 72 65 73 75 6c id sqlite3_resul
12000 74 5f 69 6e 74 28 49 6e 74 50 74 72 20 63 6f 6e t_int(IntPtr con
12010 74 65 78 74 2c 20 69 6e 74 20 76 61 6c 75 65 29 text, int value)
12020 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f ;....#if !PLATFO
12030 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
12040 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
12050 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
12060 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
12070 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
12080 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 20 ntion.Cdecl)]..
12090 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
120a0 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 ic extern void s
120b0 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 69 6e qlite3_result_in
120c0 74 36 34 28 49 6e 74 50 74 72 20 63 6f 6e 74 65 t64(IntPtr conte
120d0 78 74 2c 20 6c 6f 6e 67 20 76 61 6c 75 65 29 3b xt, long value);
120e0 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 ..#endif....#if
120f0 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
12100 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
12110 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
12120 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
12130 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
12140 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
12150 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
12160 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
12170 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
12180 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
12190 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 6f 69 tatic extern voi
121a0 64 20 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 d sqlite3_result
121b0 5f 6e 75 6c 6c 28 49 6e 74 50 74 72 20 63 6f 6e _null(IntPtr con
121c0 74 65 78 74 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 text);....#if !P
121d0 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
121e0 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
121f0 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
12200 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
12210 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
12220 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
12230 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
12240 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
12250 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
12260 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
12270 74 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 tic extern void
12280 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 74 sqlite3_result_t
12290 65 78 74 28 49 6e 74 50 74 72 20 63 6f 6e 74 65 ext(IntPtr conte
122a0 78 74 2c 20 62 79 74 65 5b 5d 20 76 61 6c 75 65 xt, byte[] value
122b0 2c 20 69 6e 74 20 6e 4c 65 6e 2c 20 49 6e 74 50 , int nLen, IntP
122c0 74 72 20 70 76 52 65 73 65 72 76 65 64 29 3b 0d tr pvReserved);.
122d0 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
122e0 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
122f0 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
12300 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
12310 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
12320 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
12330 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
12340 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
12350 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
12360 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
12370 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
12380 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 ern IntPtr sqlit
12390 65 33 5f 61 67 67 72 65 67 61 74 65 5f 63 6f 6e e3_aggregate_con
123a0 74 65 78 74 28 49 6e 74 50 74 72 20 63 6f 6e 74 text(IntPtr cont
123b0 65 78 74 2c 20 69 6e 74 20 6e 42 79 74 65 73 29 ext, int nBytes)
123c0 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f ;....#if !PLATFO
123d0 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
123e0 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
123f0 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
12400 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
12410 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
12420 6e 74 69 6f 6e 2e 43 64 65 63 6c 2c 20 43 68 61 ntion.Cdecl, Cha
12430 72 53 65 74 20 3d 20 43 68 61 72 53 65 74 2e 55 rSet = CharSet.U
12440 6e 69 63 6f 64 65 29 5d 0d 0a 23 65 6c 73 65 0d nicode)]..#else.
12450 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
12460 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 68 61 72 SQLITE_DLL, Char
12470 53 65 74 20 3d 20 43 68 61 72 53 65 74 2e 55 6e Set = CharSet.Un
12480 69 63 6f 64 65 29 5d 0d 0a 23 65 6e 64 69 66 0d icode)]..#endif.
12490 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
124a0 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 atic extern SQLi
124b0 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 teErrorCode sqli
124c0 74 65 33 5f 62 69 6e 64 5f 74 65 78 74 31 36 28 te3_bind_text16(
124d0 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 IntPtr stmt, int
124e0 20 69 6e 64 65 78 2c 20 73 74 72 69 6e 67 20 76 index, string v
124f0 61 6c 75 65 2c 20 69 6e 74 20 6e 6c 65 6e 2c 20 alue, int nlen,
12500 49 6e 74 50 74 72 20 70 76 52 65 73 65 72 76 65 IntPtr pvReserve
12510 64 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 d);....#if !PLAT
12520 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
12530 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
12540 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
12550 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
12560 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
12570 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 2c 20 43 vention.Cdecl, C
12580 68 61 72 53 65 74 20 3d 20 43 68 61 72 53 65 74 harSet = CharSet
12590 2e 55 6e 69 63 6f 64 65 29 5d 0d 0a 23 65 6c 73 .Unicode)]..#els
125a0 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
125b0 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 68 t(SQLITE_DLL, Ch
125c0 61 72 53 65 74 20 3d 20 43 68 61 72 53 65 74 2e arSet = CharSet.
125d0 55 6e 69 63 6f 64 65 29 5d 0d 0a 23 65 6e 64 69 Unicode)]..#endi
125e0 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
125f0 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 6f static extern vo
12600 69 64 20 73 71 6c 69 74 65 33 5f 72 65 73 75 6c id sqlite3_resul
12610 74 5f 65 72 72 6f 72 31 36 28 49 6e 74 50 74 72 t_error16(IntPtr
12620 20 63 6f 6e 74 65 78 74 2c 20 73 74 72 69 6e 67 context, string
12630 20 73 74 72 4e 61 6d 65 2c 20 69 6e 74 20 6e 4c strName, int nL
12640 65 6e 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 en);....#if !PLA
12650 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
12660 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
12670 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
12680 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
12690 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
126a0 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 2c 20 nvention.Cdecl,
126b0 43 68 61 72 53 65 74 20 3d 20 43 68 61 72 53 65 CharSet = CharSe
126c0 74 2e 55 6e 69 63 6f 64 65 29 5d 0d 0a 23 65 6c t.Unicode)]..#el
126d0 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
126e0 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
126f0 68 61 72 53 65 74 20 3d 20 43 68 61 72 53 65 74 harSet = CharSet
12700 2e 55 6e 69 63 6f 64 65 29 5d 0d 0a 23 65 6e 64 .Unicode)]..#end
12710 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
12720 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 static extern v
12730 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 73 75 oid sqlite3_resu
12740 6c 74 5f 74 65 78 74 31 36 28 49 6e 74 50 74 72 lt_text16(IntPtr
12750 20 63 6f 6e 74 65 78 74 2c 20 73 74 72 69 6e 67 context, string
12760 20 73 74 72 4e 61 6d 65 2c 20 69 6e 74 20 6e 4c strName, int nL
12770 65 6e 2c 20 49 6e 74 50 74 72 20 70 76 52 65 73 en, IntPtr pvRes
12780 65 72 76 65 64 29 3b 0d 0a 0d 0a 23 69 66 20 49 erved);....#if I
12790 4e 54 45 52 4f 50 5f 43 4f 44 45 43 20 7c 7c 20 NTEROP_CODEC ||
127a0 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 5f INTEROP_INCLUDE_
127b0 53 45 45 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f SEE..#if !PLATFO
127c0 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
127d0 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
127e0 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
127f0 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
12800 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
12810 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 ntion.Cdecl)]..#
12820 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d else.. [DllIm
12830 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
12840 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 ]..#endif.. i
12850 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 nternal static e
12860 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f xtern SQLiteErro
12870 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 6b 65 rCode sqlite3_ke
12880 79 28 49 6e 74 50 74 72 20 64 62 2c 20 62 79 74 y(IntPtr db, byt
12890 65 5b 5d 20 6b 65 79 2c 20 69 6e 74 20 6b 65 79 e[] key, int key
128a0 6c 65 6e 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c len);....#if !PL
128b0 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
128c0 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
128d0 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
128e0 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
128f0 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
12900 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
12910 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
12920 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
12930 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
12940 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
12950 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 ic extern SQLite
12960 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 ErrorCode sqlite
12970 33 5f 72 65 6b 65 79 28 49 6e 74 50 74 72 20 64 3_rekey(IntPtr d
12980 62 2c 20 62 79 74 65 5b 5d 20 6b 65 79 2c 20 69 b, byte[] key, i
12990 6e 74 20 6b 65 79 6c 65 6e 29 3b 0d 0a 23 65 6e nt keylen);..#en
129a0 64 69 66 0d 0a 0d 0a 23 69 66 20 49 4e 54 45 52 dif....#if INTER
129b0 4f 50 5f 49 4e 43 4c 55 44 45 5f 5a 49 50 56 46 OP_INCLUDE_ZIPVF
129c0 53 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d S..#if !PLATFORM
129d0 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
129e0 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
129f0 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
12a00 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
12a10 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
12a20 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
12a30 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
12a40 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
12a50 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
12a60 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
12a70 65 72 6e 20 76 6f 69 64 20 7a 69 70 76 66 73 49 ern void zipvfsI
12a80 6e 69 74 5f 76 32 28 29 3b 0d 0a 0d 0a 23 69 66 nit_v2();....#if
12a90 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
12aa0 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
12ab0 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
12ac0 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
12ad0 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
12ae0 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
12af0 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
12b00 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
12b10 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
12b20 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
12b30 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 6f static extern vo
12b40 69 64 20 7a 69 70 76 66 73 49 6e 69 74 5f 76 33 id zipvfsInit_v3
12b50 28 69 6e 74 20 72 65 67 44 66 6c 74 29 3b 0d 0a (int regDflt);..
12b60 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 #endif....#if !P
12b70 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
12b80 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
12b90 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
12ba0 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
12bb0 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
12bc0 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
12bd0 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
12be0 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
12bf0 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
12c00 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
12c10 74 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 tic extern void
12c20 73 71 6c 69 74 65 33 5f 70 72 6f 67 72 65 73 73 sqlite3_progress
12c30 5f 68 61 6e 64 6c 65 72 28 49 6e 74 50 74 72 20 _handler(IntPtr
12c40 64 62 2c 20 69 6e 74 20 6f 70 73 2c 20 53 51 4c db, int ops, SQL
12c50 69 74 65 50 72 6f 67 72 65 73 73 43 61 6c 6c 62 iteProgressCallb
12c60 61 63 6b 20 66 75 6e 63 2c 20 49 6e 74 50 74 72 ack func, IntPtr
12c70 20 70 76 55 73 65 72 29 3b 0d 0a 0d 0a 23 69 66 pvUser);....#if
12c80 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
12c90 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
12ca0 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
12cb0 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
12cc0 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
12cd0 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
12ce0 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
12cf0 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
12d00 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
12d10 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
12d20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
12d30 74 50 74 72 20 73 71 6c 69 74 65 33 5f 73 65 74 tPtr sqlite3_set
12d40 5f 61 75 74 68 6f 72 69 7a 65 72 28 49 6e 74 50 _authorizer(IntP
12d50 74 72 20 64 62 2c 20 53 51 4c 69 74 65 41 75 74 tr db, SQLiteAut
12d60 68 6f 72 69 7a 65 72 43 61 6c 6c 62 61 63 6b 20 horizerCallback
12d70 66 75 6e 63 2c 20 49 6e 74 50 74 72 20 70 76 55 func, IntPtr pvU
12d80 73 65 72 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c ser);....#if !PL
12d90 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
12da0 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
12db0 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
12dc0 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
12dd0 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
12de0 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
12df0 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
12e00 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
12e10 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
12e20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
12e30 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 ic extern IntPtr
12e40 20 73 71 6c 69 74 65 33 5f 75 70 64 61 74 65 5f sqlite3_update_
12e50 68 6f 6f 6b 28 49 6e 74 50 74 72 20 64 62 2c 20 hook(IntPtr db,
12e60 53 51 4c 69 74 65 55 70 64 61 74 65 43 61 6c 6c SQLiteUpdateCall
12e70 62 61 63 6b 20 66 75 6e 63 2c 20 49 6e 74 50 74 back func, IntPt
12e80 72 20 70 76 55 73 65 72 29 3b 0d 0a 0d 0a 23 69 r pvUser);....#i
12e90 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
12ea0 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
12eb0 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
12ec0 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
12ed0 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
12ee0 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
12ef0 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
12f00 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
12f10 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
12f20 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
12f30 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 static extern I
12f40 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f ntPtr sqlite3_co
12f50 6d 6d 69 74 5f 68 6f 6f 6b 28 49 6e 74 50 74 72 mmit_hook(IntPtr
12f60 20 64 62 2c 20 53 51 4c 69 74 65 43 6f 6d 6d 69 db, SQLiteCommi
12f70 74 43 61 6c 6c 62 61 63 6b 20 66 75 6e 63 2c 20 tCallback func,
12f80 49 6e 74 50 74 72 20 70 76 55 73 65 72 29 3b 0d IntPtr pvUser);.
12f90 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
12fa0 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
12fb0 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
12fc0 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
12fd0 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
12fe0 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
12ff0 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
13000 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
13010 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
13020 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
13030 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
13040 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 ern IntPtr sqlit
13050 65 33 5f 74 72 61 63 65 28 49 6e 74 50 74 72 20 e3_trace(IntPtr
13060 64 62 2c 20 53 51 4c 69 74 65 54 72 61 63 65 43 db, SQLiteTraceC
13070 61 6c 6c 62 61 63 6b 20 66 75 6e 63 2c 20 49 6e allback func, In
13080 74 50 74 72 20 70 76 55 73 65 72 29 3b 0d 0a 0d tPtr pvUser);...
13090 0a 20 20 20 20 2f 2f 20 53 69 6e 63 65 20 73 71 . // Since sq
130a0 6c 69 74 65 33 5f 63 6f 6e 66 69 67 28 29 20 74 lite3_config() t
130b0 61 6b 65 73 20 61 20 76 61 72 69 61 62 6c 65 20 akes a variable
130c0 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 2c 20 77 argument list, w
130d0 65 20 68 61 76 65 20 74 6f 20 6f 76 65 72 6c 6f e have to overlo
130e0 61 64 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 0d ad declarations.
130f0 0a 20 20 20 20 2f 2f 20 66 6f 72 20 61 6c 6c 20 . // for all
13100 70 6f 73 73 69 62 6c 65 20 63 61 6c 6c 73 20 74 possible calls t
13110 68 61 74 20 77 65 20 77 61 6e 74 20 74 6f 20 75 hat we want to u
13120 73 65 2e 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f se...#if !PLATFO
13130 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
13140 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
13150 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
13160 45 6e 74 72 79 50 6f 69 6e 74 20 3d 20 22 73 71 EntryPoint = "sq
13170 6c 69 74 65 33 5f 63 6f 6e 66 69 67 22 2c 20 43 lite3_config", C
13180 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
13190 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
131a0 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
131b0 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
131c0 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
131d0 45 6e 74 72 79 50 6f 69 6e 74 20 3d 20 22 73 71 EntryPoint = "sq
131e0 6c 69 74 65 33 5f 63 6f 6e 66 69 67 22 29 5d 0d lite3_config")].
131f0 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
13200 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
13210 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 ern SQLiteErrorC
13220 6f 64 65 20 73 71 6c 69 74 65 33 5f 63 6f 6e 66 ode sqlite3_conf
13230 69 67 5f 6e 6f 6e 65 28 53 51 4c 69 74 65 43 6f ig_none(SQLiteCo
13240 6e 66 69 67 4f 70 73 45 6e 75 6d 20 6f 70 29 3b nfigOpsEnum op);
13250 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
13260 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
13270 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
13280 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 45 rt(SQLITE_DLL, E
13290 6e 74 72 79 50 6f 69 6e 74 20 3d 20 22 73 71 6c ntryPoint = "sql
132a0 69 74 65 33 5f 63 6f 6e 66 69 67 22 2c 20 43 61 ite3_config", Ca
132b0 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
132c0 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
132d0 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
132e0 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
132f0 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 45 rt(SQLITE_DLL, E
13300 6e 74 72 79 50 6f 69 6e 74 20 3d 20 22 73 71 6c ntryPoint = "sql
13310 69 74 65 33 5f 63 6f 6e 66 69 67 22 29 5d 0d 0a ite3_config")]..
13320 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
13330 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
13340 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f rn SQLiteErrorCo
13350 64 65 20 73 71 6c 69 74 65 33 5f 63 6f 6e 66 69 de sqlite3_confi
13360 67 5f 69 6e 74 28 53 51 4c 69 74 65 43 6f 6e 66 g_int(SQLiteConf
13370 69 67 4f 70 73 45 6e 75 6d 20 6f 70 2c 20 69 6e igOpsEnum op, in
13380 74 20 76 61 6c 75 65 29 3b 0d 0a 0d 0a 23 69 66 t value);....#if
13390 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
133a0 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
133b0 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
133c0 54 45 5f 44 4c 4c 2c 20 45 6e 74 72 79 50 6f 69 TE_DLL, EntryPoi
133d0 6e 74 20 3d 20 22 73 71 6c 69 74 65 33 5f 63 6f nt = "sqlite3_co
133e0 6e 66 69 67 22 2c 20 43 61 6c 6c 69 6e 67 43 6f nfig", CallingCo
133f0 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
13400 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
13410 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
13420 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
13430 54 45 5f 44 4c 4c 2c 20 45 6e 74 72 79 50 6f 69 TE_DLL, EntryPoi
13440 6e 74 20 3d 20 22 73 71 6c 69 74 65 33 5f 63 6f nt = "sqlite3_co
13450 6e 66 69 67 22 29 5d 0d 0a 23 65 6e 64 69 66 0d nfig")]..#endif.
13460 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
13470 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 atic extern SQLi
13480 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 teErrorCode sqli
13490 74 65 33 5f 63 6f 6e 66 69 67 5f 6c 6f 67 28 53 te3_config_log(S
134a0 51 4c 69 74 65 43 6f 6e 66 69 67 4f 70 73 45 6e QLiteConfigOpsEn
134b0 75 6d 20 6f 70 2c 20 53 51 4c 69 74 65 4c 6f 67 um op, SQLiteLog
134c0 43 61 6c 6c 62 61 63 6b 20 66 75 6e 63 2c 20 49 Callback func, I
134d0 6e 74 50 74 72 20 70 76 55 73 65 72 29 3b 0d 0a ntPtr pvUser);..
134e0 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
134f0 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
13500 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
13510 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
13520 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
13530 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
13540 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
13550 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
13560 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
13570 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
13580 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
13590 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 rn IntPtr sqlite
135a0 33 5f 72 6f 6c 6c 62 61 63 6b 5f 68 6f 6f 6b 28 3_rollback_hook(
135b0 49 6e 74 50 74 72 20 64 62 2c 20 53 51 4c 69 74 IntPtr db, SQLit
135c0 65 52 6f 6c 6c 62 61 63 6b 43 61 6c 6c 62 61 63 eRollbackCallbac
135d0 6b 20 66 75 6e 63 2c 20 49 6e 74 50 74 72 20 70 k func, IntPtr p
135e0 76 55 73 65 72 29 3b 0d 0a 0d 0a 23 69 66 20 21 vUser);....#if !
135f0 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
13600 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
13610 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
13620 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
13630 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
13640 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
13650 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
13660 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
13670 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
13680 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
13690 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 atic extern IntP
136a0 74 72 20 73 71 6c 69 74 65 33 5f 64 62 5f 68 61 tr sqlite3_db_ha
136b0 6e 64 6c 65 28 49 6e 74 50 74 72 20 73 74 6d 74 ndle(IntPtr stmt
136c0 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 );....#if !PLATF
136d0 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
136e0 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
136f0 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
13700 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
13710 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
13720 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
13730 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
13740 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
13750 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
13760 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
13770 65 78 74 65 72 6e 20 53 51 4c 69 74 65 45 72 72 extern SQLiteErr
13780 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 33 5f 64 orCode sqlite3_d
13790 62 5f 72 65 6c 65 61 73 65 5f 6d 65 6d 6f 72 79 b_release_memory
137a0 28 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a (IntPtr db);....
137b0 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
137c0 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
137d0 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
137e0 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
137f0 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
13800 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
13810 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
13820 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
13830 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
13840 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
13850 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
13860 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f IntPtr sqlite3_
13870 64 62 5f 66 69 6c 65 6e 61 6d 65 28 49 6e 74 50 db_filename(IntP
13880 74 72 20 64 62 2c 20 49 6e 74 50 74 72 20 64 62 tr db, IntPtr db
13890 4e 61 6d 65 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 Name);....#if !P
138a0 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
138b0 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
138c0 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
138d0 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
138e0 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
138f0 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
13900 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
13910 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
13920 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
13930 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
13940 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 tic extern IntPt
13950 72 20 73 71 6c 69 74 65 33 5f 6e 65 78 74 5f 73 r sqlite3_next_s
13960 74 6d 74 28 49 6e 74 50 74 72 20 64 62 2c 20 49 tmt(IntPtr db, I
13970 6e 74 50 74 72 20 73 74 6d 74 29 3b 0d 0a 0d 0a ntPtr stmt);....
13980 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
13990 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
139a0 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
139b0 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
139c0 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
139d0 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
139e0 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
139f0 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
13a00 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
13a10 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
13a20 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
13a30 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 SQLiteErrorCode
13a40 20 73 71 6c 69 74 65 33 5f 65 78 65 63 28 49 6e sqlite3_exec(In
13a50 74 50 74 72 20 64 62 2c 20 62 79 74 65 5b 5d 20 tPtr db, byte[]
13a60 73 74 72 53 71 6c 2c 20 49 6e 74 50 74 72 20 70 strSql, IntPtr p
13a70 76 43 61 6c 6c 62 61 63 6b 2c 20 49 6e 74 50 74 vCallback, IntPt
13a80 72 20 70 76 50 61 72 61 6d 2c 20 72 65 66 20 49 r pvParam, ref I
13a90 6e 74 50 74 72 20 65 72 72 4d 73 67 29 3b 0d 0a ntPtr errMsg);..
13aa0 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
13ab0 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
13ac0 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
13ad0 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
13ae0 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
13af0 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
13b00 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
13b10 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
13b20 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
13b30 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
13b40 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
13b50 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 72 rn int sqlite3_r
13b60 65 6c 65 61 73 65 5f 6d 65 6d 6f 72 79 28 69 6e elease_memory(in
13b70 74 20 6e 42 79 74 65 73 29 3b 0d 0a 0d 0a 23 69 t nBytes);....#i
13b80 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
13b90 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
13ba0 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
13bb0 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
13bc0 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
13bd0 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
13be0 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
13bf0 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
13c00 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
13c10 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
13c20 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 static extern i
13c30 6e 74 20 73 71 6c 69 74 65 33 5f 67 65 74 5f 61 nt sqlite3_get_a
13c40 75 74 6f 63 6f 6d 6d 69 74 28 49 6e 74 50 74 72 utocommit(IntPtr
13c50 20 64 62 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c db);....#if !PL
13c60 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
13c70 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
13c80 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
13c90 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
13ca0 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
13cb0 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
13cc0 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
13cd0 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
13ce0 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
13cf0 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
13d00 69 63 20 65 78 74 65 72 6e 20 53 51 4c 69 74 65 ic extern SQLite
13d10 45 72 72 6f 72 43 6f 64 65 20 73 71 6c 69 74 65 ErrorCode sqlite
13d20 33 5f 65 78 74 65 6e 64 65 64 5f 72 65 73 75 6c 3_extended_resul
13d30 74 5f 63 6f 64 65 73 28 49 6e 74 50 74 72 20 64 t_codes(IntPtr d
13d40 62 2c 20 69 6e 74 20 6f 6e 6f 66 66 29 3b 0d 0a b, int onoff);..
13d50 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
13d60 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
13d70 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
13d80 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
13d90 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
13da0 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
13db0 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
13dc0 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
13dd0 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
13de0 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
13df0 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
13e00 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f rn SQLiteErrorCo
13e10 64 65 20 73 71 6c 69 74 65 33 5f 65 72 72 63 6f de sqlite3_errco
13e20 64 65 28 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a de(IntPtr db);..
13e30 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
13e40 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
13e50 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
13e60 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
13e70 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
13e80 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
13e90 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
13ea0 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
13eb0 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
13ec0 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
13ed0 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
13ee0 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f rn SQLiteErrorCo
13ef0 64 65 20 73 71 6c 69 74 65 33 5f 65 78 74 65 6e de sqlite3_exten
13f00 64 65 64 5f 65 72 72 63 6f 64 65 28 49 6e 74 50 ded_errcode(IntP
13f10 74 72 20 64 62 29 3b 0d 0a 0d 0a 23 69 66 20 21 tr db);....#if !
13f20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
13f30 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
13f40 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
13f50 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
13f60 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
13f70 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
13f80 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
13f90 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
13fa0 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
13fb0 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
13fc0 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 atic extern IntP
13fd0 74 72 20 73 71 6c 69 74 65 33 5f 65 72 72 73 74 tr sqlite3_errst
13fe0 72 28 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 r(SQLiteErrorCod
13ff0 65 20 72 63 29 3b 20 2f 2a 20 33 2e 37 2e 31 35 e rc); /* 3.7.15
14000 2b 20 2a 2f 0d 0a 0d 0a 20 20 20 20 2f 2f 20 53 + */.... // S
14010 69 6e 63 65 20 73 71 6c 69 74 65 33 5f 6c 6f 67 ince sqlite3_log
14020 28 29 20 74 61 6b 65 73 20 61 20 76 61 72 69 61 () takes a varia
14030 62 6c 65 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 ble argument lis
14040 74 2c 20 77 65 20 68 61 76 65 20 74 6f 20 6f 76 t, we have to ov
14050 65 72 6c 6f 61 64 20 64 65 63 6c 61 72 61 74 69 erload declarati
14060 6f 6e 73 0d 0a 20 20 20 20 2f 2f 20 66 6f 72 20 ons.. // for
14070 61 6c 6c 20 70 6f 73 73 69 62 6c 65 20 63 61 6c all possible cal
14080 6c 73 2e 20 20 46 6f 72 20 6e 6f 77 2c 20 77 65 ls. For now, we
14090 20 61 72 65 20 6f 6e 6c 79 20 65 78 70 6f 73 69 are only exposi
140a0 6e 67 20 61 20 73 69 6e 67 6c 65 20 73 74 72 69 ng a single stri
140b0 6e 67 2c 20 61 6e 64 0d 0a 20 20 20 20 2f 2f 20 ng, and.. //
140c0 64 65 70 65 6e 64 20 6f 6e 20 74 68 65 20 63 61 depend on the ca
140d0 6c 6c 65 72 20 74 6f 20 66 6f 72 6d 61 74 20 74 ller to format t
140e0 68 65 20 73 74 72 69 6e 67 2e 0d 0a 23 69 66 20 he string...#if
140f0 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
14100 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
14110 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
14120 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
14130 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
14140 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
14150 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
14160 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
14170 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
14180 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
14190 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 6f 69 tatic extern voi
141a0 64 20 73 71 6c 69 74 65 33 5f 6c 6f 67 28 53 51 d sqlite3_log(SQ
141b0 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 69 45 LiteErrorCode iE
141c0 72 72 43 6f 64 65 2c 20 62 79 74 65 5b 5d 20 7a rrCode, byte[] z
141d0 46 6f 72 6d 61 74 29 3b 0d 0a 0d 0a 23 69 66 20 Format);....#if
141e0 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
141f0 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
14200 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
14210 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
14220 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
14230 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
14240 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
14250 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
14260 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
14270 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
14280 74 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c tatic extern SQL
14290 69 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c iteErrorCode sql
142a0 69 74 65 33 5f 66 69 6c 65 5f 63 6f 6e 74 72 6f ite3_file_contro
142b0 6c 28 49 6e 74 50 74 72 20 64 62 2c 20 62 79 74 l(IntPtr db, byt
142c0 65 5b 5d 20 7a 44 62 4e 61 6d 65 2c 20 69 6e 74 e[] zDbName, int
142d0 20 6f 70 2c 20 49 6e 74 50 74 72 20 70 41 72 67 op, IntPtr pArg
142e0 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 );....#if !PLATF
142f0 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
14300 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
14310 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
14320 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
14330 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
14340 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
14350 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
14360 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
14370 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
14380 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
14390 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 extern IntPtr sq
143a0 6c 69 74 65 33 5f 62 61 63 6b 75 70 5f 69 6e 69 lite3_backup_ini
143b0 74 28 49 6e 74 50 74 72 20 64 65 73 74 44 62 2c t(IntPtr destDb,
143c0 20 62 79 74 65 5b 5d 20 7a 44 65 73 74 4e 61 6d byte[] zDestNam
143d0 65 2c 20 49 6e 74 50 74 72 20 73 6f 75 72 63 65 e, IntPtr source
143e0 44 62 2c 20 62 79 74 65 5b 5d 20 7a 53 6f 75 72 Db, byte[] zSour
143f0 63 65 4e 61 6d 65 29 3b 0d 0a 0d 0a 23 69 66 20 ceName);....#if
14400 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
14410 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
14420 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
14430 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
14440 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
14450 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
14460 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
14470 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
14480 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
14490 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
144a0 74 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 4c tatic extern SQL
144b0 69 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 6c iteErrorCode sql
144c0 69 74 65 33 5f 62 61 63 6b 75 70 5f 73 74 65 70 ite3_backup_step
144d0 28 49 6e 74 50 74 72 20 62 61 63 6b 75 70 2c 20 (IntPtr backup,
144e0 69 6e 74 20 6e 50 61 67 65 29 3b 0d 0a 0d 0a 23 int nPage);....#
144f0 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
14500 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
14510 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
14520 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
14530 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
14540 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
14550 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
14560 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
14570 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
14580 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
14590 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
145a0 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 61 63 6b int sqlite3_back
145b0 75 70 5f 72 65 6d 61 69 6e 69 6e 67 28 49 6e 74 up_remaining(Int
145c0 50 74 72 20 62 61 63 6b 75 70 29 3b 0d 0a 0d 0a Ptr backup);....
145d0 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
145e0 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
145f0 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
14600 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
14610 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
14620 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
14630 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
14640 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
14650 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
14660 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
14670 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
14680 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 61 63 int sqlite3_bac
14690 6b 75 70 5f 70 61 67 65 63 6f 75 6e 74 28 49 6e kup_pagecount(In
146a0 74 50 74 72 20 62 61 63 6b 75 70 29 3b 0d 0a 0d tPtr backup);...
146b0 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
146c0 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
146d0 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
146e0 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
146f0 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
14700 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
14710 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
14720 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
14730 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
14740 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
14750 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
14760 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 n SQLiteErrorCod
14770 65 20 73 71 6c 69 74 65 33 5f 64 65 63 6c 61 72 e sqlite3_declar
14780 65 5f 76 74 61 62 28 49 6e 74 50 74 72 20 64 62 e_vtab(IntPtr db
14790 2c 20 49 6e 74 50 74 72 20 7a 53 51 4c 29 3b 0d , IntPtr zSQL);.
147a0 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
147b0 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
147c0 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
147d0 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
147e0 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
147f0 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
14800 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
14810 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
14820 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
14830 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
14840 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
14850 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 ern IntPtr sqlit
14860 65 33 5f 6d 70 72 69 6e 74 66 28 49 6e 74 50 74 e3_mprintf(IntPt
14870 72 20 66 6f 72 6d 61 74 2c 20 5f 5f 61 72 67 6c r format, __argl
14880 69 73 74 29 3b 0d 0a 20 20 20 20 23 65 6e 64 72 ist);.. #endr
14890 65 67 69 6f 6e 0d 0a 0d 0a 20 20 20 20 2f 2f 20 egion.... //
148a0 53 51 4c 69 74 65 20 41 50 49 20 63 61 6c 6c 73 SQLite API calls
148b0 20 74 68 61 74 20 61 72 65 20 70 72 6f 76 69 64 that are provid
148c0 65 64 20 62 79 20 22 77 65 6c 6c 2d 6b 6e 6f 77 ed by "well-know
148d0 6e 22 20 65 78 74 65 6e 73 69 6f 6e 73 20 74 68 n" extensions th
148e0 61 74 20 6d 61 79 20 62 65 20 73 74 61 74 69 63 at may be static
148f0 61 6c 6c 79 0d 0a 20 20 20 20 2f 2f 20 6c 69 6e ally.. // lin
14900 6b 65 64 20 77 69 74 68 20 74 68 65 20 53 51 4c ked with the SQL
14910 69 74 65 20 63 6f 72 65 20 6e 61 74 69 76 65 20 ite core native
14920 6c 69 62 72 61 72 79 20 63 75 72 72 65 6e 74 6c library currentl
14930 79 20 69 6e 20 75 73 65 2e 0d 0a 20 20 20 20 23 y in use... #
14940 72 65 67 69 6f 6e 20 65 78 74 65 6e 73 69 6f 6e region extension
14950 20 73 71 6c 69 74 65 20 61 70 69 20 63 61 6c 6c sqlite api call
14960 73 0d 0a 23 69 66 20 49 4e 54 45 52 4f 50 5f 56 s..#if INTEROP_V
14970 49 52 54 55 41 4c 5f 54 41 42 4c 45 0d 0a 23 69 IRTUAL_TABLE..#i
14980 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
14990 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
149a0 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
149b0 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
149c0 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
149d0 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
149e0 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
149f0 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
14a00 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
14a10 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
14a20 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 static extern I
14a30 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 72 ntPtr sqlite3_cr
14a40 65 61 74 65 5f 64 69 73 70 6f 73 61 62 6c 65 5f eate_disposable_
14a50 6d 6f 64 75 6c 65 28 49 6e 74 50 74 72 20 64 62 module(IntPtr db
14a60 2c 20 49 6e 74 50 74 72 20 6e 61 6d 65 2c 20 72 , IntPtr name, r
14a70 65 66 20 73 71 6c 69 74 65 33 5f 6d 6f 64 75 6c ef sqlite3_modul
14a80 65 20 6d 6f 64 75 6c 65 2c 20 49 6e 74 50 74 72 e module, IntPtr
14a90 20 70 43 6c 69 65 6e 74 44 61 74 61 2c 20 78 44 pClientData, xD
14aa0 65 73 74 72 6f 79 4d 6f 64 75 6c 65 20 78 44 65 estroyModule xDe
14ab0 73 74 72 6f 79 29 3b 0d 0a 0d 0a 23 69 66 20 21 stroy);....#if !
14ac0 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
14ad0 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
14ae0 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
14af0 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
14b00 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
14b10 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
14b20 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
14b30 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
14b40 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
14b50 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
14b60 61 74 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 atic extern void
14b70 20 73 71 6c 69 74 65 33 5f 64 69 73 70 6f 73 65 sqlite3_dispose
14b80 5f 6d 6f 64 75 6c 65 28 49 6e 74 50 74 72 20 70 _module(IntPtr p
14b90 4d 6f 64 75 6c 65 29 3b 0d 0a 23 65 6e 64 69 66 Module);..#endif
14ba0 0d 0a 20 20 20 20 23 65 6e 64 72 65 67 69 6f 6e .. #endregion
14bb0 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f .... ////////
14bc0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
14bd0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
14be0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
14bf0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
14c00 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 23 72 65 67 69 ///.... #regi
14c10 6f 6e 20 73 71 6c 69 74 65 20 69 6e 74 65 72 6f on sqlite intero
14c20 70 20 61 70 69 20 63 61 6c 6c 73 20 28 2e 4e 45 p api calls (.NE
14c30 54 20 43 6f 6d 70 61 63 74 20 46 72 61 6d 65 77 T Compact Framew
14c40 6f 72 6b 20 6f 6e 6c 79 29 0d 0a 23 69 66 20 50 ork only)..#if P
14c50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
14c60 52 41 4d 45 57 4f 52 4b 20 26 26 20 21 53 51 4c RAMEWORK && !SQL
14c70 49 54 45 5f 53 54 41 4e 44 41 52 44 0d 0a 20 20 ITE_STANDARD..
14c80 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
14c90 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 ITE_DLL)].. i
14ca0 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 nternal static e
14cb0 78 74 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 xtern void sqlit
14cc0 65 33 5f 6c 61 73 74 5f 69 6e 73 65 72 74 5f 72 e3_last_insert_r
14cd0 6f 77 69 64 5f 69 6e 74 65 72 6f 70 28 49 6e 74 owid_interop(Int
14ce0 50 74 72 20 64 62 2c 20 72 65 66 20 6c 6f 6e 67 Ptr db, ref long
14cf0 20 72 6f 77 49 64 29 3b 0d 0a 0d 0a 20 20 20 20 rowId);....
14d00 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
14d10 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 E_DLL)].. int
14d20 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
14d30 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 33 ern void sqlite3
14d40 5f 6d 65 6d 6f 72 79 5f 75 73 65 64 5f 69 6e 74 _memory_used_int
14d50 65 72 6f 70 28 72 65 66 20 6c 6f 6e 67 20 62 79 erop(ref long by
14d60 74 65 73 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c tes);.... [Dl
14d70 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
14d80 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e LL)].. intern
14d90 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
14da0 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 6d 65 void sqlite3_me
14db0 6d 6f 72 79 5f 68 69 67 68 77 61 74 65 72 5f 69 mory_highwater_i
14dc0 6e 74 65 72 6f 70 28 69 6e 74 20 72 65 73 65 74 nterop(int reset
14dd0 46 6c 61 67 2c 20 72 65 66 20 6c 6f 6e 67 20 62 Flag, ref long b
14de0 79 74 65 73 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 ytes);.... [D
14df0 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
14e00 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 DLL)].. inter
14e10 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
14e20 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 n SQLiteErrorCod
14e30 65 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 64 e sqlite3_bind_d
14e40 6f 75 62 6c 65 5f 69 6e 74 65 72 6f 70 28 49 6e ouble_interop(In
14e50 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 tPtr stmt, int i
14e60 6e 64 65 78 2c 20 72 65 66 20 64 6f 75 62 6c 65 ndex, ref double
14e70 20 76 61 6c 75 65 29 3b 0d 0a 0d 0a 20 20 20 20 value);....
14e80 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
14e90 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 E_DLL)].. int
14ea0 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
14eb0 65 72 6e 20 53 51 4c 69 74 65 45 72 72 6f 72 43 ern SQLiteErrorC
14ec0 6f 64 65 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 ode sqlite3_bind
14ed0 5f 69 6e 74 36 34 5f 69 6e 74 65 72 6f 70 28 49 _int64_interop(I
14ee0 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 ntPtr stmt, int
14ef0 69 6e 64 65 78 2c 20 72 65 66 20 6c 6f 6e 67 20 index, ref long
14f00 76 61 6c 75 65 29 3b 0d 0a 0d 0a 20 20 20 20 5b value);.... [
14f10 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
14f20 5f 44 4c 4c 2c 20 45 6e 74 72 79 50 6f 69 6e 74 _DLL, EntryPoint
14f30 20 3d 20 22 73 71 6c 69 74 65 33 5f 62 69 6e 64 = "sqlite3_bind
14f40 5f 69 6e 74 36 34 5f 69 6e 74 65 72 6f 70 22 29 _int64_interop")
14f50 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 ].. internal
14f60 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 53 51 static extern SQ
14f70 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 73 71 LiteErrorCode sq
14f80 6c 69 74 65 33 5f 62 69 6e 64 5f 75 69 6e 74 36 lite3_bind_uint6
14f90 34 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 4_interop(IntPtr
14fa0 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 stmt, int index
14fb0 2c 20 72 65 66 20 75 6c 6f 6e 67 20 76 61 6c 75 , ref ulong valu
14fc0 65 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 e);.... [DllI
14fd0 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
14fe0 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c )].. internal
14ff0 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 static extern v
15000 6f 69 64 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 oid sqlite3_colu
15010 6d 6e 5f 64 6f 75 62 6c 65 5f 69 6e 74 65 72 6f mn_double_intero
15020 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 p(IntPtr stmt, i
15030 6e 74 20 69 6e 64 65 78 2c 20 72 65 66 20 64 6f nt index, ref do
15040 75 62 6c 65 20 76 61 6c 75 65 29 3b 0d 0a 0d 0a uble value);....
15050 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
15060 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 QLITE_DLL)]..
15070 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
15080 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 71 6c extern void sql
15090 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 36 ite3_column_int6
150a0 34 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 4_interop(IntPtr
150b0 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 stmt, int index
150c0 2c 20 72 65 66 20 6c 6f 6e 67 20 76 61 6c 75 65 , ref long value
150d0 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d );.... [DllIm
150e0 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
150f0 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 ].. internal
15100 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 6f static extern vo
15110 69 64 20 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 id sqlite3_value
15120 5f 64 6f 75 62 6c 65 5f 69 6e 74 65 72 6f 70 28 _double_interop(
15130 49 6e 74 50 74 72 20 70 2c 20 72 65 66 20 64 6f IntPtr p, ref do
15140 75 62 6c 65 20 76 61 6c 75 65 29 3b 0d 0a 0d 0a uble value);....
15150 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
15160 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 QLITE_DLL)]..
15170 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
15180 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 71 6c extern void sql
15190 69 74 65 33 5f 76 61 6c 75 65 5f 69 6e 74 36 34 ite3_value_int64
151a0 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 _interop(IntPtr
151b0 70 2c 20 72 65 66 20 49 6e 74 36 34 20 76 61 6c p, ref Int64 val
151c0 75 65 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c ue);.... [Dll
151d0 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
151e0 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 L)].. interna
151f0 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
15200 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 73 void sqlite3_res
15210 75 6c 74 5f 64 6f 75 62 6c 65 5f 69 6e 74 65 72 ult_double_inter
15220 6f 70 28 49 6e 74 50 74 72 20 63 6f 6e 74 65 78 op(IntPtr contex
15230 74 2c 20 72 65 66 20 64 6f 75 62 6c 65 20 76 61 t, ref double va
15240 6c 75 65 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c lue);.... [Dl
15250 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
15260 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e LL)].. intern
15270 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
15280 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 void sqlite3_re
15290 73 75 6c 74 5f 69 6e 74 36 34 5f 69 6e 74 65 72 sult_int64_inter
152a0 6f 70 28 49 6e 74 50 74 72 20 63 6f 6e 74 65 78 op(IntPtr contex
152b0 74 2c 20 72 65 66 20 49 6e 74 36 34 20 76 61 6c t, ref Int64 val
152c0 75 65 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c ue);.... [Dll
152d0 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
152e0 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 L)].. interna
152f0 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
15300 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 IntPtr sqlite3_c
15310 72 65 61 74 65 5f 64 69 73 70 6f 73 61 62 6c 65 reate_disposable
15320 5f 6d 6f 64 75 6c 65 5f 69 6e 74 65 72 6f 70 28 _module_interop(
15330 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 74 72 .. IntPtr
15340 20 64 62 2c 20 49 6e 74 50 74 72 20 6e 61 6d 65 db, IntPtr name
15350 2c 20 49 6e 74 50 74 72 20 70 4d 6f 64 75 6c 65 , IntPtr pModule
15360 2c 20 69 6e 74 20 69 56 65 72 73 69 6f 6e 2c 20 , int iVersion,
15370 78 43 72 65 61 74 65 20 78 43 72 65 61 74 65 2c xCreate xCreate,
15380 0d 0a 20 20 20 20 20 20 20 20 78 43 6f 6e 6e 65 .. xConne
15390 63 74 20 78 43 6f 6e 6e 65 63 74 2c 20 78 42 65 ct xConnect, xBe
153a0 73 74 49 6e 64 65 78 20 78 42 65 73 74 49 6e 64 stIndex xBestInd
153b0 65 78 2c 20 78 44 69 73 63 6f 6e 6e 65 63 74 20 ex, xDisconnect
153c0 78 44 69 73 63 6f 6e 6e 65 63 74 2c 0d 0a 20 20 xDisconnect,..
153d0 20 20 20 20 20 20 78 44 65 73 74 72 6f 79 20 78 xDestroy x
153e0 44 65 73 74 72 6f 79 2c 20 78 4f 70 65 6e 20 78 Destroy, xOpen x
153f0 4f 70 65 6e 2c 20 78 43 6c 6f 73 65 20 78 43 6c Open, xClose xCl
15400 6f 73 65 2c 20 78 46 69 6c 74 65 72 20 78 46 69 ose, xFilter xFi
15410 6c 74 65 72 2c 0d 0a 20 20 20 20 20 20 20 20 78 lter,.. x
15420 4e 65 78 74 20 78 4e 65 78 74 2c 20 78 45 6f 66 Next xNext, xEof
15430 20 78 45 6f 66 2c 20 78 43 6f 6c 75 6d 6e 20 78 xEof, xColumn x
15440 43 6f 6c 75 6d 6e 2c 20 78 52 6f 77 49 64 20 78 Column, xRowId x
15450 52 6f 77 49 64 2c 20 78 55 70 64 61 74 65 20 78 RowId, xUpdate x
15460 55 70 64 61 74 65 2c 0d 0a 20 20 20 20 20 20 20 Update,..
15470 20 78 42 65 67 69 6e 20 78 42 65 67 69 6e 2c 20 xBegin xBegin,
15480 78 53 79 6e 63 20 78 53 79 6e 63 2c 20 78 43 6f xSync xSync, xCo
15490 6d 6d 69 74 20 78 43 6f 6d 6d 69 74 2c 20 78 52 mmit xCommit, xR
154a0 6f 6c 6c 62 61 63 6b 20 78 52 6f 6c 6c 62 61 63 ollback xRollbac
154b0 6b 2c 0d 0a 20 20 20 20 20 20 20 20 78 46 69 6e k,.. xFin
154c0 64 46 75 6e 63 74 69 6f 6e 20 78 46 69 6e 64 46 dFunction xFindF
154d0 75 6e 63 74 69 6f 6e 2c 20 78 52 65 6e 61 6d 65 unction, xRename
154e0 20 78 52 65 6e 61 6d 65 2c 20 78 53 61 76 65 70 xRename, xSavep
154f0 6f 69 6e 74 20 78 53 61 76 65 70 6f 69 6e 74 2c oint xSavepoint,
15500 0d 0a 20 20 20 20 20 20 20 20 78 52 65 6c 65 61 .. xRelea
15510 73 65 20 78 52 65 6c 65 61 73 65 2c 20 78 52 6f se xRelease, xRo
15520 6c 6c 62 61 63 6b 54 6f 20 78 52 6f 6c 6c 62 61 llbackTo xRollba
15530 63 6b 54 6f 2c 20 49 6e 74 50 74 72 20 70 43 6c ckTo, IntPtr pCl
15540 69 65 6e 74 44 61 74 61 2c 0d 0a 20 20 20 20 20 ientData,..
15550 20 20 20 78 44 65 73 74 72 6f 79 4d 6f 64 75 6c xDestroyModul
15560 65 20 78 44 65 73 74 72 6f 79 4d 6f 64 75 6c 65 e xDestroyModule
15570 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 );..#endif..
15580 2f 2f 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 // PLATFORM_COMP
15590 41 43 54 46 52 41 4d 45 57 4f 52 4b 20 26 26 20 ACTFRAMEWORK &&
155a0 21 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 !SQLITE_STANDARD
155b0 0d 0a 20 20 20 20 23 65 6e 64 72 65 67 69 6f 6e .. #endregion
155c0 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f .... ////////
155d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
155e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
155f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15600 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15610 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 23 72 65 67 69 ///.... #regi
15620 6f 6e 20 4e 61 74 69 76 65 20 44 65 6c 65 67 61 on Native Delega
15630 74 65 73 0d 0a 23 69 66 20 49 4e 54 45 52 4f 50 tes..#if INTEROP
15640 5f 56 49 52 54 55 41 4c 5f 54 41 42 4c 45 0d 0a _VIRTUAL_TABLE..
15650 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
15660 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
15670 20 20 20 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 [UnmanagedFu
15680 6e 63 74 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 nctionPointer(Ca
15690 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
156a0 43 64 65 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d Cdecl)]..#endif.
156b0 0a 20 20 20 20 70 75 62 6c 69 63 20 64 65 6c 65 . public dele
156c0 67 61 74 65 20 53 51 4c 69 74 65 45 72 72 6f 72 gate SQLiteError
156d0 43 6f 64 65 20 78 43 72 65 61 74 65 28 0d 0a 20 Code xCreate(..
156e0 20 20 20 20 20 20 20 49 6e 74 50 74 72 20 70 44 IntPtr pD
156f0 62 2c 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 b,.. IntP
15700 74 72 20 70 41 75 78 2c 0d 0a 20 20 20 20 20 20 tr pAux,..
15710 20 20 69 6e 74 20 61 72 67 63 2c 0d 0a 20 20 20 int argc,..
15720 20 20 20 20 20 49 6e 74 50 74 72 20 61 72 67 76 IntPtr argv
15730 2c 0d 0a 20 20 20 20 20 20 20 20 72 65 66 20 49 ,.. ref I
15740 6e 74 50 74 72 20 70 56 74 61 62 2c 0d 0a 20 20 ntPtr pVtab,..
15750 20 20 20 20 20 20 72 65 66 20 49 6e 74 50 74 72 ref IntPtr
15760 20 70 45 72 72 6f 72 0d 0a 20 20 20 20 29 3b 0d pError.. );.
15770 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f ... /////////
15780 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15790 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
157a0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
157b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
157c0 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 //....#if !PLATF
157d0 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
157e0 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 6e 6d 61 6e WORK.. [Unman
157f0 61 67 65 64 46 75 6e 63 74 69 6f 6e 50 6f 69 6e agedFunctionPoin
15800 74 65 72 28 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 ter(CallingConve
15810 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 ntion.Cdecl)]..#
15820 65 6e 64 69 66 0d 0a 20 20 20 20 70 75 62 6c 69 endif.. publi
15830 63 20 64 65 6c 65 67 61 74 65 20 53 51 4c 69 74 c delegate SQLit
15840 65 45 72 72 6f 72 43 6f 64 65 20 78 43 6f 6e 6e eErrorCode xConn
15850 65 63 74 28 0d 0a 20 20 20 20 20 20 20 20 49 6e ect(.. In
15860 74 50 74 72 20 70 44 62 2c 0d 0a 20 20 20 20 20 tPtr pDb,..
15870 20 20 20 49 6e 74 50 74 72 20 70 41 75 78 2c 0d IntPtr pAux,.
15880 0a 20 20 20 20 20 20 20 20 69 6e 74 20 61 72 67 . int arg
15890 63 2c 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 c,.. IntP
158a0 74 72 20 61 72 67 76 2c 0d 0a 20 20 20 20 20 20 tr argv,..
158b0 20 20 72 65 66 20 49 6e 74 50 74 72 20 70 56 74 ref IntPtr pVt
158c0 61 62 2c 0d 0a 20 20 20 20 20 20 20 20 72 65 66 ab,.. ref
158d0 20 49 6e 74 50 74 72 20 70 45 72 72 6f 72 0d 0a IntPtr pError..
158e0 20 20 20 20 29 3b 0d 0a 0d 0a 20 20 20 20 2f 2f );.... //
158f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15900 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15910 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15920 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15930 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 /////////....#if
15940 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
15950 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
15960 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 6e 63 74 [UnmanagedFunct
15970 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 6c 6c 69 ionPointer(Calli
15980 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
15990 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 cl)]..#endif..
159a0 20 20 70 75 62 6c 69 63 20 64 65 6c 65 67 61 74 public delegat
159b0 65 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 e SQLiteErrorCod
159c0 65 20 78 42 65 73 74 49 6e 64 65 78 28 0d 0a 20 e xBestIndex(..
159d0 20 20 20 20 20 20 20 49 6e 74 50 74 72 20 70 56 IntPtr pV
159e0 74 61 62 2c 0d 0a 20 20 20 20 20 20 20 20 49 6e tab,.. In
159f0 74 50 74 72 20 70 49 6e 64 65 78 0d 0a 20 20 20 tPtr pIndex..
15a00 20 29 3b 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f );.... /////
15a10 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15a20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15a30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15a40 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15a50 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 //////....#if !P
15a60 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
15a70 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 RAMEWORK.. [U
15a80 6e 6d 61 6e 61 67 65 64 46 75 6e 63 74 69 6f 6e nmanagedFunction
15a90 50 6f 69 6e 74 65 72 28 43 61 6c 6c 69 6e 67 43 Pointer(CallingC
15aa0 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
15ab0 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 70 ]..#endif.. p
15ac0 75 62 6c 69 63 20 64 65 6c 65 67 61 74 65 20 53 ublic delegate S
15ad0 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 78 QLiteErrorCode x
15ae0 44 69 73 63 6f 6e 6e 65 63 74 28 0d 0a 20 20 20 Disconnect(..
15af0 20 20 20 20 20 49 6e 74 50 74 72 20 70 56 74 61 IntPtr pVta
15b00 62 0d 0a 20 20 20 20 29 3b 0d 0a 0d 0a 20 20 20 b.. );....
15b10 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////////
15b20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15b30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15b40 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15b50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a ////////////....
15b60 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
15b70 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
15b80 20 20 20 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 [UnmanagedFu
15b90 6e 63 74 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 nctionPointer(Ca
15ba0 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
15bb0 43 64 65 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d Cdecl)]..#endif.
15bc0 0a 20 20 20 20 70 75 62 6c 69 63 20 64 65 6c 65 . public dele
15bd0 67 61 74 65 20 53 51 4c 69 74 65 45 72 72 6f 72 gate SQLiteError
15be0 43 6f 64 65 20 78 44 65 73 74 72 6f 79 28 0d 0a Code xDestroy(..
15bf0 20 20 20 20 20 20 20 20 49 6e 74 50 74 72 20 70 IntPtr p
15c00 56 74 61 62 0d 0a 20 20 20 20 29 3b 0d 0a 0d 0a Vtab.. );....
15c10 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////
15c20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15c30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15c40 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15c50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d ///////////////.
15c60 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
15c70 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
15c80 4b 0d 0a 20 20 20 20 5b 55 6e 6d 61 6e 61 67 65 K.. [Unmanage
15c90 64 46 75 6e 63 74 69 6f 6e 50 6f 69 6e 74 65 72 dFunctionPointer
15ca0 28 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 (CallingConventi
15cb0 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6e 64 on.Cdecl)]..#end
15cc0 69 66 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 64 if.. public d
15cd0 65 6c 65 67 61 74 65 20 53 51 4c 69 74 65 45 72 elegate SQLiteEr
15ce0 72 6f 72 43 6f 64 65 20 78 4f 70 65 6e 28 0d 0a rorCode xOpen(..
15cf0 20 20 20 20 20 20 20 20 49 6e 74 50 74 72 20 70 IntPtr p
15d00 56 74 61 62 2c 0d 0a 20 20 20 20 20 20 20 20 72 Vtab,.. r
15d10 65 66 20 49 6e 74 50 74 72 20 70 43 75 72 73 6f ef IntPtr pCurso
15d20 72 0d 0a 20 20 20 20 29 3b 0d 0a 0d 0a 20 20 20 r.. );....
15d30 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////////
15d40 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15d50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15d60 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15d70 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a ////////////....
15d80 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
15d90 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
15da0 20 20 20 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 [UnmanagedFu
15db0 6e 63 74 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 nctionPointer(Ca
15dc0 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
15dd0 43 64 65 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d Cdecl)]..#endif.
15de0 0a 20 20 20 20 70 75 62 6c 69 63 20 64 65 6c 65 . public dele
15df0 67 61 74 65 20 53 51 4c 69 74 65 45 72 72 6f 72 gate SQLiteError
15e00 43 6f 64 65 20 78 43 6c 6f 73 65 28 0d 0a 20 20 Code xClose(..
15e10 20 20 20 20 20 20 49 6e 74 50 74 72 20 70 43 75 IntPtr pCu
15e20 72 73 6f 72 0d 0a 20 20 20 20 29 3b 0d 0a 0d 0a rsor.. );....
15e30 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////
15e40 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15e50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15e60 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15e70 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d ///////////////.
15e80 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
15e90 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
15ea0 4b 0d 0a 20 20 20 20 5b 55 6e 6d 61 6e 61 67 65 K.. [Unmanage
15eb0 64 46 75 6e 63 74 69 6f 6e 50 6f 69 6e 74 65 72 dFunctionPointer
15ec0 28 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 (CallingConventi
15ed0 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6e 64 on.Cdecl)]..#end
15ee0 69 66 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 64 if.. public d
15ef0 65 6c 65 67 61 74 65 20 53 51 4c 69 74 65 45 72 elegate SQLiteEr
15f00 72 6f 72 43 6f 64 65 20 78 46 69 6c 74 65 72 28 rorCode xFilter(
15f10 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 74 72 .. IntPtr
15f20 20 70 43 75 72 73 6f 72 2c 0d 0a 20 20 20 20 20 pCursor,..
15f30 20 20 20 69 6e 74 20 69 64 78 4e 75 6d 2c 0d 0a int idxNum,..
15f40 20 20 20 20 20 20 20 20 49 6e 74 50 74 72 20 69 IntPtr i
15f50 64 78 53 74 72 2c 0d 0a 20 20 20 20 20 20 20 20 dxStr,..
15f60 69 6e 74 20 61 72 67 63 2c 0d 0a 20 20 20 20 20 int argc,..
15f70 20 20 20 49 6e 74 50 74 72 20 61 72 67 76 0d 0a IntPtr argv..
15f80 20 20 20 20 29 3b 0d 0a 0d 0a 20 20 20 20 2f 2f );.... //
15f90 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15fa0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15fb0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15fc0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
15fd0 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 /////////....#if
15fe0 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
15ff0 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
16000 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 6e 63 74 [UnmanagedFunct
16010 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 6c 6c 69 ionPointer(Calli
16020 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
16030 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 cl)]..#endif..
16040 20 20 70 75 62 6c 69 63 20 64 65 6c 65 67 61 74 public delegat
16050 65 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 e SQLiteErrorCod
16060 65 20 78 4e 65 78 74 28 0d 0a 20 20 20 20 20 20 e xNext(..
16070 20 20 49 6e 74 50 74 72 20 70 43 75 72 73 6f 72 IntPtr pCursor
16080 0d 0a 20 20 20 20 29 3b 0d 0a 0d 0a 20 20 20 20 .. );....
16090 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
160a0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
160b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
160c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
160d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 ///////////....#
160e0 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
160f0 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
16100 20 20 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 6e [UnmanagedFun
16110 63 74 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 6c ctionPointer(Cal
16120 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
16130 64 65 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a decl)]..#endif..
16140 20 20 20 20 70 75 62 6c 69 63 20 64 65 6c 65 67 public deleg
16150 61 74 65 20 69 6e 74 20 78 45 6f 66 28 0d 0a 20 ate int xEof(..
16160 20 20 20 20 20 20 20 49 6e 74 50 74 72 20 70 43 IntPtr pC
16170 75 72 73 6f 72 0d 0a 20 20 20 20 29 3b 0d 0a 0d ursor.. );...
16180 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f . ///////////
16190 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
161a0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
161b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
161c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
161d0 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
161e0 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
161f0 52 4b 0d 0a 20 20 20 20 5b 55 6e 6d 61 6e 61 67 RK.. [Unmanag
16200 65 64 46 75 6e 63 74 69 6f 6e 50 6f 69 6e 74 65 edFunctionPointe
16210 72 28 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 r(CallingConvent
16220 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6e ion.Cdecl)]..#en
16230 64 69 66 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 dif.. public
16240 64 65 6c 65 67 61 74 65 20 53 51 4c 69 74 65 45 delegate SQLiteE
16250 72 72 6f 72 43 6f 64 65 20 78 43 6f 6c 75 6d 6e rrorCode xColumn
16260 28 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 74 (.. IntPt
16270 72 20 70 43 75 72 73 6f 72 2c 0d 0a 20 20 20 20 r pCursor,..
16280 20 20 20 20 49 6e 74 50 74 72 20 70 43 6f 6e 74 IntPtr pCont
16290 65 78 74 2c 0d 0a 20 20 20 20 20 20 20 20 69 6e ext,.. in
162a0 74 20 69 6e 64 65 78 0d 0a 20 20 20 20 29 3b 0d t index.. );.
162b0 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f ... /////////
162c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
162d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
162e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
162f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16300 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 //....#if !PLATF
16310 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
16320 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 6e 6d 61 6e WORK.. [Unman
16330 61 67 65 64 46 75 6e 63 74 69 6f 6e 50 6f 69 6e agedFunctionPoin
16340 74 65 72 28 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 ter(CallingConve
16350 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 ntion.Cdecl)]..#
16360 65 6e 64 69 66 0d 0a 20 20 20 20 70 75 62 6c 69 endif.. publi
16370 63 20 64 65 6c 65 67 61 74 65 20 53 51 4c 69 74 c delegate SQLit
16380 65 45 72 72 6f 72 43 6f 64 65 20 78 52 6f 77 49 eErrorCode xRowI
16390 64 28 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 d(.. IntP
163a0 74 72 20 70 43 75 72 73 6f 72 2c 0d 0a 20 20 20 tr pCursor,..
163b0 20 20 20 20 20 72 65 66 20 6c 6f 6e 67 20 72 6f ref long ro
163c0 77 49 64 0d 0a 20 20 20 20 29 3b 0d 0a 0d 0a 20 wId.. );....
163d0 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////////
163e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
163f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16400 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16410 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a //////////////..
16420 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
16430 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
16440 0d 0a 20 20 20 20 5b 55 6e 6d 61 6e 61 67 65 64 .. [Unmanaged
16450 46 75 6e 63 74 69 6f 6e 50 6f 69 6e 74 65 72 28 FunctionPointer(
16460 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
16470 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6e 64 69 n.Cdecl)]..#endi
16480 66 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 64 65 f.. public de
16490 6c 65 67 61 74 65 20 53 51 4c 69 74 65 45 72 72 legate SQLiteErr
164a0 6f 72 43 6f 64 65 20 78 55 70 64 61 74 65 28 0d orCode xUpdate(.
164b0 0a 20 20 20 20 20 20 20 20 49 6e 74 50 74 72 20 . IntPtr
164c0 70 56 74 61 62 2c 0d 0a 20 20 20 20 20 20 20 20 pVtab,..
164d0 69 6e 74 20 61 72 67 63 2c 0d 0a 20 20 20 20 20 int argc,..
164e0 20 20 20 49 6e 74 50 74 72 20 61 72 67 76 2c 0d IntPtr argv,.
164f0 0a 20 20 20 20 20 20 20 20 72 65 66 20 6c 6f 6e . ref lon
16500 67 20 72 6f 77 49 64 0d 0a 20 20 20 20 29 3b 0d g rowId.. );.
16510 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f ... /////////
16520 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16530 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16540 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16550 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16560 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 //....#if !PLATF
16570 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
16580 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 6e 6d 61 6e WORK.. [Unman
16590 61 67 65 64 46 75 6e 63 74 69 6f 6e 50 6f 69 6e agedFunctionPoin
165a0 74 65 72 28 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 ter(CallingConve
165b0 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 ntion.Cdecl)]..#
165c0 65 6e 64 69 66 0d 0a 20 20 20 20 70 75 62 6c 69 endif.. publi
165d0 63 20 64 65 6c 65 67 61 74 65 20 53 51 4c 69 74 c delegate SQLit
165e0 65 45 72 72 6f 72 43 6f 64 65 20 78 42 65 67 69 eErrorCode xBegi
165f0 6e 28 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 n(.. IntP
16600 74 72 20 70 56 74 61 62 0d 0a 20 20 20 20 29 3b tr pVtab.. );
16610 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f .... ////////
16620 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16630 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16640 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16650 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16660 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 ///....#if !PLAT
16670 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
16680 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 6e 6d 61 EWORK.. [Unma
16690 6e 61 67 65 64 46 75 6e 63 74 69 6f 6e 50 6f 69 nagedFunctionPoi
166a0 6e 74 65 72 28 43 61 6c 6c 69 6e 67 43 6f 6e 76 nter(CallingConv
166b0 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
166c0 23 65 6e 64 69 66 0d 0a 20 20 20 20 70 75 62 6c #endif.. publ
166d0 69 63 20 64 65 6c 65 67 61 74 65 20 53 51 4c 69 ic delegate SQLi
166e0 74 65 45 72 72 6f 72 43 6f 64 65 20 78 53 79 6e teErrorCode xSyn
166f0 63 28 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 c(.. IntP
16700 74 72 20 70 56 74 61 62 0d 0a 20 20 20 20 29 3b tr pVtab.. );
16710 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f .... ////////
16720 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16730 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16740 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16750 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16760 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 ///....#if !PLAT
16770 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
16780 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 6e 6d 61 EWORK.. [Unma
16790 6e 61 67 65 64 46 75 6e 63 74 69 6f 6e 50 6f 69 nagedFunctionPoi
167a0 6e 74 65 72 28 43 61 6c 6c 69 6e 67 43 6f 6e 76 nter(CallingConv
167b0 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
167c0 23 65 6e 64 69 66 0d 0a 20 20 20 20 70 75 62 6c #endif.. publ
167d0 69 63 20 64 65 6c 65 67 61 74 65 20 53 51 4c 69 ic delegate SQLi
167e0 74 65 45 72 72 6f 72 43 6f 64 65 20 78 43 6f 6d teErrorCode xCom
167f0 6d 69 74 28 0d 0a 20 20 20 20 20 20 20 20 49 6e mit(.. In
16800 74 50 74 72 20 70 56 74 61 62 0d 0a 20 20 20 20 tPtr pVtab..
16810 29 3b 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f );.... //////
16820 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16830 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16840 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16850 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16860 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c /////....#if !PL
16870 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
16880 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 6e AMEWORK.. [Un
16890 6d 61 6e 61 67 65 64 46 75 6e 63 74 69 6f 6e 50 managedFunctionP
168a0 6f 69 6e 74 65 72 28 43 61 6c 6c 69 6e 67 43 6f ointer(CallingCo
168b0 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
168c0 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 70 75 ..#endif.. pu
168d0 62 6c 69 63 20 64 65 6c 65 67 61 74 65 20 53 51 blic delegate SQ
168e0 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 78 52 LiteErrorCode xR
168f0 6f 6c 6c 62 61 63 6b 28 0d 0a 20 20 20 20 20 20 ollback(..
16900 20 20 49 6e 74 50 74 72 20 70 56 74 61 62 0d 0a IntPtr pVtab..
16910 20 20 20 20 29 3b 0d 0a 0d 0a 20 20 20 20 2f 2f );.... //
16920 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16930 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16940 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16950 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16960 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 /////////....#if
16970 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
16980 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
16990 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 6e 63 74 [UnmanagedFunct
169a0 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 6c 6c 69 ionPointer(Calli
169b0 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
169c0 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 cl)]..#endif..
169d0 20 20 70 75 62 6c 69 63 20 64 65 6c 65 67 61 74 public delegat
169e0 65 20 69 6e 74 20 78 46 69 6e 64 46 75 6e 63 74 e int xFindFunct
169f0 69 6f 6e 28 0d 0a 20 20 20 20 20 20 20 20 49 6e ion(.. In
16a00 74 50 74 72 20 70 56 74 61 62 2c 0d 0a 20 20 20 tPtr pVtab,..
16a10 20 20 20 20 20 69 6e 74 20 6e 41 72 67 2c 0d 0a int nArg,..
16a20 20 20 20 20 20 20 20 20 49 6e 74 50 74 72 20 7a IntPtr z
16a30 4e 61 6d 65 2c 0d 0a 20 20 20 20 20 20 20 20 72 Name,.. r
16a40 65 66 20 53 51 4c 69 74 65 43 61 6c 6c 62 61 63 ef SQLiteCallbac
16a50 6b 20 63 61 6c 6c 62 61 63 6b 2c 0d 0a 20 20 20 k callback,..
16a60 20 20 20 20 20 72 65 66 20 49 6e 74 50 74 72 20 ref IntPtr
16a70 70 55 73 65 72 44 61 74 61 0d 0a 20 20 20 20 29 pUserData.. )
16a80 3b 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f ;.... ///////
16a90 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16aa0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16ab0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16ac0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16ad0 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 ////....#if !PLA
16ae0 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
16af0 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 6e 6d MEWORK.. [Unm
16b00 61 6e 61 67 65 64 46 75 6e 63 74 69 6f 6e 50 6f anagedFunctionPo
16b10 69 6e 74 65 72 28 43 61 6c 6c 69 6e 67 43 6f 6e inter(CallingCon
16b20 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
16b30 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 70 75 62 .#endif.. pub
16b40 6c 69 63 20 64 65 6c 65 67 61 74 65 20 53 51 4c lic delegate SQL
16b50 69 74 65 45 72 72 6f 72 43 6f 64 65 20 78 52 65 iteErrorCode xRe
16b60 6e 61 6d 65 28 0d 0a 20 20 20 20 20 20 20 20 49 name(.. I
16b70 6e 74 50 74 72 20 70 56 74 61 62 2c 0d 0a 20 20 ntPtr pVtab,..
16b80 20 20 20 20 20 20 49 6e 74 50 74 72 20 7a 4e 65 IntPtr zNe
16b90 77 0d 0a 20 20 20 20 29 3b 0d 0a 0d 0a 20 20 20 w.. );....
16ba0 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////////
16bb0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16bc0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16bd0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16be0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a ////////////....
16bf0 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
16c00 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
16c10 20 20 20 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 [UnmanagedFu
16c20 6e 63 74 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 nctionPointer(Ca
16c30 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
16c40 43 64 65 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d Cdecl)]..#endif.
16c50 0a 20 20 20 20 70 75 62 6c 69 63 20 64 65 6c 65 . public dele
16c60 67 61 74 65 20 53 51 4c 69 74 65 45 72 72 6f 72 gate SQLiteError
16c70 43 6f 64 65 20 78 53 61 76 65 70 6f 69 6e 74 28 Code xSavepoint(
16c80 0d 0a 20 20 20 20 20 20 20 20 49 6e 74 50 74 72 .. IntPtr
16c90 20 70 56 74 61 62 2c 0d 0a 20 20 20 20 20 20 20 pVtab,..
16ca0 20 69 6e 74 20 69 53 61 76 65 70 6f 69 6e 74 0d int iSavepoint.
16cb0 0a 20 20 20 20 29 3b 0d 0a 0d 0a 20 20 20 20 2f . );.... /
16cc0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16cd0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16ce0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16cf0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16d00 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 //////////....#i
16d10 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
16d20 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
16d30 20 20 5b 55 6e 6d 61 6e 61 67 65 64 46 75 6e 63 [UnmanagedFunc
16d40 74 69 6f 6e 50 6f 69 6e 74 65 72 28 43 61 6c 6c tionPointer(Call
16d50 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
16d60 65 63 6c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 ecl)]..#endif..
16d70 20 20 20 70 75 62 6c 69 63 20 64 65 6c 65 67 61 public delega
16d80 74 65 20 53 51 4c 69 74 65 45 72 72 6f 72 43 6f te SQLiteErrorCo
16d90 64 65 20 78 52 65 6c 65 61 73 65 28 0d 0a 20 20 de xRelease(..
16da0 20 20 20 20 20 20 49 6e 74 50 74 72 20 70 56 74 IntPtr pVt
16db0 61 62 2c 0d 0a 20 20 20 20 20 20 20 20 69 6e 74 ab,.. int
16dc0 20 69 53 61 76 65 70 6f 69 6e 74 0d 0a 20 20 20 iSavepoint..
16dd0 20 29 3b 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f );.... /////
16de0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16df0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16e00 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16e10 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16e20 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 //////....#if !P
16e30 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
16e40 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 RAMEWORK.. [U
16e50 6e 6d 61 6e 61 67 65 64 46 75 6e 63 74 69 6f 6e nmanagedFunction
16e60 50 6f 69 6e 74 65 72 28 43 61 6c 6c 69 6e 67 43 Pointer(CallingC
16e70 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
16e80 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 70 ]..#endif.. p
16e90 75 62 6c 69 63 20 64 65 6c 65 67 61 74 65 20 53 ublic delegate S
16ea0 51 4c 69 74 65 45 72 72 6f 72 43 6f 64 65 20 78 QLiteErrorCode x
16eb0 52 6f 6c 6c 62 61 63 6b 54 6f 28 0d 0a 20 20 20 RollbackTo(..
16ec0 20 20 20 20 20 49 6e 74 50 74 72 20 70 56 74 61 IntPtr pVta
16ed0 62 2c 0d 0a 20 20 20 20 20 20 20 20 69 6e 74 20 b,.. int
16ee0 69 53 61 76 65 70 6f 69 6e 74 0d 0a 20 20 20 20 iSavepoint..
16ef0 29 3b 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f );.... //////
16f00 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16f10 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16f20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16f30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
16f40 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 21 50 4c /////....#if !PL
16f50 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
16f60 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 55 6e AMEWORK.. [Un
16f70 6d 61 6e 61 67 65 64 46 75 6e 63 74 69 6f 6e 50 managedFunctionP
16f80 6f 69 6e 74 65 72 28 43 61 6c 6c 69 6e 67 43 6f ointer(CallingCo
16f90 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
16fa0 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 70 75 ..#endif.. pu
16fb0 62 6c 69 63 20 64 65 6c 65 67 61 74 65 20 76 6f blic delegate vo
16fc0 69 64 20 78 44 65 73 74 72 6f 79 4d 6f 64 75 6c id xDestroyModul
16fd0 65 28 49 6e 74 50 74 72 20 70 43 6c 69 65 6e 74 e(IntPtr pClient
16fe0 44 61 74 61 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a Data);..#endif..
16ff0 20 20 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d 0a #endregion..
17000 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f .. //////////
17010 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17020 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17030 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17040 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17050 2f 0d 0a 0d 0a 20 20 20 20 23 72 65 67 69 6f 6e /.... #region
17060 20 4e 61 74 69 76 65 20 53 74 72 75 63 74 75 72 Native Structur
17070 65 73 0d 0a 23 69 66 20 49 4e 54 45 52 4f 50 5f es..#if INTEROP_
17080 56 49 52 54 55 41 4c 5f 54 41 42 4c 45 0d 0a 20 VIRTUAL_TABLE..
17090 20 20 20 5b 53 74 72 75 63 74 4c 61 79 6f 75 74 [StructLayout
170a0 28 4c 61 79 6f 75 74 4b 69 6e 64 2e 53 65 71 75 (LayoutKind.Sequ
170b0 65 6e 74 69 61 6c 29 5d 0d 0a 20 20 20 20 69 6e ential)].. in
170c0 74 65 72 6e 61 6c 20 73 74 72 75 63 74 20 73 71 ternal struct sq
170d0 6c 69 74 65 33 5f 6d 6f 64 75 6c 65 0d 0a 20 20 lite3_module..
170e0 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 70 75 62 {.. pub
170f0 6c 69 63 20 69 6e 74 20 69 56 65 72 73 69 6f 6e lic int iVersion
17100 3b 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c 69 ;.. publi
17110 63 20 78 43 72 65 61 74 65 20 78 43 72 65 61 74 c xCreate xCreat
17120 65 3b 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c e;.. publ
17130 69 63 20 78 43 6f 6e 6e 65 63 74 20 78 43 6f 6e ic xConnect xCon
17140 6e 65 63 74 3b 0d 0a 20 20 20 20 20 20 20 20 70 nect;.. p
17150 75 62 6c 69 63 20 78 42 65 73 74 49 6e 64 65 78 ublic xBestIndex
17160 20 78 42 65 73 74 49 6e 64 65 78 3b 0d 0a 20 20 xBestIndex;..
17170 20 20 20 20 20 20 70 75 62 6c 69 63 20 78 44 69 public xDi
17180 73 63 6f 6e 6e 65 63 74 20 78 44 69 73 63 6f 6e sconnect xDiscon
17190 6e 65 63 74 3b 0d 0a 20 20 20 20 20 20 20 20 70 nect;.. p
171a0 75 62 6c 69 63 20 78 44 65 73 74 72 6f 79 20 78 ublic xDestroy x
171b0 44 65 73 74 72 6f 79 3b 0d 0a 20 20 20 20 20 20 Destroy;..
171c0 20 20 70 75 62 6c 69 63 20 78 4f 70 65 6e 20 78 public xOpen x
171d0 4f 70 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 70 Open;.. p
171e0 75 62 6c 69 63 20 78 43 6c 6f 73 65 20 78 43 6c ublic xClose xCl
171f0 6f 73 65 3b 0d 0a 20 20 20 20 20 20 20 20 70 75 ose;.. pu
17200 62 6c 69 63 20 78 46 69 6c 74 65 72 20 78 46 69 blic xFilter xFi
17210 6c 74 65 72 3b 0d 0a 20 20 20 20 20 20 20 20 70 lter;.. p
17220 75 62 6c 69 63 20 78 4e 65 78 74 20 78 4e 65 78 ublic xNext xNex
17230 74 3b 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c t;.. publ
17240 69 63 20 78 45 6f 66 20 78 45 6f 66 3b 0d 0a 20 ic xEof xEof;..
17250 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 78 43 public xC
17260 6f 6c 75 6d 6e 20 78 43 6f 6c 75 6d 6e 3b 0d 0a olumn xColumn;..
17270 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 78 public x
17280 52 6f 77 49 64 20 78 52 6f 77 49 64 3b 0d 0a 20 RowId xRowId;..
17290 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 78 55 public xU
172a0 70 64 61 74 65 20 78 55 70 64 61 74 65 3b 0d 0a pdate xUpdate;..
172b0 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 78 public x
172c0 42 65 67 69 6e 20 78 42 65 67 69 6e 3b 0d 0a 20 Begin xBegin;..
172d0 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 78 53 public xS
172e0 79 6e 63 20 78 53 79 6e 63 3b 0d 0a 20 20 20 20 ync xSync;..
172f0 20 20 20 20 70 75 62 6c 69 63 20 78 43 6f 6d 6d public xComm
17300 69 74 20 78 43 6f 6d 6d 69 74 3b 0d 0a 20 20 20 it xCommit;..
17310 20 20 20 20 20 70 75 62 6c 69 63 20 78 52 6f 6c public xRol
17320 6c 62 61 63 6b 20 78 52 6f 6c 6c 62 61 63 6b 3b lback xRollback;
17330 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 .. public
17340 20 78 46 69 6e 64 46 75 6e 63 74 69 6f 6e 20 78 xFindFunction x
17350 46 69 6e 64 46 75 6e 63 74 69 6f 6e 3b 0d 0a 20 FindFunction;..
17360 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 78 52 public xR
17370 65 6e 61 6d 65 20 78 52 65 6e 61 6d 65 3b 0d 0a ename xRename;..
17380 20 20 20 20 20 20 20 20 2f 2a 20 54 68 65 20 6d /* The m
17390 65 74 68 6f 64 73 20 61 62 6f 76 65 20 61 72 65 ethods above are
173a0 20 69 6e 20 76 65 72 73 69 6f 6e 20 31 20 6f 66 in version 1 of
173b0 20 74 68 65 20 73 71 6c 69 74 65 33 5f 6d 6f 64 the sqlite3_mod
173c0 75 6c 65 0d 0a 20 20 20 20 20 20 20 20 20 2a 20 ule.. *
173d0 6f 62 6a 65 63 74 2e 20 20 54 68 6f 73 65 20 62 object. Those b
173e0 65 6c 6f 77 20 61 72 65 20 66 6f 72 20 76 65 72 elow are for ver
173f0 73 69 6f 6e 20 32 20 61 6e 64 20 67 72 65 61 74 sion 2 and great
17400 65 72 2e 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 er. */..
17410 70 75 62 6c 69 63 20 78 53 61 76 65 70 6f 69 6e public xSavepoin
17420 74 20 78 53 61 76 65 70 6f 69 6e 74 3b 0d 0a 20 t xSavepoint;..
17430 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 78 52 public xR
17440 65 6c 65 61 73 65 20 78 52 65 6c 65 61 73 65 3b elease xRelease;
17450 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 .. public
17460 20 78 52 6f 6c 6c 62 61 63 6b 54 6f 20 78 52 6f xRollbackTo xRo
17470 6c 6c 62 61 63 6b 54 6f 3b 0d 0a 20 20 20 20 7d llbackTo;.. }
17480 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f .... ////////
17490 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
174a0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
174b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
174c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
174d0 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 5b 53 74 72 75 ///.... [Stru
174e0 63 74 4c 61 79 6f 75 74 28 4c 61 79 6f 75 74 4b ctLayout(LayoutK
174f0 69 6e 64 2e 53 65 71 75 65 6e 74 69 61 6c 29 5d ind.Sequential)]
17500 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
17510 74 72 75 63 74 20 73 71 6c 69 74 65 33 5f 76 74 truct sqlite3_vt
17520 61 62 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 ab.. {..
17530 20 20 20 70 75 62 6c 69 63 20 49 6e 74 50 74 72 public IntPtr
17540 20 70 4d 6f 64 75 6c 65 3b 0d 0a 20 20 20 20 20 pModule;..
17550 20 20 20 70 75 62 6c 69 63 20 69 6e 74 20 6e 52 public int nR
17560 65 66 3b 20 2f 2a 20 4e 4f 20 4c 4f 4e 47 45 52 ef; /* NO LONGER
17570 20 55 53 45 44 20 2a 2f 0d 0a 20 20 20 20 20 20 USED */..
17580 20 20 70 75 62 6c 69 63 20 49 6e 74 50 74 72 20 public IntPtr
17590 7a 45 72 72 4d 73 67 3b 0d 0a 20 20 20 20 7d 0d zErrMsg;.. }.
175a0 0a 0d 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f ... /////////
175b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
175c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
175d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
175e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
175f0 2f 2f 0d 0a 0d 0a 20 20 20 20 5b 53 74 72 75 63 //.... [Struc
17600 74 4c 61 79 6f 75 74 28 4c 61 79 6f 75 74 4b 69 tLayout(LayoutKi
17610 6e 64 2e 53 65 71 75 65 6e 74 69 61 6c 29 5d 0d nd.Sequential)].
17620 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
17630 72 75 63 74 20 73 71 6c 69 74 65 33 5f 76 74 61 ruct sqlite3_vta
17640 62 5f 63 75 72 73 6f 72 0d 0a 20 20 20 20 7b 0d b_cursor.. {.
17650 0a 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 . public
17660 49 6e 74 50 74 72 20 70 56 54 61 62 3b 0d 0a 20 IntPtr pVTab;..
17670 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f }.... ////
17680 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17690 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
176a0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
176b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
176c0 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 5b ///////.... [
176d0 53 74 72 75 63 74 4c 61 79 6f 75 74 28 4c 61 79 StructLayout(Lay
176e0 6f 75 74 4b 69 6e 64 2e 53 65 71 75 65 6e 74 69 outKind.Sequenti
176f0 61 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e al)].. intern
17700 61 6c 20 73 74 72 75 63 74 20 73 71 6c 69 74 65 al struct sqlite
17710 33 5f 69 6e 64 65 78 5f 63 6f 6e 73 74 72 61 69 3_index_constrai
17720 6e 74 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 nt.. {..
17730 20 20 20 70 75 62 6c 69 63 20 73 71 6c 69 74 65 public sqlite
17740 33 5f 69 6e 64 65 78 5f 63 6f 6e 73 74 72 61 69 3_index_constrai
17750 6e 74 28 0d 0a 20 20 20 20 20 20 20 20 20 20 20 nt(..
17760 20 53 51 4c 69 74 65 49 6e 64 65 78 43 6f 6e 73 SQLiteIndexCons
17770 74 72 61 69 6e 74 20 63 6f 6e 73 74 72 61 69 6e traint constrain
17780 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 29 t.. )
17790 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 3a 20 .. :
177a0 74 68 69 73 28 29 0d 0a 20 20 20 20 20 20 20 20 this()..
177b0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 {.. i
177c0 66 20 28 63 6f 6e 73 74 72 61 69 6e 74 20 21 3d f (constraint !=
177d0 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 null)..
177e0 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
177f0 20 20 20 20 20 20 20 69 43 6f 6c 75 6d 6e 20 3d iColumn =
17800 20 63 6f 6e 73 74 72 61 69 6e 74 2e 69 43 6f 6c constraint.iCol
17810 75 6d 6e 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 umn;..
17820 20 20 20 20 20 20 6f 70 20 3d 20 63 6f 6e 73 74 op = const
17830 72 61 69 6e 74 2e 6f 70 3b 0d 0a 20 20 20 20 20 raint.op;..
17840 20 20 20 20 20 20 20 20 20 20 20 75 73 61 62 6c usabl
17850 65 20 3d 20 63 6f 6e 73 74 72 61 69 6e 74 2e 75 e = constraint.u
17860 73 61 62 6c 65 3b 0d 0a 20 20 20 20 20 20 20 20 sable;..
17870 20 20 20 20 20 20 20 20 69 54 65 72 6d 4f 66 66 iTermOff
17880 73 65 74 20 3d 20 63 6f 6e 73 74 72 61 69 6e 74 set = constraint
17890 2e 69 54 65 72 6d 4f 66 66 73 65 74 3b 0d 0a 20 .iTermOffset;..
178a0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
178b0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
178c0 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////////
178d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
178e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
178f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17900 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 //////////....
17910 20 20 20 20 20 20 70 75 62 6c 69 63 20 69 6e 74 public int
17920 20 69 43 6f 6c 75 6d 6e 3b 0d 0a 20 20 20 20 20 iColumn;..
17930 20 20 20 70 75 62 6c 69 63 20 53 51 4c 69 74 65 public SQLite
17940 49 6e 64 65 78 43 6f 6e 73 74 72 61 69 6e 74 4f IndexConstraintO
17950 70 20 6f 70 3b 0d 0a 20 20 20 20 20 20 20 20 70 p op;.. p
17960 75 62 6c 69 63 20 62 79 74 65 20 75 73 61 62 6c ublic byte usabl
17970 65 3b 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c e;.. publ
17980 69 63 20 69 6e 74 20 69 54 65 72 6d 4f 66 66 73 ic int iTermOffs
17990 65 74 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 et;.. }....
179a0 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f //////////////
179b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
179c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
179d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
179e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d /////////////...
179f0 0a 20 20 20 20 5b 53 74 72 75 63 74 4c 61 79 6f . [StructLayo
17a00 75 74 28 4c 61 79 6f 75 74 4b 69 6e 64 2e 53 65 ut(LayoutKind.Se
17a10 71 75 65 6e 74 69 61 6c 29 5d 0d 0a 20 20 20 20 quential)]..
17a20 69 6e 74 65 72 6e 61 6c 20 73 74 72 75 63 74 20 internal struct
17a30 73 71 6c 69 74 65 33 5f 69 6e 64 65 78 5f 6f 72 sqlite3_index_or
17a40 64 65 72 62 79 0d 0a 20 20 20 20 7b 0d 0a 20 20 derby.. {..
17a50 20 20 20 20 20 20 70 75 62 6c 69 63 20 73 71 6c public sql
17a60 69 74 65 33 5f 69 6e 64 65 78 5f 6f 72 64 65 72 ite3_index_order
17a70 62 79 28 0d 0a 20 20 20 20 20 20 20 20 20 20 20 by(..
17a80 20 53 51 4c 69 74 65 49 6e 64 65 78 4f 72 64 65 SQLiteIndexOrde
17a90 72 42 79 20 6f 72 64 65 72 42 79 0d 0a 20 20 20 rBy orderBy..
17aa0 20 20 20 20 20 20 20 20 20 29 0d 0a 20 20 20 20 )..
17ab0 20 20 20 20 20 20 20 20 3a 20 74 68 69 73 28 29 : this()
17ac0 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 .. {..
17ad0 20 20 20 20 20 20 20 20 20 69 66 20 28 6f 72 64 if (ord
17ae0 65 72 42 79 20 21 3d 20 6e 75 6c 6c 29 0d 0a 20 erBy != null)..
17af0 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
17b00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 43 iC
17b10 6f 6c 75 6d 6e 20 3d 20 6f 72 64 65 72 42 79 2e olumn = orderBy.
17b20 69 43 6f 6c 75 6d 6e 3b 0d 0a 20 20 20 20 20 20 iColumn;..
17b30 20 20 20 20 20 20 20 20 20 20 64 65 73 63 20 3d desc =
17b40 20 6f 72 64 65 72 42 79 2e 64 65 73 63 3b 0d 0a orderBy.desc;..
17b50 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
17b60 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
17b70 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////
17b80 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17b90 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17ba0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17bb0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 ///////////....
17bc0 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 69 6e public in
17bd0 74 20 69 43 6f 6c 75 6d 6e 3b 20 2f 2a 20 43 6f t iColumn; /* Co
17be0 6c 75 6d 6e 20 6e 75 6d 62 65 72 20 2a 2f 0d 0a lumn number */..
17bf0 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 62 public b
17c00 79 74 65 20 64 65 73 63 3b 20 20 20 2f 2a 20 54 yte desc; /* T
17c10 72 75 65 20 66 6f 72 20 44 45 53 43 2e 20 20 46 rue for DESC. F
17c20 61 6c 73 65 20 66 6f 72 20 41 53 43 2e 20 2a 2f alse for ASC. */
17c30 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 2f .. }.... /
17c40 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17c50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17c60 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17c70 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17c80 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 //////////....
17c90 20 20 5b 53 74 72 75 63 74 4c 61 79 6f 75 74 28 [StructLayout(
17ca0 4c 61 79 6f 75 74 4b 69 6e 64 2e 53 65 71 75 65 LayoutKind.Seque
17cb0 6e 74 69 61 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 ntial)].. int
17cc0 65 72 6e 61 6c 20 73 74 72 75 63 74 20 73 71 6c ernal struct sql
17cd0 69 74 65 33 5f 69 6e 64 65 78 5f 63 6f 6e 73 74 ite3_index_const
17ce0 72 61 69 6e 74 5f 75 73 61 67 65 0d 0a 20 20 20 raint_usage..
17cf0 20 7b 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c {.. publ
17d00 69 63 20 73 71 6c 69 74 65 33 5f 69 6e 64 65 78 ic sqlite3_index
17d10 5f 63 6f 6e 73 74 72 61 69 6e 74 5f 75 73 61 67 _constraint_usag
17d20 65 28 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 e(..
17d30 53 51 4c 69 74 65 49 6e 64 65 78 43 6f 6e 73 74 SQLiteIndexConst
17d40 72 61 69 6e 74 55 73 61 67 65 20 63 6f 6e 73 74 raintUsage const
17d50 72 61 69 6e 74 55 73 61 67 65 0d 0a 20 20 20 20 raintUsage..
17d60 20 20 20 20 20 20 20 20 29 0d 0a 20 20 20 20 20 )..
17d70 20 20 20 20 20 20 20 3a 20 74 68 69 73 28 29 0d : this().
17d80 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 . {..
17d90 20 20 20 20 20 20 20 20 69 66 20 28 63 6f 6e 73 if (cons
17da0 74 72 61 69 6e 74 55 73 61 67 65 20 21 3d 20 6e traintUsage != n
17db0 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 20 ull)..
17dc0 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 {..
17dd0 20 20 20 20 20 61 72 67 76 49 6e 64 65 78 20 3d argvIndex =
17de0 20 63 6f 6e 73 74 72 61 69 6e 74 55 73 61 67 65 constraintUsage
17df0 2e 61 72 67 76 49 6e 64 65 78 3b 0d 0a 20 20 20 .argvIndex;..
17e00 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 6d 69 omi
17e10 74 20 3d 20 63 6f 6e 73 74 72 61 69 6e 74 55 73 t = constraintUs
17e20 61 67 65 2e 6f 6d 69 74 3b 0d 0a 20 20 20 20 20 age.omit;..
17e30 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
17e40 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 2f }.... /
17e50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17e60 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17e70 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17e80 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17e90 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 //////....
17ea0 20 20 70 75 62 6c 69 63 20 69 6e 74 20 61 72 67 public int arg
17eb0 76 49 6e 64 65 78 3b 20 2f 2a 20 69 66 20 3e 30 vIndex; /* if >0
17ec0 2c 20 63 6f 6e 73 74 72 61 69 6e 74 20 69 73 20 , constraint is
17ed0 70 61 72 74 20 6f 66 20 61 72 67 76 20 74 6f 20 part of argv to
17ee0 78 46 69 6c 74 65 72 20 2a 2f 0d 0a 20 20 20 20 xFilter */..
17ef0 20 20 20 20 70 75 62 6c 69 63 20 62 79 74 65 20 public byte
17f00 6f 6d 69 74 3b 20 20 20 20 20 2f 2a 20 44 6f 20 omit; /* Do
17f10 6e 6f 74 20 63 6f 64 65 20 61 20 74 65 73 74 20 not code a test
17f20 66 6f 72 20 74 68 69 73 20 63 6f 6e 73 74 72 61 for this constra
17f30 69 6e 74 20 2a 2f 0d 0a 20 20 20 20 7d 0d 0a 0d int */.. }...
17f40 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f . ///////////
17f50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17f60 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17f70 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17f80 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
17f90 0d 0a 0d 0a 20 20 20 20 5b 53 74 72 75 63 74 4c .... [StructL
17fa0 61 79 6f 75 74 28 4c 61 79 6f 75 74 4b 69 6e 64 ayout(LayoutKind
17fb0 2e 53 65 71 75 65 6e 74 69 61 6c 29 5d 0d 0a 20 .Sequential)]..
17fc0 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 72 75 internal stru
17fd0 63 74 20 73 71 6c 69 74 65 33 5f 69 6e 64 65 78 ct sqlite3_index
17fe0 5f 69 6e 66 6f 0d 0a 20 20 20 20 7b 0d 0a 20 20 _info.. {..
17ff0 20 20 20 20 20 20 2f 2a 20 49 6e 70 75 74 73 20 /* Inputs
18000 2a 2f 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c */.. publ
18010 69 63 20 69 6e 74 20 6e 43 6f 6e 73 74 72 61 69 ic int nConstrai
18020 6e 74 3b 20 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 nt; /* Number of
18030 20 65 6e 74 72 69 65 73 20 69 6e 20 61 43 6f 6e entries in aCon
18040 73 74 72 61 69 6e 74 20 2a 2f 0d 0a 20 20 20 20 straint */..
18050 20 20 20 20 70 75 62 6c 69 63 20 49 6e 74 50 74 public IntPt
18060 72 20 61 43 6f 6e 73 74 72 61 69 6e 74 3b 0d 0a r aConstraint;..
18070 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 69 public i
18080 6e 74 20 6e 4f 72 64 65 72 42 79 3b 0d 0a 20 20 nt nOrderBy;..
18090 20 20 20 20 20 20 70 75 62 6c 69 63 20 49 6e 74 public Int
180a0 50 74 72 20 61 4f 72 64 65 72 42 79 3b 0d 0a 20 Ptr aOrderBy;..
180b0 20 20 20 20 20 20 20 2f 2a 20 4f 75 74 70 75 74 /* Output
180c0 73 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 70 75 s */.. pu
180d0 62 6c 69 63 20 49 6e 74 50 74 72 20 61 43 6f 6e blic IntPtr aCon
180e0 73 74 72 61 69 6e 74 55 73 61 67 65 3b 0d 0a 20 straintUsage;..
180f0 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 69 6e public in
18100 74 20 69 64 78 4e 75 6d 3b 20 20 20 20 20 20 20 t idxNum;
18110 20 20 20 20 2f 2a 20 4e 75 6d 62 65 72 20 75 73 /* Number us
18120 65 64 20 74 6f 20 69 64 65 6e 74 69 66 79 20 74 ed to identify t
18130 68 65 20 69 6e 64 65 78 20 2a 2f 0d 0a 20 20 20 he index */..
18140 20 20 20 20 20 70 75 62 6c 69 63 20 73 74 72 69 public stri
18150 6e 67 20 69 64 78 53 74 72 3b 20 20 20 20 20 20 ng idxStr;
18160 20 20 2f 2a 20 53 74 72 69 6e 67 2c 20 70 6f 73 /* String, pos
18170 73 69 62 6c 79 20 6f 62 74 61 69 6e 65 64 20 66 sibly obtained f
18180 72 6f 6d 20 73 71 6c 69 74 65 33 5f 6d 61 6c 6c rom sqlite3_mall
18190 6f 63 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 70 oc */.. p
181a0 75 62 6c 69 63 20 69 6e 74 20 6e 65 65 64 54 6f ublic int needTo
181b0 46 72 65 65 49 64 78 53 74 72 3b 20 2f 2a 20 46 FreeIdxStr; /* F
181c0 72 65 65 20 69 64 78 53 74 72 20 75 73 69 6e 67 ree idxStr using
181d0 20 73 71 6c 69 74 65 33 5f 66 72 65 65 28 29 20 sqlite3_free()
181e0 69 66 20 74 72 75 65 20 2a 2f 0d 0a 20 20 20 20 if true */..
181f0 20 20 20 20 70 75 62 6c 69 63 20 69 6e 74 20 6f public int o
18200 72 64 65 72 42 79 43 6f 6e 73 75 6d 65 64 3b 20 rderByConsumed;
18210 20 2f 2a 20 54 72 75 65 20 69 66 20 6f 75 74 70 /* True if outp
18220 75 74 20 69 73 20 61 6c 72 65 61 64 79 20 6f 72 ut is already or
18230 64 65 72 65 64 20 2a 2f 0d 0a 20 20 20 20 20 20 dered */..
18240 20 20 70 75 62 6c 69 63 20 64 6f 75 62 6c 65 20 public double
18250 65 73 74 69 6d 61 74 65 64 43 6f 73 74 3b 20 2f estimatedCost; /
18260 2a 20 45 73 74 69 6d 61 74 65 64 20 63 6f 73 74 * Estimated cost
18270 20 6f 66 20 75 73 69 6e 67 20 74 68 69 73 20 69 of using this i
18280 6e 64 65 78 20 2a 2f 0d 0a 20 20 20 20 7d 0d 0a ndex */.. }..
18290 23 65 6e 64 69 66 0d 0a 20 20 20 20 23 65 6e 64 #endif.. #end
182a0 72 65 67 69 6f 6e 0d 0a 20 20 7d 0d 0a 0d 0a 20 region.. }....
182b0 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////////
182c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
182d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
182e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
182f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a //////////////..
18300 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 ..#if PLATFORM_C
18310 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
18320 0a 20 20 69 6e 74 65 72 6e 61 6c 20 61 62 73 74 . internal abst
18330 72 61 63 74 20 63 6c 61 73 73 20 43 72 69 74 69 ract class Criti
18340 63 61 6c 48 61 6e 64 6c 65 20 3a 20 49 44 69 73 calHandle : IDis
18350 70 6f 73 61 62 6c 65 0d 0a 20 20 7b 0d 0a 20 20 posable.. {..
18360 20 20 70 72 69 76 61 74 65 20 62 6f 6f 6c 20 5f private bool _
18370 69 73 43 6c 6f 73 65 64 3b 0d 0a 20 20 20 20 70 isClosed;.. p
18380 72 6f 74 65 63 74 65 64 20 49 6e 74 50 74 72 20 rotected IntPtr
18390 68 61 6e 64 6c 65 3b 0d 0a 0d 0a 20 20 20 20 70 handle;.... p
183a0 72 6f 74 65 63 74 65 64 20 43 72 69 74 69 63 61 rotected Critica
183b0 6c 48 61 6e 64 6c 65 28 49 6e 74 50 74 72 20 69 lHandle(IntPtr i
183c0 6e 76 61 6c 69 64 48 61 6e 64 6c 65 56 61 6c 75 nvalidHandleValu
183d0 65 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 e).. {..
183e0 20 68 61 6e 64 6c 65 20 3d 20 69 6e 76 61 6c 69 handle = invali
183f0 64 48 61 6e 64 6c 65 56 61 6c 75 65 3b 0d 0a 20 dHandleValue;..
18400 20 20 20 20 20 5f 69 73 43 6c 6f 73 65 64 20 3d _isClosed =
18410 20 66 61 6c 73 65 3b 0d 0a 20 20 20 20 7d 0d 0a false;.. }..
18420 0d 0a 20 20 20 20 7e 43 72 69 74 69 63 61 6c 48 .. ~CriticalH
18430 61 6e 64 6c 65 28 29 0d 0a 20 20 20 20 7b 0d 0a andle().. {..
18440 20 20 20 20 20 20 44 69 73 70 6f 73 65 28 66 61 Dispose(fa
18450 6c 73 65 29 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a lse);.. }....
18460 20 20 20 20 70 72 69 76 61 74 65 20 76 6f 69 64 private void
18470 20 43 6c 65 61 6e 75 70 28 29 0d 0a 20 20 20 20 Cleanup()..
18480 7b 0d 0a 20 20 20 20 20 20 69 66 20 28 21 49 73 {.. if (!Is
18490 43 6c 6f 73 65 64 29 0d 0a 20 20 20 20 20 20 7b Closed).. {
184a0 0d 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 5f .. this._
184b0 69 73 43 6c 6f 73 65 64 20 3d 20 74 72 75 65 3b isClosed = true;
184c0 0d 0a 20 20 20 20 20 20 20 20 69 66 20 28 21 49 .. if (!I
184d0 73 49 6e 76 61 6c 69 64 29 0d 0a 20 20 20 20 20 sInvalid)..
184e0 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 {..
184f0 52 65 6c 65 61 73 65 48 61 6e 64 6c 65 28 29 3b ReleaseHandle();
18500 0d 0a 20 20 20 20 20 20 20 20 20 20 47 43 2e 53 .. GC.S
18510 75 70 70 72 65 73 73 46 69 6e 61 6c 69 7a 65 28 uppressFinalize(
18520 74 68 69 73 29 3b 0d 0a 20 20 20 20 20 20 20 20 this);..
18530 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }.. }..
18540 7d 0d 0a 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 }.... public
18550 76 6f 69 64 20 43 6c 6f 73 65 28 29 0d 0a 20 20 void Close()..
18560 20 20 7b 0d 0a 20 20 20 20 20 20 44 69 73 70 6f {.. Dispo
18570 73 65 28 74 72 75 65 29 3b 0d 0a 20 20 20 20 7d se(true);.. }
18580 0d 0a 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 76 .... public v
18590 6f 69 64 20 44 69 73 70 6f 73 65 28 29 0d 0a 20 oid Dispose()..
185a0 20 20 20 7b 0d 0a 20 20 20 20 20 20 44 69 73 70 {.. Disp
185b0 6f 73 65 28 74 72 75 65 29 3b 0d 0a 20 20 20 20 ose(true);..
185c0 7d 0d 0a 0d 0a 20 20 20 20 70 72 6f 74 65 63 74 }.... protect
185d0 65 64 20 76 69 72 74 75 61 6c 20 76 6f 69 64 20 ed virtual void
185e0 44 69 73 70 6f 73 65 28 62 6f 6f 6c 20 64 69 73 Dispose(bool dis
185f0 70 6f 73 69 6e 67 29 0d 0a 20 20 20 20 7b 0d 0a posing).. {..
18600 20 20 20 20 20 20 43 6c 65 61 6e 75 70 28 29 3b Cleanup();
18610 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 .. }.... p
18620 72 6f 74 65 63 74 65 64 20 61 62 73 74 72 61 63 rotected abstrac
18630 74 20 62 6f 6f 6c 20 52 65 6c 65 61 73 65 48 61 t bool ReleaseHa
18640 6e 64 6c 65 28 29 3b 0d 0a 0d 0a 20 20 20 20 70 ndle();.... p
18650 72 6f 74 65 63 74 65 64 20 76 6f 69 64 20 53 65 rotected void Se
18660 74 48 61 6e 64 6c 65 28 49 6e 74 50 74 72 20 76 tHandle(IntPtr v
18670 61 6c 75 65 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 alue).. {..
18680 20 20 20 20 68 61 6e 64 6c 65 20 3d 20 76 61 6c handle = val
18690 75 65 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 ue;.. }....
186a0 20 20 70 75 62 6c 69 63 20 76 6f 69 64 20 53 65 public void Se
186b0 74 48 61 6e 64 6c 65 41 73 49 6e 76 61 6c 69 64 tHandleAsInvalid
186c0 28 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 ().. {..
186d0 20 5f 69 73 43 6c 6f 73 65 64 20 3d 20 74 72 75 _isClosed = tru
186e0 65 3b 0d 0a 20 20 20 20 20 20 47 43 2e 53 75 70 e;.. GC.Sup
186f0 70 72 65 73 73 46 69 6e 61 6c 69 7a 65 28 74 68 pressFinalize(th
18700 69 73 29 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 is);.. }....
18710 20 20 20 70 75 62 6c 69 63 20 62 6f 6f 6c 20 49 public bool I
18720 73 43 6c 6f 73 65 64 0d 0a 20 20 20 20 7b 0d 0a sClosed.. {..
18730 20 20 20 20 20 20 67 65 74 20 7b 20 72 65 74 75 get { retu
18740 72 6e 20 5f 69 73 43 6c 6f 73 65 64 3b 20 7d 0d rn _isClosed; }.
18750 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 75 . }.... pu
18760 62 6c 69 63 20 61 62 73 74 72 61 63 74 20 62 6f blic abstract bo
18770 6f 6c 20 49 73 49 6e 76 61 6c 69 64 0d 0a 20 20 ol IsInvalid..
18780 20 20 7b 0d 0a 20 20 20 20 20 20 67 65 74 3b 0d {.. get;.
18790 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 7d 0d 0a 0d . }.... }...
187a0 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 2f .#endif.... /
187b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
187c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
187d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
187e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
187f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 //////////....
18800 20 20 23 72 65 67 69 6f 6e 20 53 51 4c 69 74 65 #region SQLite
18810 43 6f 6e 6e 65 63 74 69 6f 6e 48 61 6e 64 6c 65 ConnectionHandle
18820 20 43 6c 61 73 73 0d 0a 20 20 20 20 2f 2f 20 48 Class.. // H
18830 61 6e 64 6c 65 73 20 74 68 65 20 75 6e 6d 61 6e andles the unman
18840 61 67 65 64 20 64 61 74 61 62 61 73 65 20 70 6f aged database po
18850 69 6e 74 65 72 2c 20 61 6e 64 20 70 72 6f 76 69 inter, and provi
18860 64 65 73 20 66 69 6e 61 6c 69 7a 61 74 69 6f 6e des finalization
18870 0d 0a 20 20 20 20 2f 2f 20 73 75 70 70 6f 72 74 .. // support
18880 20 66 6f 72 20 69 74 2e 0d 0a 20 20 20 20 69 6e for it... in
18890 74 65 72 6e 61 6c 20 73 65 61 6c 65 64 20 63 6c ternal sealed cl
188a0 61 73 73 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 ass SQLiteConnec
188b0 74 69 6f 6e 48 61 6e 64 6c 65 20 3a 20 43 72 69 tionHandle : Cri
188c0 74 69 63 61 6c 48 61 6e 64 6c 65 0d 0a 20 20 20 ticalHandle..
188d0 20 7b 0d 0a 23 69 66 20 53 51 4c 49 54 45 5f 53 {..#if SQLITE_S
188e0 54 41 4e 44 41 52 44 20 26 26 20 21 50 4c 41 54 TANDARD && !PLAT
188f0 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
18900 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 20 20 69 EWORK.. i
18910 6e 74 65 72 6e 61 6c 20 64 65 6c 65 67 61 74 65 nternal delegate
18920 20 76 6f 69 64 20 43 6c 6f 73 65 43 6f 6e 6e 65 void CloseConne
18930 63 74 69 6f 6e 43 61 6c 6c 62 61 63 6b 28 0d 0a ctionCallback(..
18940 20 20 20 20 20 20 20 20 20 20 20 20 53 51 4c 69 SQLi
18950 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 48 61 6e 64 teConnectionHand
18960 6c 65 20 68 64 6c 2c 20 49 6e 74 50 74 72 20 64 le hdl, IntPtr d
18970 62 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 b);.... i
18980 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 43 nternal static C
18990 6c 6f 73 65 43 6f 6e 6e 65 63 74 69 6f 6e 43 61 loseConnectionCa
189a0 6c 6c 62 61 63 6b 20 63 6c 6f 73 65 43 6f 6e 6e llback closeConn
189b0 65 63 74 69 6f 6e 20 3d 0d 0a 20 20 20 20 20 20 ection =..
189c0 20 20 20 20 20 20 53 51 4c 69 74 65 42 61 73 65 SQLiteBase
189d0 2e 43 6c 6f 73 65 43 6f 6e 6e 65 63 74 69 6f 6e .CloseConnection
189e0 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 ;..#endif....
189f0 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////
18a00 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18a10 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18a20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18a30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a ////////////....
18a40 23 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d #if PLATFORM_COM
18a50 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
18a60 20 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 internal
18a70 72 65 61 64 6f 6e 6c 79 20 6f 62 6a 65 63 74 20 readonly object
18a80 73 79 6e 63 52 6f 6f 74 20 3d 20 6e 65 77 20 6f syncRoot = new o
18a90 62 6a 65 63 74 28 29 3b 0d 0a 23 65 6e 64 69 66 bject();..#endif
18aa0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f .... ////
18ab0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18ac0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18ad0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18ae0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18af0 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 20 20 70 ///.... p
18b00 72 69 76 61 74 65 20 62 6f 6f 6c 20 6f 77 6e 48 rivate bool ownH
18b10 61 6e 64 6c 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 andle;....
18b20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f //////////////
18b30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18b40 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18b50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18b60 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 /////////....
18b70 20 20 20 20 20 70 75 62 6c 69 63 20 73 74 61 74 public stat
18b80 69 63 20 69 6d 70 6c 69 63 69 74 20 6f 70 65 72 ic implicit oper
18b90 61 74 6f 72 20 49 6e 74 50 74 72 28 53 51 4c 69 ator IntPtr(SQLi
18ba0 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 48 61 6e 64 teConnectionHand
18bb0 6c 65 20 64 62 29 0d 0a 20 20 20 20 20 20 20 20 le db)..
18bc0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 {.. i
18bd0 66 20 28 64 62 20 21 3d 20 6e 75 6c 6c 29 0d 0a f (db != null)..
18be0 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 {..#
18bf0 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 if PLATFORM_COMP
18c00 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
18c10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6c 6f lo
18c20 63 6b 20 28 64 62 2e 73 79 6e 63 52 6f 6f 74 29 ck (db.syncRoot)
18c30 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 ..#endif..
18c40 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 {..
18c50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18c60 20 72 65 74 75 72 6e 20 64 62 2e 68 61 6e 64 6c return db.handl
18c70 65 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 e;..
18c80 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
18c90 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
18ca0 20 20 72 65 74 75 72 6e 20 49 6e 74 50 74 72 2e return IntPtr.
18cb0 5a 65 72 6f 3b 0d 0a 20 20 20 20 20 20 20 20 7d Zero;.. }
18cc0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f .... ////
18cd0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18ce0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18cf0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18d00 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18d10 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 ///.... i
18d20 6e 74 65 72 6e 61 6c 20 53 51 4c 69 74 65 43 6f nternal SQLiteCo
18d30 6e 6e 65 63 74 69 6f 6e 48 61 6e 64 6c 65 28 49 nnectionHandle(I
18d40 6e 74 50 74 72 20 64 62 2c 20 62 6f 6f 6c 20 6f ntPtr db, bool o
18d50 77 6e 48 61 6e 64 6c 65 29 0d 0a 20 20 20 20 20 wnHandle)..
18d60 20 20 20 20 20 20 20 3a 20 74 68 69 73 28 6f 77 : this(ow
18d70 6e 48 61 6e 64 6c 65 29 0d 0a 20 20 20 20 20 20 nHandle)..
18d80 20 20 7b 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 {..#if PLATFOR
18d90 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
18da0 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 RK..
18db0 6c 6f 63 6b 20 28 73 79 6e 63 52 6f 6f 74 29 0d lock (syncRoot).
18dc0 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 .#endif..
18dd0 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
18de0 20 20 20 20 20 20 20 20 74 68 69 73 2e 6f 77 6e this.own
18df0 48 61 6e 64 6c 65 20 3d 20 6f 77 6e 48 61 6e 64 Handle = ownHand
18e00 6c 65 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 le;..
18e10 20 20 20 20 20 53 65 74 48 61 6e 64 6c 65 28 64 SetHandle(d
18e20 62 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 b);..
18e30 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
18e40 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f . ///////
18e50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18e60 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18e70 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18e80 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18e90 0d 0a 0d 0a 20 20 20 20 20 20 20 20 70 72 69 76 .... priv
18ea0 61 74 65 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 ate SQLiteConnec
18eb0 74 69 6f 6e 48 61 6e 64 6c 65 28 62 6f 6f 6c 20 tionHandle(bool
18ec0 6f 77 6e 48 61 6e 64 6c 65 29 0d 0a 20 20 20 20 ownHandle)..
18ed0 20 20 20 20 20 20 20 20 3a 20 62 61 73 65 28 49 : base(I
18ee0 6e 74 50 74 72 2e 5a 65 72 6f 29 0d 0a 20 20 20 ntPtr.Zero)..
18ef0 20 20 20 20 20 7b 0d 0a 23 69 66 20 43 4f 55 4e {..#if COUN
18f00 54 5f 48 41 4e 44 4c 45 0d 0a 20 20 20 20 20 20 T_HANDLE..
18f10 20 20 20 20 20 20 69 66 20 28 6f 77 6e 48 61 6e if (ownHan
18f20 64 6c 65 29 0d 0a 20 20 20 20 20 20 20 20 20 20 dle)..
18f30 20 20 20 20 20 20 49 6e 74 65 72 6c 6f 63 6b 65 Interlocke
18f40 64 2e 49 6e 63 72 65 6d 65 6e 74 28 72 65 66 20 d.Increment(ref
18f50 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 UnsafeNativeMeth
18f60 6f 64 73 2e 63 6f 6e 6e 65 63 74 69 6f 6e 43 6f ods.connectionCo
18f70 75 6e 74 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a 20 unt);..#endif..
18f80 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
18f90 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////
18fa0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18fb0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18fc0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18fd0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 ///////////....
18fe0 20 20 20 20 20 20 20 70 72 6f 74 65 63 74 65 64 protected
18ff0 20 6f 76 65 72 72 69 64 65 20 62 6f 6f 6c 20 52 override bool R
19000 65 6c 65 61 73 65 48 61 6e 64 6c 65 28 29 0d 0a eleaseHandle()..
19010 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 50 {..#if P
19020 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
19030 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 RAMEWORK..
19040 20 20 20 20 20 20 6c 6f 63 6b 20 28 73 79 6e 63 lock (sync
19050 52 6f 6f 74 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 Root)..#endif..
19060 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
19070 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
19080 20 28 21 6f 77 6e 48 61 6e 64 6c 65 29 20 72 65 (!ownHandle) re
19090 74 75 72 6e 20 74 72 75 65 3b 0d 0a 20 20 20 20 turn true;..
190a0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
190b0 20 20 20 20 20 20 20 20 20 74 72 79 0d 0a 20 20 try..
190c0 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 {..#if
190d0 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
190e0 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
190f0 20 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 74 Int
19100 50 74 72 20 6c 6f 63 61 6c 48 61 6e 64 6c 65 20 Ptr localHandle
19110 3d 20 49 6e 74 65 72 6c 6f 63 6b 65 64 2e 45 78 = Interlocked.Ex
19120 63 68 61 6e 67 65 28 0d 0a 20 20 20 20 20 20 20 change(..
19130 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 66 ref
19140 20 68 61 6e 64 6c 65 2c 20 49 6e 74 50 74 72 2e handle, IntPtr.
19150 5a 65 72 6f 29 3b 0d 0a 0d 0a 23 69 66 20 53 51 Zero);....#if SQ
19160 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 0d 0a 20 LITE_STANDARD..
19170 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 i
19180 66 20 28 6c 6f 63 61 6c 48 61 6e 64 6c 65 20 21 f (localHandle !
19190 3d 20 49 6e 74 50 74 72 2e 5a 65 72 6f 29 0d 0a = IntPtr.Zero)..
191a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
191b0 20 20 20 20 63 6c 6f 73 65 43 6f 6e 6e 65 63 74 closeConnect
191c0 69 6f 6e 28 74 68 69 73 2c 20 6c 6f 63 61 6c 48 ion(this, localH
191d0 61 6e 64 6c 65 29 3b 0d 0a 23 65 6c 73 65 0d 0a andle);..#else..
191e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
191f0 69 66 20 28 6c 6f 63 61 6c 48 61 6e 64 6c 65 20 if (localHandle
19200 21 3d 20 49 6e 74 50 74 72 2e 5a 65 72 6f 29 0d != IntPtr.Zero).
19210 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
19220 20 20 20 20 20 53 51 4c 69 74 65 42 61 73 65 2e SQLiteBase.
19230 43 6c 6f 73 65 43 6f 6e 6e 65 63 74 69 6f 6e 28 CloseConnection(
19240 74 68 69 73 2c 20 6c 6f 63 61 6c 48 61 6e 64 6c this, localHandl
19250 65 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 23 e);..#endif....#
19260 69 66 20 21 4e 45 54 5f 43 4f 4d 50 41 43 54 5f if !NET_COMPACT_
19270 32 30 20 26 26 20 54 52 41 43 45 5f 48 41 4e 44 20 && TRACE_HAND
19280 4c 45 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 LE..
19290 20 20 20 20 74 72 79 0d 0a 20 20 20 20 20 20 20 try..
192a0 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 {..
192b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
192c0 54 72 61 63 65 2e 57 72 69 74 65 4c 69 6e 65 28 Trace.WriteLine(
192d0 53 74 72 69 6e 67 2e 46 6f 72 6d 61 74 28 0d 0a String.Format(..
192e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
192f0 20 20 20 20 20 20 20 20 43 75 6c 74 75 72 65 49 CultureI
19300 6e 66 6f 2e 43 75 72 72 65 6e 74 43 75 6c 74 75 nfo.CurrentCultu
19310 72 65 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 re,..
19320 20 20 20 20 20 20 20 20 20 20 20 20 20 22 43 6c "Cl
19330 6f 73 65 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 7b oseConnection: {
19340 30 7d 22 2c 20 6c 6f 63 61 6c 48 61 6e 64 6c 65 0}", localHandle
19350 29 29 3b 20 2f 2a 20 74 68 72 6f 77 20 2a 2f 0d )); /* throw */.
19360 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
19370 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
19380 20 20 20 20 63 61 74 63 68 0d 0a 20 20 20 20 20 catch..
19390 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
193a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
193b0 0a 23 65 6e 64 69 66 0d 0a 23 65 6c 73 65 0d 0a .#endif..#else..
193c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
193d0 6c 6f 63 6b 20 28 73 79 6e 63 52 6f 6f 74 29 0d lock (syncRoot).
193e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
193f0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
19400 20 20 20 20 20 20 20 20 69 66 20 28 68 61 6e 64 if (hand
19410 6c 65 20 21 3d 20 49 6e 74 50 74 72 2e 5a 65 72 le != IntPtr.Zer
19420 6f 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 o)..
19430 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 {..
19440 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19450 20 20 20 53 51 4c 69 74 65 42 61 73 65 2e 43 6c SQLiteBase.Cl
19460 6f 73 65 43 6f 6e 6e 65 63 74 69 6f 6e 28 74 68 oseConnection(th
19470 69 73 2c 20 68 61 6e 64 6c 65 29 3b 0d 0a 20 20 is, handle);..
19480 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19490 20 20 20 20 20 20 53 65 74 48 61 6e 64 6c 65 28 SetHandle(
194a0 49 6e 74 50 74 72 2e 5a 65 72 6f 29 3b 0d 0a 20 IntPtr.Zero);..
194b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
194c0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
194d0 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 0d }..#endif.
194e0 0a 23 69 66 20 43 4f 55 4e 54 5f 48 41 4e 44 4c .#if COUNT_HANDL
194f0 45 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 E..
19500 20 20 20 49 6e 74 65 72 6c 6f 63 6b 65 64 2e 44 Interlocked.D
19510 65 63 72 65 6d 65 6e 74 28 0d 0a 20 20 20 20 20 ecrement(..
19520 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 r
19530 65 66 20 55 6e 73 61 66 65 4e 61 74 69 76 65 4d ef UnsafeNativeM
19540 65 74 68 6f 64 73 2e 63 6f 6e 6e 65 63 74 69 6f ethods.connectio
19550 6e 43 6f 75 6e 74 29 3b 0d 0a 23 65 6e 64 69 66 nCount);..#endif
19560 0d 0a 23 69 66 20 44 45 42 55 47 0d 0a 20 20 20 ..#if DEBUG..
19570 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 ret
19580 75 72 6e 20 74 72 75 65 3b 0d 0a 23 65 6e 64 69 urn true;..#endi
19590 66 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d f.. }
195a0 0d 0a 23 69 66 20 21 4e 45 54 5f 43 4f 4d 50 41 ..#if !NET_COMPA
195b0 43 54 5f 32 30 20 26 26 20 54 52 41 43 45 5f 48 CT_20 && TRACE_H
195c0 41 4e 44 4c 45 0d 0a 20 20 20 20 20 20 20 20 20 ANDLE..
195d0 20 20 20 63 61 74 63 68 20 28 53 51 4c 69 74 65 catch (SQLite
195e0 45 78 63 65 70 74 69 6f 6e 20 65 29 0d 0a 23 65 Exception e)..#e
195f0 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 lse..
19600 20 63 61 74 63 68 20 28 53 51 4c 69 74 65 45 78 catch (SQLiteEx
19610 63 65 70 74 69 6f 6e 29 0d 0a 23 65 6e 64 69 66 ception)..#endif
19620 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d .. {.
19630 0a 23 69 66 20 21 4e 45 54 5f 43 4f 4d 50 41 43 .#if !NET_COMPAC
19640 54 5f 32 30 20 26 26 20 54 52 41 43 45 5f 48 41 T_20 && TRACE_HA
19650 4e 44 4c 45 0d 0a 20 20 20 20 20 20 20 20 20 20 NDLE..
19660 20 20 20 20 20 20 74 72 79 0d 0a 20 20 20 20 20 try..
19670 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
19680 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19690 20 20 54 72 61 63 65 2e 57 72 69 74 65 4c 69 6e Trace.WriteLin
196a0 65 28 53 74 72 69 6e 67 2e 46 6f 72 6d 61 74 28 e(String.Format(
196b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
196c0 20 20 20 20 20 20 20 20 20 20 43 75 6c 74 75 72 Cultur
196d0 65 49 6e 66 6f 2e 43 75 72 72 65 6e 74 43 75 6c eInfo.CurrentCul
196e0 74 75 72 65 2c 0d 0a 20 20 20 20 20 20 20 20 20 ture,..
196f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
19700 43 6c 6f 73 65 43 6f 6e 6e 65 63 74 69 6f 6e 3a CloseConnection:
19710 20 7b 30 7d 2c 20 65 78 63 65 70 74 69 6f 6e 3a {0}, exception:
19720 20 7b 31 7d 22 2c 0d 0a 20 20 20 20 20 20 20 20 {1}",..
19730 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19740 68 61 6e 64 6c 65 2c 20 65 29 29 3b 20 2f 2a 20 handle, e)); /*
19750 74 68 72 6f 77 20 2a 2f 0d 0a 20 20 20 20 20 20 throw */..
19760 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
19770 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 74 cat
19780 63 68 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ch..
19790 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
197a0 20 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 }..#endif
197b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
197c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 66 69 6e . fin
197d0 61 6c 6c 79 0d 0a 20 20 20 20 20 20 20 20 20 20 ally..
197e0 20 20 7b 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 {..#if PLATFOR
197f0 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
19800 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 RK..
19810 20 20 20 20 6c 6f 63 6b 20 28 73 79 6e 63 52 6f lock (syncRo
19820 6f 74 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 ot)..#endif..
19830 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a {..
19840 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19850 20 20 20 20 53 65 74 48 61 6e 64 6c 65 41 73 49 SetHandleAsI
19860 6e 76 61 6c 69 64 28 29 3b 0d 0a 20 20 20 20 20 nvalid();..
19870 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
19880 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 23 69 66 }..#if
19890 20 44 45 42 55 47 0d 0a 20 20 20 20 20 20 20 20 DEBUG..
198a0 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 return false
198b0 3b 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 20 20 ;..#else..
198c0 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
198d0 65 3b 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 e;..#endif..
198e0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
198f0 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////////
19900 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19910 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19920 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19930 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 ////////....#if
19940 43 4f 55 4e 54 5f 48 41 4e 44 4c 45 0d 0a 20 20 COUNT_HANDLE..
19950 20 20 20 20 20 20 70 75 62 6c 69 63 20 69 6e 74 public int
19960 20 57 61 73 52 65 6c 65 61 73 65 64 4f 6b 28 29 WasReleasedOk()
19970 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 .. {..
19980 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
19990 49 6e 74 65 72 6c 6f 63 6b 65 64 2e 44 65 63 72 Interlocked.Decr
199a0 65 6d 65 6e 74 28 0d 0a 20 20 20 20 20 20 20 20 ement(..
199b0 20 20 20 20 20 20 20 20 72 65 66 20 55 6e 73 61 ref Unsa
199c0 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 2e feNativeMethods.
199d0 63 6f 6e 6e 65 63 74 69 6f 6e 43 6f 75 6e 74 29 connectionCount)
199e0 3b 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 23 65 ;.. }..#e
199f0 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ndif....
19a00 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19a10 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19a20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19a30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19a40 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 ///////....
19a50 20 20 20 70 75 62 6c 69 63 20 62 6f 6f 6c 20 4f public bool O
19a60 77 6e 48 61 6e 64 6c 65 0d 0a 20 20 20 20 20 20 wnHandle..
19a70 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 {..
19a80 20 67 65 74 0d 0a 20 20 20 20 20 20 20 20 20 20 get..
19a90 20 20 7b 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 {..#if PLATFOR
19aa0 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
19ab0 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 RK..
19ac0 20 20 20 20 6c 6f 63 6b 20 28 73 79 6e 63 52 6f lock (syncRo
19ad0 6f 74 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 ot)..#endif..
19ae0 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a {..
19af0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19b00 20 20 20 20 72 65 74 75 72 6e 20 6f 77 6e 48 61 return ownHa
19b10 6e 64 6c 65 3b 0d 0a 20 20 20 20 20 20 20 20 20 ndle;..
19b20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
19b30 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
19b40 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 2f 2f }.... //
19b50 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19b60 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19b70 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19b80 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19b90 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 20 /////....
19ba0 20 70 75 62 6c 69 63 20 6f 76 65 72 72 69 64 65 public override
19bb0 20 62 6f 6f 6c 20 49 73 49 6e 76 61 6c 69 64 0d bool IsInvalid.
19bc0 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 . {..
19bd0 20 20 20 20 20 20 20 20 67 65 74 0d 0a 20 20 20 get..
19be0 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 {..#if
19bf0 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
19c00 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 FRAMEWORK..
19c10 20 20 20 20 20 20 20 20 20 20 20 6c 6f 63 6b 20 lock
19c20 28 73 79 6e 63 52 6f 6f 74 29 0d 0a 23 65 6e 64 (syncRoot)..#end
19c30 69 66 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 if..
19c40 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
19c50 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
19c60 6e 20 28 68 61 6e 64 6c 65 20 3d 3d 20 49 6e 74 n (handle == Int
19c70 50 74 72 2e 5a 65 72 6f 29 3b 0d 0a 20 20 20 20 Ptr.Zero);..
19c80 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
19c90 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
19ca0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
19cb0 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////////
19cc0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19cd0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19ce0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19cf0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 23 69 //////////....#i
19d00 66 20 44 45 42 55 47 0d 0a 20 20 20 20 20 20 20 f DEBUG..
19d10 20 70 75 62 6c 69 63 20 6f 76 65 72 72 69 64 65 public override
19d20 20 73 74 72 69 6e 67 20 54 6f 53 74 72 69 6e 67 string ToString
19d30 28 29 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a 23 ().. {..#
19d40 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 if PLATFORM_COMP
19d50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
19d60 20 20 20 20 20 20 20 20 20 20 6c 6f 63 6b 20 28 lock (
19d70 73 79 6e 63 52 6f 6f 74 29 0d 0a 23 65 6e 64 69 syncRoot)..#endi
19d80 66 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b f.. {
19d90 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19da0 20 20 72 65 74 75 72 6e 20 68 61 6e 64 6c 65 2e return handle.
19db0 54 6f 53 74 72 69 6e 67 28 29 3b 0d 0a 20 20 20 ToString();..
19dc0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
19dd0 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a 20 }..#endif..
19de0 20 20 20 7d 0d 0a 20 20 20 20 23 65 6e 64 72 65 }.. #endre
19df0 67 69 6f 6e 0d 0a 0d 0a 20 20 20 20 2f 2f 2f 2f gion.... ////
19e00 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19e10 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19e20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19e30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19e40 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 23 ///////.... #
19e50 72 65 67 69 6f 6e 20 53 51 4c 69 74 65 53 74 61 region SQLiteSta
19e60 74 65 6d 65 6e 74 48 61 6e 64 6c 65 20 43 6c 61 tementHandle Cla
19e70 73 73 0d 0a 20 20 20 20 2f 2f 20 50 72 6f 76 69 ss.. // Provi
19e80 64 65 73 20 66 69 6e 61 6c 69 7a 61 74 69 6f 6e des finalization
19e90 20 73 75 70 70 6f 72 74 20 66 6f 72 20 75 6e 6d support for unm
19ea0 61 6e 61 67 65 64 20 53 51 4c 69 74 65 20 73 74 anaged SQLite st
19eb0 61 74 65 6d 65 6e 74 73 2e 0d 0a 20 20 20 20 69 atements... i
19ec0 6e 74 65 72 6e 61 6c 20 73 65 61 6c 65 64 20 63 nternal sealed c
19ed0 6c 61 73 73 20 53 51 4c 69 74 65 53 74 61 74 65 lass SQLiteState
19ee0 6d 65 6e 74 48 61 6e 64 6c 65 20 3a 20 43 72 69 mentHandle : Cri
19ef0 74 69 63 61 6c 48 61 6e 64 6c 65 0d 0a 20 20 20 ticalHandle..
19f00 20 7b 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 4d {..#if PLATFORM
19f10 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
19f20 4b 0d 0a 20 20 20 20 20 20 20 20 69 6e 74 65 72 K.. inter
19f30 6e 61 6c 20 72 65 61 64 6f 6e 6c 79 20 6f 62 6a nal readonly obj
19f40 65 63 74 20 73 79 6e 63 52 6f 6f 74 20 3d 20 6e ect syncRoot = n
19f50 65 77 20 6f 62 6a 65 63 74 28 29 3b 0d 0a 23 65 ew object();..#e
19f60 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ndif....
19f70 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19f80 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19f90 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19fa0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
19fb0 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 ///////....
19fc0 20 20 20 70 72 69 76 61 74 65 20 53 51 4c 69 74 private SQLit
19fd0 65 43 6f 6e 6e 65 63 74 69 6f 6e 48 61 6e 64 6c eConnectionHandl
19fe0 65 20 63 6e 6e 3b 0d 0a 0d 0a 20 20 20 20 20 20 e cnn;....
19ff0 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f //////////////
1a000 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a010 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a020 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a030 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 /////////....
1a040 20 20 20 20 20 70 75 62 6c 69 63 20 73 74 61 74 public stat
1a050 69 63 20 69 6d 70 6c 69 63 69 74 20 6f 70 65 72 ic implicit oper
1a060 61 74 6f 72 20 49 6e 74 50 74 72 28 53 51 4c 69 ator IntPtr(SQLi
1a070 74 65 53 74 61 74 65 6d 65 6e 74 48 61 6e 64 6c teStatementHandl
1a080 65 20 73 74 6d 74 29 0d 0a 20 20 20 20 20 20 20 e stmt)..
1a090 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1a0a0 69 66 20 28 73 74 6d 74 20 21 3d 20 6e 75 6c 6c if (stmt != null
1a0b0 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b ).. {
1a0c0 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 ..#if PLATFORM_C
1a0d0 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
1a0e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1a0f0 20 6c 6f 63 6b 20 28 73 74 6d 74 2e 73 79 6e 63 lock (stmt.sync
1a100 52 6f 6f 74 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 Root)..#endif..
1a110 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b {
1a120 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1a130 20 20 20 20 20 20 72 65 74 75 72 6e 20 73 74 6d return stm
1a140 74 2e 68 61 6e 64 6c 65 3b 0d 0a 20 20 20 20 20 t.handle;..
1a150 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1a160 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1a170 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
1a180 49 6e 74 50 74 72 2e 5a 65 72 6f 3b 0d 0a 20 20 IntPtr.Zero;..
1a190 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1a1a0 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////////
1a1b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a1c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a1d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a1e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 //////////....
1a1f0 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 53 internal S
1a200 51 4c 69 74 65 53 74 61 74 65 6d 65 6e 74 48 61 QLiteStatementHa
1a210 6e 64 6c 65 28 53 51 4c 69 74 65 43 6f 6e 6e 65 ndle(SQLiteConne
1a220 63 74 69 6f 6e 48 61 6e 64 6c 65 20 63 6e 6e 2c ctionHandle cnn,
1a230 20 49 6e 74 50 74 72 20 73 74 6d 74 29 0d 0a 20 IntPtr stmt)..
1a240 20 20 20 20 20 20 20 20 20 20 20 3a 20 74 68 69 : thi
1a250 73 28 29 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a s().. {..
1a260 23 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d #if PLATFORM_COM
1a270 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
1a280 20 20 20 20 20 20 20 20 20 20 20 6c 6f 63 6b 20 lock
1a290 28 73 79 6e 63 52 6f 6f 74 29 0d 0a 23 65 6e 64 (syncRoot)..#end
1a2a0 69 66 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 if..
1a2b0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1a2c0 20 20 20 74 68 69 73 2e 63 6e 6e 20 3d 20 63 6e this.cnn = cn
1a2d0 6e 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 n;..
1a2e0 20 20 20 20 53 65 74 48 61 6e 64 6c 65 28 73 74 SetHandle(st
1a2f0 6d 74 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 mt);..
1a300 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1a310 0d 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f .. //////
1a320 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a330 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a340 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a350 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a360 2f 0d 0a 0d 0a 20 20 20 20 20 20 20 20 70 72 69 /.... pri
1a370 76 61 74 65 20 53 51 4c 69 74 65 53 74 61 74 65 vate SQLiteState
1a380 6d 65 6e 74 48 61 6e 64 6c 65 28 29 0d 0a 20 20 mentHandle()..
1a390 20 20 20 20 20 20 20 20 20 20 3a 20 62 61 73 65 : base
1a3a0 28 49 6e 74 50 74 72 2e 5a 65 72 6f 29 0d 0a 20 (IntPtr.Zero)..
1a3b0 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 43 4f {..#if CO
1a3c0 55 4e 54 5f 48 41 4e 44 4c 45 0d 0a 20 20 20 20 UNT_HANDLE..
1a3d0 20 20 20 20 20 20 20 20 49 6e 74 65 72 6c 6f 63 Interloc
1a3e0 6b 65 64 2e 49 6e 63 72 65 6d 65 6e 74 28 0d 0a ked.Increment(..
1a3f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a400 72 65 66 20 55 6e 73 61 66 65 4e 61 74 69 76 65 ref UnsafeNative
1a410 4d 65 74 68 6f 64 73 2e 73 74 61 74 65 6d 65 6e Methods.statemen
1a420 74 43 6f 75 6e 74 29 3b 0d 0a 23 65 6e 64 69 66 tCount);..#endif
1a430 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
1a440 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////
1a450 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a460 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a470 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1a480 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a //////////////..
1a490 0d 0a 20 20 20 20 20 20 20 20 70 72 6f 74 65 63 .. protec
1a4a0 74 65 64 20 6f 76 65 72 72 69 64 65 20 62 6f 6f ted override boo
1a4b0 6c 20 52 65 6c 65 61 73 65 48 61 6e 64 6c 65 28 l ReleaseHandle(
1a4c0 29 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 ).. {..
1a4d0 20 20 20 20 20 20 20 20 20 20 74 72 79 0d 0a 20 try..
1a4e0 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 {..#i
1a4f0 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
1a500 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
1a510 20 20 20 20 20 20 20 20 20 20 20 20 20 20 49 6e In
1a520 74 50 74 72 20 6c 6f 63 61 6c 48 61 6e 64 6c 65 tPtr localHandle
1a530 20 3d 20 49 6e 74 65 72 6c 6f 63 6b 65 64 2e 45 = Interlocked.E
1a540 78 63 68 61 6e 67 65 28 0d 0a 20 20 20 20 20 20 xchange(..
1a550 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 re
1a560 66 20 68 61 6e 64 6c 65 2c 20 49 6e 74 50 74 72 f handle, IntPtr
1a570 2e 5a 65 72 6f 29 3b 0d 0a 0d 0a 20 20 20 20 20 .Zero);....
1a580 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6c if (l
1a590 6f 63 61 6c 48 61 6e 64 6c 65 20 21 3d 20 49 6e ocalHandle != In
1a5a0 74 50 74 72 2e 5a 65 72 6f 29 0d 0a 20 20 20 20 tPtr.Zero)..
1a5b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a5c0 53 51 4c 69 74 65 42 61 73 65 2e 46 69 6e 61 6c SQLiteBase.Final
1a5d0 69 7a 65 53 74 61 74 65 6d 65 6e 74 28 63 6e 6e izeStatement(cnn
1a5e0 2c 20 6c 6f 63 61 6c 48 61 6e 64 6c 65 29 3b 0d , localHandle);.
1a5f0 0a 0d 0a 23 69 66 20 21 4e 45 54 5f 43 4f 4d 50 ...#if !NET_COMP
1a600 41 43 54 5f 32 30 20 26 26 20 54 52 41 43 45 5f ACT_20 && TRACE_
1a610 48 41 4e 44 4c 45 0d 0a 20 20 20 20 20 20 20 20 HANDLE..
1a620 20 20 20 20 20 20 20 20 74 72 79 0d 0a 20 20 20 try..
1a630 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a {..
1a640 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a650 20 20 20 20 54 72 61 63 65 2e 57 72 69 74 65 4c Trace.WriteL
1a660 69 6e 65 28 53 74 72 69 6e 67 2e 46 6f 72 6d 61 ine(String.Forma
1a670 74 28 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 t(..
1a680 20 20 20 20 20 20 20 20 20 20 20 20 43 75 6c 74 Cult
1a690 75 72 65 49 6e 66 6f 2e 43 75 72 72 65 6e 74 43 ureInfo.CurrentC
1a6a0 75 6c 74 75 72 65 2c 0d 0a 20 20 20 20 20 20 20 ulture,..
1a6b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a6c0 20 22 46 69 6e 61 6c 69 7a 65 53 74 61 74 65 6d "FinalizeStatem
1a6d0 65 6e 74 3a 20 7b 30 7d 22 2c 20 6c 6f 63 61 6c ent: {0}", local
1a6e0 48 61 6e 64 6c 65 29 29 3b 20 2f 2a 20 74 68 72 Handle)); /* thr
1a6f0 6f 77 20 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 ow */..
1a700 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1a710 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 0d catch.
1a720 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1a730 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1a740 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a 23 }..#endif..#
1a750 65 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 else..
1a760 20 20 20 20 20 20 6c 6f 63 6b 20 28 73 79 6e 63 lock (sync
1a770 52 6f 6f 74 29 0d 0a 20 20 20 20 20 20 20 20 20 Root)..
1a780 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 {..
1a790 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
1a7a0 20 28 68 61 6e 64 6c 65 20 21 3d 20 49 6e 74 50 (handle != IntP
1a7b0 74 72 2e 5a 65 72 6f 29 0d 0a 20 20 20 20 20 20 tr.Zero)..
1a7c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d {.
1a7d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1a7e0 20 20 20 20 20 20 20 20 20 53 51 4c 69 74 65 42 SQLiteB
1a7f0 61 73 65 2e 46 69 6e 61 6c 69 7a 65 53 74 61 74 ase.FinalizeStat
1a800 65 6d 65 6e 74 28 63 6e 6e 2c 20 68 61 6e 64 6c ement(cnn, handl
1a810 65 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e);..
1a820 20 20 20 20 20 20 20 20 20 20 20 20 20 53 65 74 Set
1a830 48 61 6e 64 6c 65 28 49 6e 74 50 74 72 2e 5a 65 Handle(IntPtr.Ze
1a840 72 6f 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 ro);..
1a850 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1a860 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
1a870 23 65 6e 64 69 66 0d 0a 23 69 66 20 43 4f 55 4e #endif..#if COUN
1a880 54 5f 48 41 4e 44 4c 45 0d 0a 20 20 20 20 20 20 T_HANDLE..
1a890 20 20 20 20 20 20 20 20 20 20 49 6e 74 65 72 6c Interl
1a8a0 6f 63 6b 65 64 2e 44 65 63 72 65 6d 65 6e 74 28 ocked.Decrement(
1a8b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1a8c0 20 20 20 20 20 20 72 65 66 20 55 6e 73 61 66 65 ref Unsafe
1a8d0 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 2e 73 74 NativeMethods.st
1a8e0 61 74 65 6d 65 6e 74 43 6f 75 6e 74 29 3b 0d 0a atementCount);..
1a8f0 23 65 6e 64 69 66 0d 0a 23 69 66 20 44 45 42 55 #endif..#if DEBU
1a900 47 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 G..
1a910 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 3b 0d return true;.
1a920 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 .#endif..
1a930 20 20 20 20 20 7d 0d 0a 23 69 66 20 21 4e 45 54 }..#if !NET
1a940 5f 43 4f 4d 50 41 43 54 5f 32 30 20 26 26 20 54 _COMPACT_20 && T
1a950 52 41 43 45 5f 48 41 4e 44 4c 45 0d 0a 20 20 20 RACE_HANDLE..
1a960 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 28 catch (
1a970 53 51 4c 69 74 65 45 78 63 65 70 74 69 6f 6e 20 SQLiteException
1a980 65 29 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 20 e)..#else..
1a990 20 20 20 20 20 20 20 63 61 74 63 68 20 28 53 51 catch (SQ
1a9a0 4c 69 74 65 45 78 63 65 70 74 69 6f 6e 29 0d 0a LiteException)..
1a9b0 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 20 #endif..
1a9c0 20 20 20 20 7b 0d 0a 23 69 66 20 21 4e 45 54 5f {..#if !NET_
1a9d0 43 4f 4d 50 41 43 54 5f 32 30 20 26 26 20 54 52 COMPACT_20 && TR
1a9e0 41 43 45 5f 48 41 4e 44 4c 45 0d 0a 20 20 20 20 ACE_HANDLE..
1a9f0 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 0d try.
1aa00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1aa10 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1aa20 20 20 20 20 20 20 20 20 54 72 61 63 65 2e 57 72 Trace.Wr
1aa30 69 74 65 4c 69 6e 65 28 53 74 72 69 6e 67 2e 46 iteLine(String.F
1aa40 6f 72 6d 61 74 28 0d 0a 20 20 20 20 20 20 20 20 ormat(..
1aa50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1aa60 43 75 6c 74 75 72 65 49 6e 66 6f 2e 43 75 72 72 CultureInfo.Curr
1aa70 65 6e 74 43 75 6c 74 75 72 65 2c 0d 0a 20 20 20 entCulture,..
1aa80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1aa90 20 20 20 20 20 22 46 69 6e 61 6c 69 7a 65 53 74 "FinalizeSt
1aaa0 61 74 65 6d 65 6e 74 3a 20 7b 30 7d 2c 20 65 78 atement: {0}, ex
1aab0 63 65 70 74 69 6f 6e 3a 20 7b 31 7d 22 2c 0d 0a ception: {1}",..
1aac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1aad0 20 20 20 20 20 20 20 20 68 61 6e 64 6c 65 2c 20 handle,
1aae0 65 29 29 3b 20 2f 2a 20 74 68 72 6f 77 20 2a 2f e)); /* throw */
1aaf0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1ab00 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
1ab10 20 20 20 20 20 63 61 74 63 68 0d 0a 20 20 20 20 catch..
1ab20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 {..
1ab30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
1ab40 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 ..#endif..
1ab50 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1ab60 20 20 20 20 20 66 69 6e 61 6c 6c 79 0d 0a 20 20 finally..
1ab70 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 {..#if
1ab80 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 PLATFORM_COMPAC
1ab90 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
1aba0 20 20 20 20 20 20 20 20 20 20 20 20 6c 6f 63 6b lock
1abb0 20 28 73 79 6e 63 52 6f 6f 74 29 0d 0a 23 65 6e (syncRoot)..#en
1abc0 64 69 66 0d 0a 20 20 20 20 20 20 20 20 20 20 20 dif..
1abd0 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
1abe0 20 20 20 20 20 20 20 20 20 20 20 20 53 65 74 48 SetH
1abf0 61 6e 64 6c 65 41 73 49 6e 76 61 6c 69 64 28 29 andleAsInvalid()
1ac00 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ;..
1ac10 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1ac20 20 20 7d 0d 0a 23 69 66 20 44 45 42 55 47 0d 0a }..#if DEBUG..
1ac30 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 retu
1ac40 72 6e 20 66 61 6c 73 65 3b 0d 0a 23 65 6c 73 65 rn false;..#else
1ac50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
1ac60 74 75 72 6e 20 74 72 75 65 3b 0d 0a 23 65 6e 64 turn true;..#end
1ac70 69 66 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d if.. }...
1ac80 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f . ///////
1ac90 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1aca0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1acb0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1acc0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1acd0 0d 0a 0d 0a 23 69 66 20 43 4f 55 4e 54 5f 48 41 ....#if COUNT_HA
1ace0 4e 44 4c 45 0d 0a 20 20 20 20 20 20 20 20 70 75 NDLE.. pu
1acf0 62 6c 69 63 20 69 6e 74 20 57 61 73 52 65 6c 65 blic int WasRele
1ad00 61 73 65 64 4f 6b 28 29 0d 0a 20 20 20 20 20 20 asedOk()..
1ad10 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 {..
1ad20 20 72 65 74 75 72 6e 20 49 6e 74 65 72 6c 6f 63 return Interloc
1ad30 6b 65 64 2e 44 65 63 72 65 6d 65 6e 74 28 0d 0a ked.Decrement(..
1ad40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ad50 72 65 66 20 55 6e 73 61 66 65 4e 61 74 69 76 65 ref UnsafeNative
1ad60 4d 65 74 68 6f 64 73 2e 73 74 61 74 65 6d 65 6e Methods.statemen
1ad70 74 43 6f 75 6e 74 29 3b 0d 0a 20 20 20 20 20 20 tCount);..
1ad80 20 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 }..#endif....
1ad90 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////
1ada0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1adb0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1adc0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1add0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a //////////////..
1ade0 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 .. public
1adf0 20 6f 76 65 72 72 69 64 65 20 62 6f 6f 6c 20 49 override bool I
1ae00 73 49 6e 76 61 6c 69 64 0d 0a 20 20 20 20 20 20 sInvalid..
1ae10 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 {..
1ae20 20 67 65 74 0d 0a 20 20 20 20 20 20 20 20 20 20 get..
1ae30 20 20 7b 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 {..#if PLATFOR
1ae40 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
1ae50 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 RK..
1ae60 20 20 20 20 6c 6f 63 6b 20 28 73 79 6e 63 52 6f lock (syncRo
1ae70 6f 74 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 ot)..#endif..
1ae80 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a {..
1ae90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1aea0 20 20 20 20 72 65 74 75 72 6e 20 28 68 61 6e 64 return (hand
1aeb0 6c 65 20 3d 3d 20 49 6e 74 50 74 72 2e 5a 65 72 le == IntPtr.Zer
1aec0 6f 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 o);..
1aed0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1aee0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1aef0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f .... ////
1af00 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1af10 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1af20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1af30 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1af40 2f 2f 2f 0d 0a 0d 0a 23 69 66 20 44 45 42 55 47 ///....#if DEBUG
1af50 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c 69 63 .. public
1af60 20 6f 76 65 72 72 69 64 65 20 73 74 72 69 6e 67 override string
1af70 20 54 6f 53 74 72 69 6e 67 28 29 0d 0a 20 20 20 ToString()..
1af80 20 20 20 20 20 7b 0d 0a 23 69 66 20 50 4c 41 54 {..#if PLAT
1af90 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
1afa0 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 EWORK..
1afb0 20 20 20 6c 6f 63 6b 20 28 73 79 6e 63 52 6f 6f lock (syncRoo
1afc0 74 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 t)..#endif..
1afd0 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 {..
1afe0 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
1aff0 6e 20 68 61 6e 64 6c 65 2e 54 6f 53 74 72 69 6e n handle.ToStrin
1b000 67 28 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 g();..
1b010 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1b020 23 65 6e 64 69 66 0d 0a 20 20 20 20 7d 0d 0a 20 #endif.. }..
1b030 20 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 0d #endregion...
1b040 0a 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f . ///////////
1b050 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b060 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b070 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b080 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b090 0d 0a 0d 0a 20 20 20 20 23 72 65 67 69 6f 6e 20 .... #region
1b0a0 53 51 4c 69 74 65 42 61 63 6b 75 70 48 61 6e 64 SQLiteBackupHand
1b0b0 6c 65 20 43 6c 61 73 73 0d 0a 20 20 20 20 2f 2f le Class.. //
1b0c0 20 50 72 6f 76 69 64 65 73 20 66 69 6e 61 6c 69 Provides finali
1b0d0 7a 61 74 69 6f 6e 20 73 75 70 70 6f 72 74 20 66 zation support f
1b0e0 6f 72 20 75 6e 6d 61 6e 61 67 65 64 20 53 51 4c or unmanaged SQL
1b0f0 69 74 65 20 62 61 63 6b 75 70 20 6f 62 6a 65 63 ite backup objec
1b100 74 73 2e 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 ts... interna
1b110 6c 20 73 65 61 6c 65 64 20 63 6c 61 73 73 20 53 l sealed class S
1b120 51 4c 69 74 65 42 61 63 6b 75 70 48 61 6e 64 6c QLiteBackupHandl
1b130 65 20 3a 20 43 72 69 74 69 63 61 6c 48 61 6e 64 e : CriticalHand
1b140 6c 65 0d 0a 20 20 20 20 7b 0d 0a 23 69 66 20 50 le.. {..#if P
1b150 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
1b160 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 RAMEWORK..
1b170 20 20 69 6e 74 65 72 6e 61 6c 20 72 65 61 64 6f internal reado
1b180 6e 6c 79 20 6f 62 6a 65 63 74 20 73 79 6e 63 52 nly object syncR
1b190 6f 6f 74 20 3d 20 6e 65 77 20 6f 62 6a 65 63 74 oot = new object
1b1a0 28 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 ();..#endif....
1b1b0 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////
1b1c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b1d0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b1e0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b1f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a //////////////..
1b200 0d 0a 20 20 20 20 20 20 20 20 70 72 69 76 61 74 .. privat
1b210 65 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 e SQLiteConnecti
1b220 6f 6e 48 61 6e 64 6c 65 20 63 6e 6e 3b 0d 0a 0d onHandle cnn;...
1b230 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f . ///////
1b240 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b250 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b260 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b270 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b280 0d 0a 0d 0a 20 20 20 20 20 20 20 20 70 75 62 6c .... publ
1b290 69 63 20 73 74 61 74 69 63 20 69 6d 70 6c 69 63 ic static implic
1b2a0 69 74 20 6f 70 65 72 61 74 6f 72 20 49 6e 74 50 it operator IntP
1b2b0 74 72 28 53 51 4c 69 74 65 42 61 63 6b 75 70 48 tr(SQLiteBackupH
1b2c0 61 6e 64 6c 65 20 62 61 63 6b 75 70 29 0d 0a 20 andle backup)..
1b2d0 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 {..
1b2e0 20 20 20 20 20 20 69 66 20 28 62 61 63 6b 75 70 if (backup
1b2f0 20 21 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 != null)..
1b300 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 50 4c {..#if PL
1b310 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
1b320 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 20 AMEWORK..
1b330 20 20 20 20 20 20 20 20 20 6c 6f 63 6b 20 28 62 lock (b
1b340 61 63 6b 75 70 2e 73 79 6e 63 52 6f 6f 74 29 0d ackup.syncRoot).
1b350 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 .#endif..
1b360 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 {..
1b370 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b380 72 65 74 75 72 6e 20 62 61 63 6b 75 70 2e 68 61 return backup.ha
1b390 6e 64 6c 65 3b 0d 0a 20 20 20 20 20 20 20 20 20 ndle;..
1b3a0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1b3b0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1b3c0 20 20 20 20 20 72 65 74 75 72 6e 20 49 6e 74 50 return IntP
1b3d0 74 72 2e 5a 65 72 6f 3b 0d 0a 20 20 20 20 20 20 tr.Zero;..
1b3e0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 2f }.... /
1b3f0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b400 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b410 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b420 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b430 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 //////....
1b440 20 20 69 6e 74 65 72 6e 61 6c 20 53 51 4c 69 74 internal SQLit
1b450 65 42 61 63 6b 75 70 48 61 6e 64 6c 65 28 53 51 eBackupHandle(SQ
1b460 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 48 61 LiteConnectionHa
1b470 6e 64 6c 65 20 63 6e 6e 2c 20 49 6e 74 50 74 72 ndle cnn, IntPtr
1b480 20 62 61 63 6b 75 70 29 0d 0a 20 20 20 20 20 20 backup)..
1b490 20 20 20 20 20 20 3a 20 74 68 69 73 28 29 0d 0a : this()..
1b4a0 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 50 {..#if P
1b4b0 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
1b4c0 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 RAMEWORK..
1b4d0 20 20 20 20 20 20 6c 6f 63 6b 20 28 73 79 6e 63 lock (sync
1b4e0 52 6f 6f 74 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 Root)..#endif..
1b4f0 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
1b500 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 th
1b510 69 73 2e 63 6e 6e 20 3d 20 63 6e 6e 3b 0d 0a 20 is.cnn = cnn;..
1b520 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 S
1b530 65 74 48 61 6e 64 6c 65 28 62 61 63 6b 75 70 29 etHandle(backup)
1b540 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ;.. }
1b550 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
1b560 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f /////////
1b570 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b580 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b590 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b5a0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a //////////////..
1b5b0 0d 0a 20 20 20 20 20 20 20 20 70 72 69 76 61 74 .. privat
1b5c0 65 20 53 51 4c 69 74 65 42 61 63 6b 75 70 48 61 e SQLiteBackupHa
1b5d0 6e 64 6c 65 28 29 0d 0a 20 20 20 20 20 20 20 20 ndle()..
1b5e0 20 20 20 20 3a 20 62 61 73 65 28 49 6e 74 50 74 : base(IntPt
1b5f0 72 2e 5a 65 72 6f 29 0d 0a 20 20 20 20 20 20 20 r.Zero)..
1b600 20 7b 0d 0a 23 69 66 20 43 4f 55 4e 54 5f 48 41 {..#if COUNT_HA
1b610 4e 44 4c 45 0d 0a 20 20 20 20 20 20 20 20 20 20 NDLE..
1b620 20 20 49 6e 74 65 72 6c 6f 63 6b 65 64 2e 49 6e Interlocked.In
1b630 63 72 65 6d 65 6e 74 28 0d 0a 20 20 20 20 20 20 crement(..
1b640 20 20 20 20 20 20 20 20 20 20 72 65 66 20 55 6e ref Un
1b650 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 safeNativeMethod
1b660 73 2e 62 61 63 6b 75 70 43 6f 75 6e 74 29 3b 0d s.backupCount);.
1b670 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 .#endif..
1b680 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 2f 2f }.... //
1b690 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b6a0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b6b0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b6c0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1b6d0 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 20 20 20 20 20 20 /////....
1b6e0 20 70 72 6f 74 65 63 74 65 64 20 6f 76 65 72 72 protected overr
1b6f0 69 64 65 20 62 6f 6f 6c 20 52 65 6c 65 61 73 65 ide bool Release
1b700 48 61 6e 64 6c 65 28 29 0d 0a 20 20 20 20 20 20 Handle()..
1b710 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 {..
1b720 20 74 72 79 0d 0a 20 20 20 20 20 20 20 20 20 20 try..
1b730 20 20 7b 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f {..#if !PLATFO
1b740 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
1b750 4f 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ORK..
1b760 20 20 20 20 20 49 6e 74 50 74 72 20 6c 6f 63 61 IntPtr loca
1b770 6c 48 61 6e 64 6c 65 20 3d 20 49 6e 74 65 72 6c lHandle = Interl
1b780 6f 63 6b 65 64 2e 45 78 63 68 61 6e 67 65 28 0d ocked.Exchange(.
1b790 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1b7a0 20 20 20 20 20 72 65 66 20 68 61 6e 64 6c 65 2c ref handle,
1b7b0 20 49 6e 74 50 74 72 2e 5a 65 72 6f 29 3b 0d 0a IntPtr.Zero);..
1b7c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1b7d0 20 20 69 66 20 28 6c 6f 63 61 6c 48 61 6e 64 6c if (localHandl
1b7e0 65 20 21 3d 20 49 6e 74 50 74 72 2e 5a 65 72 6f e != IntPtr.Zero
1b7f0 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 )..
1b800 20 20 20 20 20 20 20 53 51 4c 69 74 65 42 61 73 SQLiteBas
1b810 65 2e 46 69 6e 69 73 68 42 61 63 6b 75 70 28 63 e.FinishBackup(c
1b820 6e 6e 2c 20 6c 6f 63 61 6c 48 61 6e 64 6c 65 29 nn, localHandle)
1b830 3b 0d 0a 0d 0a 23 69 66 20 21 4e 45 54 5f 43 4f ;....#if !NET_CO
1b840 4d 50 41 43 54 5f 32 30 20 26 26 20 54 52 41 43 MPACT_20 && TRAC
1b850 45 5f 48 41 4e 44 4c 45 0d 0a 20 20 20 20 20 20 E_HANDLE..
1b860 20 20 20 20 20 20 20 20 20 20 74 72 79 0d 0a 20 try..
1b870 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b {
1b880 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1b890 20 20 20 20 20 20 54 72 61 63 65 2e 57 72 69 74 Trace.Writ
1b8a0 65 4c 69 6e 65 28 53 74 72 69 6e 67 2e 46 6f 72 eLine(String.For
1b8b0 6d 61 74 28 0d 0a 20 20 20 20 20 20 20 20 20 20 mat(..
1b8c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 75 Cu
1b8d0 6c 74 75 72 65 49 6e 66 6f 2e 43 75 72 72 65 6e ltureInfo.Curren
1b8e0 74 43 75 6c 74 75 72 65 2c 0d 0a 20 20 20 20 20 tCulture,..
1b8f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b900 20 20 20 22 46 69 6e 69 73 68 42 61 63 6b 75 70 "FinishBackup
1b910 3a 20 7b 30 7d 22 2c 20 6c 6f 63 61 6c 48 61 6e : {0}", localHan
1b920 64 6c 65 29 29 3b 20 2f 2a 20 74 68 72 6f 77 20 dle)); /* throw
1b930 2a 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 */..
1b940 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1b950 20 20 20 20 20 20 20 63 61 74 63 68 0d 0a 20 20 catch..
1b960 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d {.
1b970 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1b980 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a 23 65 6c 73 }..#endif..#els
1b990 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
1b9a0 20 20 20 6c 6f 63 6b 20 28 73 79 6e 63 52 6f 6f lock (syncRoo
1b9b0 74 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 t)..
1b9c0 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
1b9d0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 68 if (h
1b9e0 61 6e 64 6c 65 20 21 3d 20 49 6e 74 50 74 72 2e andle != IntPtr.
1b9f0 5a 65 72 6f 29 0d 0a 20 20 20 20 20 20 20 20 20 Zero)..
1ba00 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 {..
1ba10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ba20 20 20 20 20 20 20 53 51 4c 69 74 65 42 61 73 65 SQLiteBase
1ba30 2e 46 69 6e 69 73 68 42 61 63 6b 75 70 28 63 6e .FinishBackup(cn
1ba40 6e 2c 20 68 61 6e 64 6c 65 29 3b 0d 0a 20 20 20 n, handle);..
1ba50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ba60 20 20 20 20 20 53 65 74 48 61 6e 64 6c 65 28 49 SetHandle(I
1ba70 6e 74 50 74 72 2e 5a 65 72 6f 29 3b 0d 0a 20 20 ntPtr.Zero);..
1ba80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ba90 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
1baa0 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 0d 0a }..#endif..
1bab0 23 69 66 20 43 4f 55 4e 54 5f 48 41 4e 44 4c 45 #if COUNT_HANDLE
1bac0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1bad0 20 20 49 6e 74 65 72 6c 6f 63 6b 65 64 2e 44 65 Interlocked.De
1bae0 63 72 65 6d 65 6e 74 28 0d 0a 20 20 20 20 20 20 crement(..
1baf0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 re
1bb00 66 20 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 f UnsafeNativeMe
1bb10 74 68 6f 64 73 2e 62 61 63 6b 75 70 43 6f 75 6e thods.backupCoun
1bb20 74 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a 23 69 66 t);..#endif..#if
1bb30 20 44 45 42 55 47 0d 0a 20 20 20 20 20 20 20 20 DEBUG..
1bb40 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 return t
1bb50 72 75 65 3b 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 rue;..#endif..
1bb60 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 23 69 66 }..#if
1bb70 20 21 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 30 !NET_COMPACT_20
1bb80 20 26 26 20 54 52 41 43 45 5f 48 41 4e 44 4c 45 && TRACE_HANDLE
1bb90 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 61 .. ca
1bba0 74 63 68 20 28 53 51 4c 69 74 65 45 78 63 65 70 tch (SQLiteExcep
1bbb0 74 69 6f 6e 20 65 29 0d 0a 23 65 6c 73 65 0d 0a tion e)..#else..
1bbc0 20 20 20 20 20 20 20 20 20 20 20 20 63 61 74 63 catc
1bbd0 68 20 28 53 51 4c 69 74 65 45 78 63 65 70 74 69 h (SQLiteExcepti
1bbe0 6f 6e 29 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 on)..#endif..
1bbf0 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 {..#if
1bc00 21 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 30 20 !NET_COMPACT_20
1bc10 26 26 20 54 52 41 43 45 5f 48 41 4e 44 4c 45 0d && TRACE_HANDLE.
1bc20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1bc30 20 74 72 79 0d 0a 20 20 20 20 20 20 20 20 20 20 try..
1bc40 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 {..
1bc50 20 20 20 20 20 20 20 20 20 20 20 20 20 54 72 61 Tra
1bc60 63 65 2e 57 72 69 74 65 4c 69 6e 65 28 53 74 72 ce.WriteLine(Str
1bc70 69 6e 67 2e 46 6f 72 6d 61 74 28 0d 0a 20 20 20 ing.Format(..
1bc80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1bc90 20 20 20 20 20 43 75 6c 74 75 72 65 49 6e 66 6f CultureInfo
1bca0 2e 43 75 72 72 65 6e 74 43 75 6c 74 75 72 65 2c .CurrentCulture,
1bcb0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1bcc0 20 20 20 20 20 20 20 20 20 20 22 46 69 6e 69 73 "Finis
1bcd0 68 42 61 63 6b 75 70 3a 20 7b 30 7d 2c 20 65 78 hBackup: {0}, ex
1bce0 63 65 70 74 69 6f 6e 3a 20 7b 31 7d 22 2c 0d 0a ception: {1}",..
1bcf0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1bd00 20 20 20 20 20 20 20 20 68 61 6e 64 6c 65 2c 20 handle,
1bd10 65 29 29 3b 20 2f 2a 20 74 68 72 6f 77 20 2a 2f e)); /* throw */
1bd20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1bd30 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
1bd40 20 20 20 20 20 63 61 74 63 68 0d 0a 20 20 20 20 catch..
1bd50 20 20 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 {..
1bd60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
1bd70 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 ..#endif..
1bd80 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1bd90 20 20 20 20 20 66 69 6e 61 6c 6c 79 0d 0a 20 20 finally..
1bda0 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 23 69 66 {..#if
1bdb0 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 PLATFORM_COMPAC
1bdc0 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
1bdd0 20 20 20 20 20 20 20 20 20 20 20 20 6c 6f 63 6b lock
1bde0 20 28 73 79 6e 63 52 6f 6f 74 29 0d 0a 23 65 6e (syncRoot)..#en
1bdf0 64 69 66 0d 0a 20 20 20 20 20 20 20 20 20 20 20 dif..
1be00 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
1be10 20 20 20 20 20 20 20 20 20 20 20 20 53 65 74 48 SetH
1be20 61 6e 64 6c 65 41 73 49 6e 76 61 6c 69 64 28 29 andleAsInvalid()
1be30 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ;..
1be40 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1be50 20 20 7d 0d 0a 23 69 66 20 44 45 42 55 47 0d 0a }..#if DEBUG..
1be60 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 retu
1be70 72 6e 20 66 61 6c 73 65 3b 0d 0a 23 65 6c 73 65 rn false;..#else
1be80 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
1be90 74 75 72 6e 20 74 72 75 65 3b 0d 0a 23 65 6e 64 turn true;..#end
1bea0 69 66 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d if.. }...
1beb0 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f . ///////
1bec0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1bed0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1bee0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1bef0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1bf00 0d 0a 0d 0a 23 69 66 20 43 4f 55 4e 54 5f 48 41 ....#if COUNT_HA
1bf10 4e 44 4c 45 0d 0a 20 20 20 20 20 20 20 20 70 75 NDLE.. pu
1bf20 62 6c 69 63 20 69 6e 74 20 57 61 73 52 65 6c 65 blic int WasRele
1bf30 61 73 65 64 4f 6b 28 29 0d 0a 20 20 20 20 20 20 asedOk()..
1bf40 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 {..
1bf50 20 72 65 74 75 72 6e 20 49 6e 74 65 72 6c 6f 63 return Interloc
1bf60 6b 65 64 2e 44 65 63 72 65 6d 65 6e 74 28 0d 0a ked.Decrement(..
1bf70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1bf80 72 65 66 20 55 6e 73 61 66 65 4e 61 74 69 76 65 ref UnsafeNative
1bf90 4d 65 74 68 6f 64 73 2e 62 61 63 6b 75 70 43 6f Methods.backupCo
1bfa0 75 6e 74 29 3b 0d 0a 20 20 20 20 20 20 20 20 7d unt);.. }
1bfb0 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 ..#endif....
1bfc0 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////
1bfd0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1bfe0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1bff0 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1c000 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 0d 0a 20 ///////////....
1c010 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 6f 76 public ov
1c020 65 72 72 69 64 65 20 62 6f 6f 6c 20 49 73 49 6e erride bool IsIn
1c030 76 61 6c 69 64 0d 0a 20 20 20 20 20 20 20 20 7b valid.. {
1c040 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 67 65 .. ge
1c050 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b t.. {
1c060 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 4d 5f 43 ..#if PLATFORM_C
1c070 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
1c080 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1c090 20 6c 6f 63 6b 20 28 73 79 6e 63 52 6f 6f 74 29 lock (syncRoot)
1c0a0 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 ..#endif..
1c0b0 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 {..
1c0c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c0d0 20 72 65 74 75 72 6e 20 28 68 61 6e 64 6c 65 20 return (handle
1c0e0 3d 3d 20 49 6e 74 50 74 72 2e 5a 65 72 6f 29 3b == IntPtr.Zero);
1c0f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c100 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
1c110 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
1c120 0a 20 20 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f . ///////
1c130 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1c140 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1c150 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1c160 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1c170 0d 0a 0d 0a 23 69 66 20 44 45 42 55 47 0d 0a 20 ....#if DEBUG..
1c180 20 20 20 20 20 20 20 70 75 62 6c 69 63 20 6f 76 public ov
1c190 65 72 72 69 64 65 20 73 74 72 69 6e 67 20 54 6f erride string To
1c1a0 53 74 72 69 6e 67 28 29 0d 0a 20 20 20 20 20 20 String()..
1c1b0 20 20 7b 0d 0a 23 69 66 20 50 4c 41 54 46 4f 52 {..#if PLATFOR
1c1c0 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
1c1d0 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 RK..
1c1e0 6c 6f 63 6b 20 28 73 79 6e 63 52 6f 6f 74 29 0d lock (syncRoot).
1c1f0 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 20 .#endif..
1c200 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
1c210 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 68 return h
1c220 61 6e 64 6c 65 2e 54 6f 53 74 72 69 6e 67 28 29 andle.ToString()
1c230 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ;.. }
1c240 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 23 65 6e .. }..#en
1c250 64 69 66 0d 0a 20 20 20 20 7d 0d 0a 20 20 20 20 dif.. }..
1c260 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 7d 0d 0a #endregion..}..