0000: ef bb bf 2f 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 2a 2a 2a 0d 0a 20 2a ************.. *
0040: 20 41 44 4f 2e 4e 45 54 20 32 2e 30 20 44 61 74 ADO.NET 2.0 Dat
0050: 61 20 50 72 6f 76 69 64 65 72 20 66 6f 72 20 53 a Provider for S
0060: 51 4c 69 74 65 20 56 65 72 73 69 6f 6e 20 33 2e QLite Version 3.
0070: 58 0d 0a 20 2a 20 57 72 69 74 74 65 6e 20 62 79 X.. * Written by
0080: 20 52 6f 62 65 72 74 20 53 69 6d 70 73 6f 6e 20 Robert Simpson
0090: 28 72 6f 62 65 72 74 40 62 6c 61 63 6b 63 61 73 (robert@blackcas
00a0: 74 6c 65 73 6f 66 74 2e 63 6f 6d 29 0d 0a 20 2a tlesoft.com).. *
00b0: 20 0d 0a 20 2a 20 52 65 6c 65 61 73 65 64 20 74 .. * Released t
00c0: 6f 20 74 68 65 20 70 75 62 6c 69 63 20 64 6f 6d o the public dom
00d0: 61 69 6e 2c 20 75 73 65 20 61 74 20 79 6f 75 72 ain, use at your
00e0: 20 6f 77 6e 20 72 69 73 6b 21 0d 0a 20 2a 2a 2a own 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 2a 2a 2a 2a 2f 0d 0a 0d 0a 6e 61 6d 65 73 70 *****/....namesp
0130: 61 63 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e ace System.Data.
0140: 53 51 4c 69 74 65 0d 0a 7b 0d 0a 20 20 75 73 69 SQLite..{.. usi
0150: 6e 67 20 53 79 73 74 65 6d 3b 0d 0a 23 69 66 20 ng System;..#if
0160: 50 52 45 4c 4f 41 44 5f 4e 41 54 49 56 45 5f 4c PRELOAD_NATIVE_L
0170: 49 42 52 41 52 59 20 7c 7c 20 44 45 42 55 47 0d IBRARY || DEBUG.
0180: 0a 20 20 75 73 69 6e 67 20 53 79 73 74 65 6d 2e . using System.
0190: 44 69 61 67 6e 6f 73 74 69 63 73 3b 0d 0a 23 65 Diagnostics;..#e
01a0: 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 50 52 45 4c ndif....#if PREL
01b0: 4f 41 44 5f 4e 41 54 49 56 45 5f 4c 49 42 52 41 OAD_NATIVE_LIBRA
01c0: 52 59 0d 0a 20 20 75 73 69 6e 67 20 53 79 73 74 RY.. using Syst
01d0: 65 6d 2e 43 6f 6c 6c 65 63 74 69 6f 6e 73 2e 47 em.Collections.G
01e0: 65 6e 65 72 69 63 3b 0d 0a 20 20 75 73 69 6e 67 eneric;.. using
01f0: 20 53 79 73 74 65 6d 2e 49 4f 3b 0d 0a 20 20 75 System.IO;.. u
0200: 73 69 6e 67 20 53 79 73 74 65 6d 2e 52 65 66 6c sing System.Refl
0210: 65 63 74 69 6f 6e 3b 0d 0a 23 65 6e 64 69 66 0d ection;..#endif.
0220: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
0230: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
0240: 4b 20 26 26 20 21 44 45 42 55 47 0d 0a 20 20 75 K && !DEBUG.. u
0250: 73 69 6e 67 20 53 79 73 74 65 6d 2e 53 65 63 75 sing System.Secu
0260: 72 69 74 79 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d rity;..#endif...
0270: 0a 20 20 75 73 69 6e 67 20 53 79 73 74 65 6d 2e . using System.
0280: 52 75 6e 74 69 6d 65 2e 49 6e 74 65 72 6f 70 53 Runtime.InteropS
0290: 65 72 76 69 63 65 73 3b 0d 0a 0d 0a 23 69 66 20 ervices;....#if
02a0: 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
02b0: 54 46 52 41 4d 45 57 4f 52 4b 20 26 26 20 21 44 TFRAMEWORK && !D
02c0: 45 42 55 47 0d 0a 20 20 5b 53 75 70 70 72 65 73 EBUG.. [Suppres
02d0: 73 55 6e 6d 61 6e 61 67 65 64 43 6f 64 65 53 65 sUnmanagedCodeSe
02e0: 63 75 72 69 74 79 5d 0d 0a 23 65 6e 64 69 66 0d curity]..#endif.
02f0: 0a 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 . internal stat
0300: 69 63 20 63 6c 61 73 73 20 55 6e 73 61 66 65 4e ic class UnsafeN
0310: 61 74 69 76 65 4d 65 74 68 6f 64 73 0d 0a 20 20 ativeMethods..
0320: 7b 0d 0a 20 20 20 20 20 20 23 72 65 67 69 6f 6e {.. #region
0330: 20 4f 70 74 69 6f 6e 61 6c 20 4e 61 74 69 76 65 Optional Native
0340: 20 53 51 4c 69 74 65 20 4c 69 62 72 61 72 79 20 SQLite Library
0350: 50 72 65 2d 4c 6f 61 64 69 6e 67 20 43 6f 64 65 Pre-Loading Code
0360: 0d 0a 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 .. //..
0370: 20 20 2f 2f 20 4e 4f 54 45 3a 20 49 66 20 77 65 // NOTE: If we
0380: 20 61 72 65 20 6c 6f 6f 6b 69 6e 67 20 66 6f 72 are looking for
0390: 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 53 51 the standard SQ
03a0: 4c 69 74 65 20 44 4c 4c 20 28 22 73 71 6c 69 74 Lite DLL ("sqlit
03b0: 65 33 2e 64 6c 6c 22 29 2c 0d 0a 20 20 20 20 20 e3.dll"),..
03c0: 20 2f 2f 20 20 20 20 20 20 20 74 68 65 20 69 6e // the in
03d0: 74 65 72 6f 70 20 44 4c 4c 20 28 22 53 51 4c 69 terop DLL ("SQLi
03e0: 74 65 2e 49 6e 74 65 72 6f 70 2e 64 6c 6c 22 29 te.Interop.dll")
03f0: 2c 20 6f 72 20 77 65 20 61 72 65 20 72 75 6e 6e , or we are runn
0400: 69 6e 67 20 6f 6e 20 74 68 65 0d 0a 20 20 20 20 ing on the..
0410: 20 20 2f 2f 20 20 20 20 20 20 20 2e 4e 45 54 20 // .NET
0420: 43 6f 6d 70 61 63 74 20 46 72 61 6d 65 77 6f 72 Compact Framewor
0430: 6b 2c 20 77 65 20 73 68 6f 75 6c 64 20 69 6e 63 k, we should inc
0440: 6c 75 64 65 20 74 68 69 73 20 63 6f 64 65 20 28 lude this code (
0450: 6f 6e 6c 79 20 69 66 20 74 68 65 0d 0a 20 20 20 only if the..
0460: 20 20 20 2f 2f 20 20 20 20 20 20 20 66 65 61 74 // feat
0470: 75 72 65 20 68 61 73 20 61 63 74 75 61 6c 6c 79 ure has actually
0480: 20 62 65 65 6e 20 65 6e 61 62 6c 65 64 29 2e 20 been enabled).
0490: 20 54 68 69 73 20 63 6f 64 65 20 77 6f 75 6c 64 This code would
04a0: 20 62 65 20 74 6f 74 61 6c 6c 79 0d 0a 20 20 20 be totally..
04b0: 20 20 20 2f 2f 20 20 20 20 20 20 20 72 65 64 75 // redu
04c0: 6e 64 61 6e 74 20 69 66 20 74 68 69 73 20 6d 6f ndant if this mo
04d0: 64 75 6c 65 20 68 61 73 20 62 65 65 6e 20 62 75 dule has been bu
04e0: 6e 64 6c 65 64 20 69 6e 74 6f 20 74 68 65 20 6d ndled into the m
04f0: 69 78 65 64 2d 6d 6f 64 65 0d 0a 20 20 20 20 20 ixed-mode..
0500: 20 2f 2f 20 20 20 20 20 20 20 61 73 73 65 6d 62 // assemb
0510: 6c 79 2e 0d 0a 20 20 20 20 20 20 2f 2f 0d 0a 23 ly... //..#
0520: 69 66 20 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 if SQLITE_STANDA
0530: 52 44 20 7c 7c 20 55 53 45 5f 49 4e 54 45 52 4f RD || USE_INTERO
0540: 50 5f 44 4c 4c 20 7c 7c 20 50 4c 41 54 46 4f 52 P_DLL || PLATFOR
0550: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
0560: 52 4b 0d 0a 0d 0a 20 20 20 20 20 20 2f 2f 0d 0a RK.... //..
0570: 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 4f // NOTE: O
0580: 6e 6c 79 20 63 6f 6d 70 69 6c 65 20 69 6e 20 74 nly compile in t
0590: 68 65 20 6e 61 74 69 76 65 20 6c 69 62 72 61 72 he native librar
05a0: 79 20 70 72 65 2d 6c 6f 61 64 20 63 6f 64 65 20 y pre-load code
05b0: 69 66 20 74 68 65 20 66 65 61 74 75 72 65 0d 0a if the feature..
05c0: 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 68 // h
05d0: 61 73 20 62 65 65 6e 20 65 6e 61 62 6c 65 64 20 as been enabled
05e0: 66 6f 72 20 74 68 69 73 20 62 75 69 6c 64 2e 0d for this build..
05f0: 0a 20 20 20 20 20 20 2f 2f 0d 0a 23 69 66 20 50 . //..#if P
0600: 52 45 4c 4f 41 44 5f 4e 41 54 49 56 45 5f 4c 49 RELOAD_NATIVE_LI
0610: 42 52 41 52 59 0d 0a 23 69 66 20 21 50 4c 41 54 BRARY..#if !PLAT
0620: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
0630: 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 2f 2f 2f EWORK.. ///
0640: 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 <summary>..
0650: 20 20 2f 2f 2f 20 54 68 65 20 6e 61 6d 65 20 6f /// The name o
0660: 66 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e f the environmen
0670: 74 20 76 61 72 69 61 62 6c 65 20 63 6f 6e 74 61 t variable conta
0680: 69 6e 69 6e 67 20 74 68 65 20 70 72 6f 63 65 73 ining the proces
0690: 73 6f 72 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 61 sor.. /// a
06a0: 72 63 68 69 74 65 63 74 75 72 65 20 6f 66 20 74 rchitecture of t
06b0: 68 65 20 63 75 72 72 65 6e 74 20 70 72 6f 63 65 he current proce
06c0: 73 73 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c ss... /// <
06d0: 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 /summary>..
06e0: 20 70 72 69 76 61 74 65 20 73 74 61 74 69 63 20 private static
06f0: 72 65 61 64 6f 6e 6c 79 20 73 74 72 69 6e 67 20 readonly string
0700: 50 52 4f 43 45 53 53 4f 52 5f 41 52 43 48 49 54 PROCESSOR_ARCHIT
0710: 45 43 54 55 52 45 20 3d 0d 0a 20 20 20 20 20 20 ECTURE =..
0720: 20 20 20 20 22 50 52 4f 43 45 53 53 4f 52 5f 41 "PROCESSOR_A
0730: 52 43 48 49 54 45 43 54 55 52 45 22 3b 0d 0a 23 RCHITECTURE";..#
0740: 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 20 20 2f endif.... /
0750: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0760: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0770: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0780: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0790: 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 20 20 ////////..
07a0: 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 /// <summary>..
07b0: 20 20 20 20 20 2f 2f 2f 20 53 74 6f 72 65 73 20 /// Stores
07c0: 74 68 65 20 6d 61 70 70 69 6e 67 73 20 62 65 74 the mappings bet
07d0: 77 65 65 6e 20 70 72 6f 63 65 73 73 6f 72 20 61 ween processor a
07e0: 72 63 68 69 74 65 63 74 75 72 65 20 6e 61 6d 65 rchitecture name
07f0: 73 20 61 6e 64 20 70 6c 61 74 66 6f 72 6d 0d 0a s and platform..
0800: 20 20 20 20 20 20 2f 2f 2f 20 6e 61 6d 65 73 2e /// names.
0810: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 .. /// </su
0820: 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 70 72 mmary>.. pr
0830: 69 76 61 74 65 20 73 74 61 74 69 63 20 44 69 63 ivate static Dic
0840: 74 69 6f 6e 61 72 79 3c 73 74 72 69 6e 67 2c 20 tionary<string,
0850: 73 74 72 69 6e 67 3e 20 70 72 6f 63 65 73 73 6f string> processo
0860: 72 41 72 63 68 69 74 65 63 74 75 72 65 50 6c 61 rArchitecturePla
0870: 74 66 6f 72 6d 73 3b 0d 0a 0d 0a 20 20 20 20 20 tforms;....
0880: 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////////
0890: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
08a0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
08b0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
08c0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 //////////..
08d0: 20 20 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e 0d /// <summary>.
08e0: 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 69 73 20 . /// This
08f0: 69 73 20 74 68 65 20 50 2f 49 6e 76 6f 6b 65 20 is the P/Invoke
0900: 6d 65 74 68 6f 64 20 74 68 61 74 20 77 72 61 70 method that wrap
0910: 73 20 74 68 65 20 6e 61 74 69 76 65 20 57 69 6e s the native Win
0920: 33 32 20 4c 6f 61 64 4c 69 62 72 61 72 79 0d 0a 32 LoadLibrary..
0930: 20 20 20 20 20 20 2f 2f 2f 20 66 75 6e 63 74 69 /// functi
0940: 6f 6e 2e 20 20 53 65 65 20 74 68 65 20 4d 53 44 on. See the MSD
0950: 4e 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 N documentation
0960: 66 6f 72 20 66 75 6c 6c 20 64 65 74 61 69 6c 73 for full details
0970: 20 6f 6e 20 77 68 61 74 20 69 74 0d 0a 20 20 20 on what it..
0980: 20 20 20 2f 2f 2f 20 64 6f 65 73 2e 0d 0a 20 20 /// does...
0990: 20 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 /// </summar
09a0: 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 70 y>.. /// <p
09b0: 61 72 61 6d 20 6e 61 6d 65 3d 22 66 69 6c 65 4e aram name="fileN
09c0: 61 6d 65 22 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f ame">.. ///
09d0: 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 The name of the
09e0: 20 65 78 65 63 75 74 61 62 6c 65 20 6c 69 62 72 executable libr
09f0: 61 72 79 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ary... ///
0a00: 3c 2f 70 61 72 61 6d 3e 0d 0a 20 20 20 20 20 20 </param>..
0a10: 2f 2f 2f 20 3c 72 65 74 75 72 6e 73 3e 0d 0a 20 /// <returns>..
0a20: 20 20 20 20 20 2f 2f 2f 20 54 68 65 20 6e 61 74 /// The nat
0a30: 69 76 65 20 6d 6f 64 75 6c 65 20 68 61 6e 64 6c ive module handl
0a40: 65 20 75 70 6f 6e 20 73 75 63 63 65 73 73 20 2d e upon success -
0a50: 4f 52 2d 20 49 6e 74 50 74 72 2e 5a 65 72 6f 20 OR- IntPtr.Zero
0a60: 6f 6e 20 66 61 69 6c 75 72 65 2e 0d 0a 20 20 20 on failure...
0a70: 20 20 20 2f 2f 2f 20 3c 2f 72 65 74 75 72 6e 73 /// </returns
0a80: 3e 0d 0a 20 20 20 20 20 20 5b 44 6c 6c 49 6d 70 >.. [DllImp
0a90: 6f 72 74 28 22 6b 65 72 6e 65 6c 33 32 22 2c 0d ort("kernel32",.
0aa0: 0a 20 20 20 20 20 20 20 20 20 20 43 61 6c 6c 69 . Calli
0ab0: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
0ac0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
0ad0: 2e 57 69 6e 61 70 69 2c 20 43 68 61 72 53 65 74 .Winapi, CharSet
0ae0: 20 3d 20 43 68 61 72 53 65 74 2e 41 75 74 6f 2c = CharSet.Auto,
0af0: 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
0b00: 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
0b10: 0d 0a 20 20 20 20 20 20 20 20 20 20 42 65 73 74 .. Best
0b20: 46 69 74 4d 61 70 70 69 6e 67 20 3d 20 66 61 6c FitMapping = fal
0b30: 73 65 2c 20 54 68 72 6f 77 4f 6e 55 6e 6d 61 70 se, ThrowOnUnmap
0b40: 70 61 62 6c 65 43 68 61 72 20 3d 20 74 72 75 65 pableChar = true
0b50: 2c 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 ,..#endif..
0b60: 20 20 20 20 20 53 65 74 4c 61 73 74 45 72 72 6f SetLastErro
0b70: 72 20 3d 20 74 72 75 65 29 5d 0d 0a 20 20 20 20 r = true)]..
0b80: 20 20 70 72 69 76 61 74 65 20 73 74 61 74 69 63 private static
0b90: 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 4c extern IntPtr L
0ba0: 6f 61 64 4c 69 62 72 61 72 79 28 73 74 72 69 6e oadLibrary(strin
0bb0: 67 20 66 69 6c 65 4e 61 6d 65 29 3b 0d 0a 0d 0a g fileName);....
0bc0: 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f //////////
0bd0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0be0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0bf0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0c00: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d ///////////////.
0c10: 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 75 6d 6d . /// <summ
0c20: 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ary>.. ///
0c30: 54 68 65 20 6e 61 74 69 76 65 20 6d 6f 64 75 6c The native modul
0c40: 65 20 68 61 6e 64 6c 65 20 66 6f 72 20 74 68 65 e handle for the
0c50: 20 6e 61 74 69 76 65 20 53 51 4c 69 74 65 20 6c native SQLite l
0c60: 69 62 72 61 72 79 20 6f 72 20 74 68 65 20 76 61 ibrary or the va
0c70: 6c 75 65 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 49 lue.. /// I
0c80: 6e 74 50 74 72 2e 5a 65 72 6f 2e 0d 0a 20 20 20 ntPtr.Zero...
0c90: 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 /// </summary
0ca0: 3e 0d 0a 20 20 20 20 20 20 70 72 69 76 61 74 65 >.. private
0cb0: 20 73 74 61 74 69 63 20 49 6e 74 50 74 72 20 5f static IntPtr _
0cc0: 53 51 4c 69 74 65 4d 6f 64 75 6c 65 20 3d 20 49 SQLiteModule = I
0cd0: 6e 74 50 74 72 2e 5a 65 72 6f 3b 0d 0a 0d 0a 20 ntPtr.Zero;....
0ce0: 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ///////////
0cf0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0d00: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0d10: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
0d20: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a //////////////..
0d30: 20 20 20 20 20 20 2f 2f 2f 20 3c 73 75 6d 6d 61 /// <summa
0d40: 72 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 41 ry>.. /// A
0d50: 74 74 65 6d 70 74 73 20 74 6f 20 69 6e 69 74 69 ttempts to initi
0d60: 61 6c 69 7a 65 20 74 68 69 73 20 63 6c 61 73 73 alize this class
0d70: 20 62 79 20 70 72 65 2d 6c 6f 61 64 69 6e 67 20 by pre-loading
0d80: 74 68 65 20 6e 61 74 69 76 65 20 53 51 4c 69 74 the native SQLit
0d90: 65 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 6c 69 62 e.. /// lib
0da0: 72 61 72 79 20 66 6f 72 20 74 68 65 20 70 72 6f rary for the pro
0db0: 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 63 74 cessor architect
0dc0: 75 72 65 20 6f 66 20 74 68 65 20 63 75 72 72 65 ure of the curre
0dd0: 6e 74 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 nt process...
0de0: 20 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 /// </summary
0df0: 3e 0d 0a 20 20 20 20 20 20 73 74 61 74 69 63 20 >.. static
0e00: 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 UnsafeNativeMeth
0e10: 6f 64 73 28 29 0d 0a 20 20 20 20 20 20 7b 0d 0a ods().. {..
0e20: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
0e30: 20 20 20 20 20 20 20 20 2f 2f 20 54 4f 44 4f 3a // TODO:
0e40: 20 4d 61 6b 65 20 73 75 72 65 20 74 68 69 73 20 Make sure this
0e50: 6c 69 73 74 20 69 73 20 75 70 64 61 74 65 64 20 list is updated
0e60: 69 66 20 74 68 65 20 73 75 70 70 6f 72 74 65 64 if the supported
0e70: 20 70 72 6f 63 65 73 73 6f 72 0d 0a 20 20 20 20 processor..
0e80: 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 61 // a
0e90: 72 63 68 69 74 65 63 74 75 72 65 20 6e 61 6d 65 rchitecture name
0ea0: 73 20 61 6e 64 2f 6f 72 20 70 6c 61 74 66 6f 72 s and/or platfor
0eb0: 6d 20 6e 61 6d 65 73 20 63 68 61 6e 67 65 73 2e m names changes.
0ec0: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a .. //..
0ed0: 20 20 20 20 20 20 20 20 20 20 69 66 20 28 70 72 if (pr
0ee0: 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 ocessorArchitect
0ef0: 75 72 65 50 6c 61 74 66 6f 72 6d 73 20 3d 3d 20 urePlatforms ==
0f00: 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 null)..
0f10: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
0f20: 20 20 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 processorArchi
0f30: 74 65 63 74 75 72 65 50 6c 61 74 66 6f 72 6d 73 tecturePlatforms
0f40: 20 3d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 =..
0f50: 20 20 20 20 20 20 6e 65 77 20 44 69 63 74 69 6f new Dictio
0f60: 6e 61 72 79 3c 73 74 72 69 6e 67 2c 20 73 74 72 nary<string, str
0f70: 69 6e 67 3e 28 29 3b 0d 0a 0d 0a 20 20 20 20 20 ing>();....
0f80: 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 73 73 process
0f90: 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 50 6c orArchitecturePl
0fa0: 61 74 66 6f 72 6d 73 2e 41 64 64 28 22 58 38 36 atforms.Add("X86
0fb0: 22 2c 20 22 57 69 6e 33 32 22 29 3b 0d 0a 20 20 ", "Win32");..
0fc0: 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 proc
0fd0: 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 essorArchitectur
0fe0: 65 50 6c 61 74 66 6f 72 6d 73 2e 41 64 64 28 22 ePlatforms.Add("
0ff0: 41 4d 44 36 34 22 2c 20 22 78 36 34 22 29 3b 0d AMD64", "x64");.
1000: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 . p
1010: 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 rocessorArchitec
1020: 74 75 72 65 50 6c 61 74 66 6f 72 6d 73 2e 41 64 turePlatforms.Ad
1030: 64 28 22 49 41 36 34 22 2c 20 22 49 74 61 6e 69 d("IA64", "Itani
1040: 75 6d 22 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 um");..
1050: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
1060: 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f //.. //
1070: 20 42 55 47 42 55 47 3a 20 57 68 61 74 20 61 62 BUGBUG: What ab
1080: 6f 75 74 20 6f 74 68 65 72 20 61 70 70 6c 69 63 out other applic
1090: 61 74 69 6f 6e 20 64 6f 6d 61 69 6e 73 3f 0d 0a ation domains?..
10a0: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
10b0: 20 20 20 20 20 20 20 20 69 66 20 28 5f 53 51 4c if (_SQL
10c0: 69 74 65 4d 6f 64 75 6c 65 20 3d 3d 20 49 6e 74 iteModule == Int
10d0: 50 74 72 2e 5a 65 72 6f 29 0d 0a 20 20 20 20 20 Ptr.Zero)..
10e0: 20 20 20 20 20 20 20 20 20 5f 53 51 4c 69 74 65 _SQLite
10f0: 4d 6f 64 75 6c 65 20 3d 20 50 72 65 4c 6f 61 64 Module = PreLoad
1100: 53 51 4c 69 74 65 44 6c 6c 28 6e 75 6c 6c 2c 20 SQLiteDll(null,
1110: 6e 75 6c 6c 29 3b 0d 0a 20 20 20 20 20 20 7d 0d null);.. }.
1120: 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f ... ///////
1130: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1140: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1150: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1160: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1170: 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 //.. /// <s
1180: 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f ummary>.. /
1190: 2f 2f 20 51 75 65 72 69 65 73 20 61 6e 64 20 72 // Queries and r
11a0: 65 74 75 72 6e 73 20 74 68 65 20 62 61 73 65 20 eturns the base
11b0: 64 69 72 65 63 74 6f 72 79 20 6f 66 20 74 68 65 directory of the
11c0: 20 63 75 72 72 65 6e 74 20 61 70 70 6c 69 63 61 current applica
11d0: 74 69 6f 6e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 tion.. ///
11e0: 64 6f 6d 61 69 6e 2e 0d 0a 20 20 20 20 20 20 2f domain... /
11f0: 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 // </summary>..
1200: 20 20 20 20 20 2f 2f 2f 20 3c 72 65 74 75 72 6e /// <return
1210: 73 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 s>.. /// Th
1220: 65 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 e base directory
1230: 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 6e 74 for the current
1240: 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f 6d application dom
1250: 61 69 6e 20 2d 4f 52 2d 20 6e 75 6c 6c 20 69 66 ain -OR- null if
1260: 20 69 74 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 63 it.. /// c
1270: 61 6e 6e 6f 74 20 62 65 20 64 65 74 65 72 6d 69 annot be determi
1280: 6e 65 64 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 ned... ///
1290: 3c 2f 72 65 74 75 72 6e 73 3e 0d 0a 20 20 20 20 </returns>..
12a0: 20 20 70 72 69 76 61 74 65 20 73 74 61 74 69 63 private static
12b0: 20 73 74 72 69 6e 67 20 47 65 74 42 61 73 65 44 string GetBaseD
12c0: 69 72 65 63 74 6f 72 79 28 29 0d 0a 20 20 20 20 irectory()..
12d0: 20 20 7b 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f {..#if !PLATFO
12e0: 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
12f0: 4f 52 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 72 ORK.. r
1300: 65 74 75 72 6e 20 41 70 70 44 6f 6d 61 69 6e 2e eturn AppDomain.
1310: 43 75 72 72 65 6e 74 44 6f 6d 61 69 6e 2e 42 61 CurrentDomain.Ba
1320: 73 65 44 69 72 65 63 74 6f 72 79 3b 0d 0a 23 65 seDirectory;..#e
1330: 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 41 lse.. A
1340: 73 73 65 6d 62 6c 79 20 61 73 73 65 6d 62 6c 79 ssembly assembly
1350: 20 3d 20 41 73 73 65 6d 62 6c 79 2e 47 65 74 45 = Assembly.GetE
1360: 78 65 63 75 74 69 6e 67 41 73 73 65 6d 62 6c 79 xecutingAssembly
1370: 28 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ();....
1380: 20 69 66 20 28 61 73 73 65 6d 62 6c 79 20 3d 3d if (assembly ==
1390: 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 null)..
13a0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 75 6c return nul
13b0: 6c 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 l;....
13c0: 41 73 73 65 6d 62 6c 79 4e 61 6d 65 20 61 73 73 AssemblyName ass
13d0: 65 6d 62 6c 79 4e 61 6d 65 20 3d 20 61 73 73 65 emblyName = asse
13e0: 6d 62 6c 79 2e 47 65 74 4e 61 6d 65 28 29 3b 0d mbly.GetName();.
13f0: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
1400: 28 61 73 73 65 6d 62 6c 79 4e 61 6d 65 20 3d 3d (assemblyName ==
1410: 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 null)..
1420: 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 75 6c return nul
1430: 6c 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 l;....
1440: 74 72 79 0d 0a 20 20 20 20 20 20 20 20 20 20 7b try.. {
1450: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1460: 72 65 74 75 72 6e 20 50 61 74 68 2e 47 65 74 44 return Path.GetD
1470: 69 72 65 63 74 6f 72 79 4e 61 6d 65 28 61 73 73 irectoryName(ass
1480: 65 6d 62 6c 79 4e 61 6d 65 2e 43 6f 64 65 42 61 emblyName.CodeBa
1490: 73 65 29 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 se);..
14a0: 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 74 }.. cat
14b0: 63 68 0d 0a 20 20 20 20 20 20 20 20 20 20 7b 0d ch.. {.
14c0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f . /
14d0: 2f 20 64 6f 20 6e 6f 74 68 69 6e 67 2e 0d 0a 20 / do nothing...
14e0: 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
14f0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e return n
1500: 75 6c 6c 3b 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 ull;..#endif..
1510: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 2f }.... /
1520: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1530: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1540: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1550: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1560: 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 20 20 20 20 20 ////////..
1570: 2f 2f 2f 20 3c 73 75 6d 6d 61 72 79 3e 0d 0a 20 /// <summary>..
1580: 20 20 20 20 20 2f 2f 2f 20 51 75 65 72 69 65 73 /// Queries
1590: 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 and returns the
15a0: 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 processor archi
15b0: 74 65 63 74 75 72 65 20 6f 66 20 74 68 65 20 63 tecture of the c
15c0: 75 72 72 65 6e 74 0d 0a 20 20 20 20 20 20 2f 2f urrent.. //
15d0: 2f 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 20 / process...
15e0: 20 20 2f 2f 2f 20 3c 2f 73 75 6d 6d 61 72 79 3e /// </summary>
15f0: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 72 65 74 .. /// <ret
1600: 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f urns>.. ///
1610: 20 54 68 65 20 70 72 6f 63 65 73 73 6f 72 20 61 The processor a
1620: 72 63 68 69 74 65 63 74 75 72 65 20 6f 66 20 74 rchitecture of t
1630: 68 65 20 63 75 72 72 65 6e 74 20 70 72 6f 63 65 he current proce
1640: 73 73 20 2d 4f 52 2d 20 6e 75 6c 6c 20 69 66 20 ss -OR- null if
1650: 69 74 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 63 61 it.. /// ca
1660: 6e 6e 6f 74 20 62 65 20 64 65 74 65 72 6d 69 6e nnot be determin
1670: 65 64 2e 20 20 41 6c 77 61 79 73 20 72 65 74 75 ed. Always retu
1680: 72 6e 73 20 61 6e 20 65 6d 70 74 79 20 73 74 72 rns an empty str
1690: 69 6e 67 20 77 68 65 6e 20 72 75 6e 6e 69 6e 67 ing when running
16a0: 20 6f 6e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 74 on.. /// t
16b0: 68 65 20 2e 4e 45 54 20 43 6f 6d 70 61 63 74 20 he .NET Compact
16c0: 46 72 61 6d 65 77 6f 72 6b 2e 0d 0a 20 20 20 20 Framework...
16d0: 20 20 2f 2f 2f 20 3c 2f 72 65 74 75 72 6e 73 3e /// </returns>
16e0: 0d 0a 20 20 20 20 20 20 70 72 69 76 61 74 65 20 .. private
16f0: 73 74 61 74 69 63 20 73 74 72 69 6e 67 20 47 65 static string Ge
1700: 74 50 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 tProcessorArchit
1710: 65 63 74 75 72 65 28 29 0d 0a 20 20 20 20 20 20 ecture()..
1720: 7b 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d {..#if !PLATFORM
1730: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
1740: 4b 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d K.. //.
1750: 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 42 55 . // BU
1760: 47 42 55 47 3a 20 57 69 6c 6c 20 74 68 69 73 20 GBUG: Will this
1770: 61 6c 77 61 79 73 20 62 65 20 72 65 6c 69 61 62 always be reliab
1780: 6c 65 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 2f le?.. /
1790: 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 /.. ret
17a0: 75 72 6e 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 2e urn Environment.
17b0: 47 65 74 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 GetEnvironmentVa
17c0: 72 69 61 62 6c 65 28 50 52 4f 43 45 53 53 4f 52 riable(PROCESSOR
17d0: 5f 41 52 43 48 49 54 45 43 54 55 52 45 29 3b 0d _ARCHITECTURE);.
17e0: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 .#else..
17f0: 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 //..
1800: 2f 2f 20 42 55 47 42 55 47 3a 20 4e 6f 20 77 61 // BUGBUG: No wa
1810: 79 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 y to determine t
1820: 68 69 73 20 76 61 6c 75 65 20 6f 6e 20 74 68 65 his value on the
1830: 20 2e 4e 45 54 20 43 6f 6d 70 61 63 74 0d 0a 20 .NET Compact..
1840: 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 20 //
1850: 20 20 20 20 46 72 61 6d 65 77 6f 72 6b 20 28 72 Framework (r
1860: 75 6e 6e 69 6e 67 20 6f 6e 20 57 69 6e 64 6f 77 unning on Window
1870: 73 20 43 45 2c 20 65 74 63 29 2e 0d 0a 20 20 20 s CE, etc)...
1880: 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 //..
1890: 20 20 20 20 20 72 65 74 75 72 6e 20 53 74 72 69 return Stri
18a0: 6e 67 2e 45 6d 70 74 79 3b 0d 0a 23 65 6e 64 69 ng.Empty;..#endi
18b0: 66 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 f.. }....
18c0: 20 20 20 20 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////
18d0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18e0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
18f0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1900: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 0d 0a 20 /////////////..
1910: 20 20 20 20 20 2f 2f 2f 20 3c 73 75 6d 6d 61 72 /// <summar
1920: 79 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 47 69 y>.. /// Gi
1930: 76 65 6e 20 74 68 65 20 70 72 6f 63 65 73 73 6f ven the processo
1940: 72 20 61 72 63 68 69 74 65 63 74 75 72 65 2c 20 r architecture,
1950: 72 65 74 75 72 6e 73 20 74 68 65 20 6e 61 6d 65 returns the name
1960: 20 6f 66 20 74 68 65 20 70 6c 61 74 66 6f 72 6d of the platform
1970: 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f 73 ... /// </s
1980: 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f ummary>.. /
1990: 2f 2f 20 3c 70 61 72 61 6d 20 6e 61 6d 65 3d 22 // <param name="
19a0: 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 processorArchite
19b0: 63 74 75 72 65 22 3e 0d 0a 20 20 20 20 20 20 2f cture">.. /
19c0: 2f 2f 20 54 68 65 20 70 72 6f 63 65 73 73 6f 72 // The processor
19d0: 20 61 72 63 68 69 74 65 63 74 75 72 65 20 74 6f architecture to
19e0: 20 62 65 20 74 72 61 6e 73 6c 61 74 65 64 20 74 be translated t
19f0: 6f 20 61 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d o a platform nam
1a00: 65 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f e... /// </
1a10: 70 61 72 61 6d 3e 0d 0a 20 20 20 20 20 20 2f 2f param>.. //
1a20: 2f 20 3c 72 65 74 75 72 6e 73 3e 0d 0a 20 20 20 / <returns>..
1a30: 20 20 20 2f 2f 2f 20 54 68 65 20 70 6c 61 74 66 /// The platf
1a40: 6f 72 6d 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 orm name for the
1a50: 20 73 70 65 63 69 66 69 65 64 20 70 72 6f 63 65 specified proce
1a60: 73 73 6f 72 20 61 72 63 68 69 74 65 63 74 75 72 ssor architectur
1a70: 65 20 2d 4f 52 2d 20 6e 75 6c 6c 0d 0a 20 20 20 e -OR- null..
1a80: 20 20 20 2f 2f 2f 20 69 66 20 69 74 20 63 61 6e /// if it can
1a90: 6e 6f 74 20 62 65 20 64 65 74 65 72 6d 69 6e 65 not be determine
1aa0: 64 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 2f d... /// </
1ab0: 72 65 74 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 returns>..
1ac0: 70 72 69 76 61 74 65 20 73 74 61 74 69 63 20 73 private static s
1ad0: 74 72 69 6e 67 20 47 65 74 50 6c 61 74 66 6f 72 tring GetPlatfor
1ae0: 6d 4e 61 6d 65 28 0d 0a 20 20 20 20 20 20 20 20 mName(..
1af0: 20 20 73 74 72 69 6e 67 20 70 72 6f 63 65 73 73 string process
1b00: 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 0d 0a orArchitecture..
1b10: 20 20 20 20 20 20 20 20 20 20 29 0d 0a 20 20 20 )..
1b20: 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 {..
1b30: 69 66 20 28 53 74 72 69 6e 67 2e 49 73 4e 75 6c if (String.IsNul
1b40: 6c 4f 72 45 6d 70 74 79 28 70 72 6f 63 65 73 73 lOrEmpty(process
1b50: 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 29 29 orArchitecture))
1b60: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1b70: 72 65 74 75 72 6e 20 6e 75 6c 6c 3b 0d 0a 0d 0a return null;....
1b80: 20 20 20 20 20 20 20 20 20 20 69 66 20 28 70 72 if (pr
1b90: 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 ocessorArchitect
1ba0: 75 72 65 50 6c 61 74 66 6f 72 6d 73 20 3d 3d 20 urePlatforms ==
1bb0: 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 null)..
1bc0: 20 20 20 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c return null
1bd0: 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 ;.... s
1be0: 74 72 69 6e 67 20 70 6c 61 74 66 6f 72 6d 4e 61 tring platformNa
1bf0: 6d 65 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 me;....
1c00: 20 69 66 20 28 70 72 6f 63 65 73 73 6f 72 41 72 if (processorAr
1c10: 63 68 69 74 65 63 74 75 72 65 50 6c 61 74 66 6f chitecturePlatfo
1c20: 72 6d 73 2e 54 72 79 47 65 74 56 61 6c 75 65 28 rms.TryGetValue(
1c30: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c40: 20 20 20 20 70 72 6f 63 65 73 73 6f 72 41 72 63 processorArc
1c50: 68 69 74 65 63 74 75 72 65 2c 20 6f 75 74 20 70 hitecture, out p
1c60: 6c 61 74 66 6f 72 6d 4e 61 6d 65 29 29 0d 0a 20 latformName))..
1c70: 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 {..
1c80: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
1c90: 20 70 6c 61 74 66 6f 72 6d 4e 61 6d 65 3b 0d 0a platformName;..
1ca0: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
1cb0: 20 20 20 20 20 20 20 20 20 69 66 20 28 70 72 6f if (pro
1cc0: 63 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 cessorArchitectu
1cd0: 72 65 50 6c 61 74 66 6f 72 6d 73 2e 54 72 79 47 rePlatforms.TryG
1ce0: 65 74 56 61 6c 75 65 28 0d 0a 23 69 66 20 21 50 etValue(..#if !P
1cf0: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
1d00: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 20 20 RAMEWORK..
1d10: 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 proc
1d20: 65 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 essorArchitectur
1d30: 65 2e 54 6f 55 70 70 65 72 49 6e 76 61 72 69 61 e.ToUpperInvaria
1d40: 6e 74 28 29 2c 0d 0a 23 65 6c 73 65 0d 0a 20 20 nt(),..#else..
1d50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d60: 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 processorArchite
1d70: 63 74 75 72 65 2e 54 6f 55 70 70 65 72 28 29 2c cture.ToUpper(),
1d80: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 20 20 ..#endif..
1d90: 20 20 20 20 20 20 20 20 20 20 20 20 6f 75 74 20 out
1da0: 70 6c 61 74 66 6f 72 6d 4e 61 6d 65 29 29 0d 0a platformName))..
1db0: 20 20 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 {..
1dc0: 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
1dd0: 6e 20 70 6c 61 74 66 6f 72 6d 4e 61 6d 65 3b 0d n platformName;.
1de0: 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
1df0: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
1e00: 20 6e 75 6c 6c 3b 0d 0a 20 20 20 20 20 20 7d 0d null;.. }.
1e10: 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f ... ///////
1e20: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1e30: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1e40: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1e50: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
1e60: 2f 2f 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 73 //.. /// <s
1e70: 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 20 20 20 2f ummary>.. /
1e80: 2f 2f 20 41 74 74 65 6d 70 74 73 20 74 6f 20 6c // Attempts to l
1e90: 6f 61 64 20 74 68 65 20 6e 61 74 69 76 65 20 53 oad the native S
1ea0: 51 4c 69 74 65 20 6c 69 62 72 61 72 79 20 62 61 QLite library ba
1eb0: 73 65 64 20 6f 6e 20 74 68 65 20 73 70 65 63 69 sed on the speci
1ec0: 66 69 65 64 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 fied.. ///
1ed0: 64 69 72 65 63 74 6f 72 79 20 61 6e 64 20 70 72 directory and pr
1ee0: 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 63 ocessor architec
1ef0: 74 75 72 65 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f ture... ///
1f00: 20 3c 2f 73 75 6d 6d 61 72 79 3e 0d 0a 20 20 20 </summary>..
1f10: 20 20 20 2f 2f 2f 20 3c 70 61 72 61 6d 20 6e 61 /// <param na
1f20: 6d 65 3d 22 64 69 72 65 63 74 6f 72 79 22 3e 0d me="directory">.
1f30: 0a 20 20 20 20 20 20 2f 2f 2f 20 54 68 65 20 62 . /// The b
1f40: 61 73 65 20 64 69 72 65 63 74 6f 72 79 20 74 6f ase directory to
1f50: 20 75 73 65 2c 20 6e 75 6c 6c 20 66 6f 72 20 64 use, null for d
1f60: 65 66 61 75 6c 74 20 28 74 68 65 20 62 61 73 65 efault (the base
1f70: 20 64 69 72 65 63 74 6f 72 79 20 6f 66 0d 0a 20 directory of..
1f80: 20 20 20 20 20 2f 2f 2f 20 74 68 65 20 63 75 72 /// the cur
1f90: 72 65 6e 74 20 61 70 70 6c 69 63 61 74 69 6f 6e rent application
1fa0: 20 64 6f 6d 61 69 6e 29 2e 20 20 54 68 69 73 20 domain). This
1fb0: 64 69 72 65 63 74 6f 72 79 20 73 68 6f 75 6c 64 directory should
1fc0: 20 63 6f 6e 74 61 69 6e 20 74 68 65 0d 0a 20 20 contain the..
1fd0: 20 20 20 20 2f 2f 2f 20 70 72 6f 63 65 73 73 6f /// processo
1fe0: 72 20 61 72 63 68 69 74 65 63 74 75 72 65 20 73 r architecture s
1ff0: 70 65 63 69 66 69 63 20 73 75 62 2d 64 69 72 65 pecific sub-dire
2000: 63 74 6f 72 69 65 73 2e 0d 0a 20 20 20 20 20 20 ctories...
2010: 2f 2f 2f 20 3c 2f 70 61 72 61 6d 3e 0d 0a 20 20 /// </param>..
2020: 20 20 20 20 2f 2f 2f 20 3c 70 61 72 61 6d 20 6e /// <param n
2030: 61 6d 65 3d 22 70 72 6f 63 65 73 73 6f 72 41 72 ame="processorAr
2040: 63 68 69 74 65 63 74 75 72 65 22 3e 0d 0a 20 20 chitecture">..
2050: 20 20 20 20 2f 2f 2f 20 54 68 65 20 72 65 71 75 /// The requ
2060: 65 73 74 65 64 20 70 72 6f 63 65 73 73 6f 72 20 ested processor
2070: 61 72 63 68 69 74 65 63 74 75 72 65 2c 20 6e 75 architecture, nu
2080: 6c 6c 20 66 6f 72 20 64 65 66 61 75 6c 74 20 28 ll for default (
2090: 74 68 65 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 70 the.. /// p
20a0: 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 65 rocessor archite
20b0: 63 74 75 72 65 20 6f 66 20 74 68 65 20 63 75 72 cture of the cur
20c0: 72 65 6e 74 20 70 72 6f 63 65 73 73 29 2e 20 20 rent process).
20d0: 54 68 69 73 20 63 61 6c 6c 65 72 20 73 68 6f 75 This caller shou
20e0: 6c 64 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 61 6c ld.. /// al
20f0: 6d 6f 73 74 20 61 6c 77 61 79 73 20 73 70 65 63 most always spec
2100: 69 66 79 20 6e 75 6c 6c 20 66 6f 72 20 74 68 69 ify null for thi
2110: 73 20 70 61 72 61 6d 65 74 65 72 2e 0d 0a 20 20 s parameter...
2120: 20 20 20 20 2f 2f 2f 20 3c 2f 70 61 72 61 6d 3e /// </param>
2130: 0d 0a 20 20 20 20 20 20 2f 2f 2f 20 3c 72 65 74 .. /// <ret
2140: 75 72 6e 73 3e 0d 0a 20 20 20 20 20 20 2f 2f 2f urns>.. ///
2150: 20 54 68 65 20 6e 61 74 69 76 65 20 6d 6f 64 75 The native modu
2160: 6c 65 20 68 61 6e 64 6c 65 20 61 73 20 72 65 74 le handle as ret
2170: 75 72 6e 65 64 20 62 79 20 4c 6f 61 64 4c 69 62 urned by LoadLib
2180: 72 61 72 79 20 2d 4f 52 2d 20 49 6e 74 50 74 72 rary -OR- IntPtr
2190: 2e 5a 65 72 6f 0d 0a 20 20 20 20 20 20 2f 2f 2f .Zero.. ///
21a0: 20 69 66 20 74 68 65 20 6c 6f 61 64 69 6e 67 20 if the loading
21b0: 66 61 69 6c 73 20 66 6f 72 20 61 6e 79 20 72 65 fails for any re
21c0: 61 73 6f 6e 2e 0d 0a 20 20 20 20 20 20 2f 2f 2f ason... ///
21d0: 20 3c 2f 72 65 74 75 72 6e 73 3e 0d 0a 20 20 20 </returns>..
21e0: 20 20 20 70 72 69 76 61 74 65 20 73 74 61 74 69 private stati
21f0: 63 20 49 6e 74 50 74 72 20 50 72 65 4c 6f 61 64 c IntPtr PreLoad
2200: 53 51 4c 69 74 65 44 6c 6c 28 0d 0a 20 20 20 20 SQLiteDll(..
2210: 20 20 20 20 20 20 73 74 72 69 6e 67 20 64 69 72 string dir
2220: 65 63 74 6f 72 79 2c 0d 0a 20 20 20 20 20 20 20 ectory,..
2230: 20 20 20 73 74 72 69 6e 67 20 70 72 6f 63 65 73 string proces
2240: 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 0d sorArchitecture.
2250: 0a 20 20 20 20 20 20 20 20 20 20 29 0d 0a 20 20 . )..
2260: 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 {..
2270: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 2f //.. /
2280: 2f 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 73 / NOTE: If the s
2290: 70 65 63 69 66 69 65 64 20 62 61 73 65 20 64 69 pecified base di
22a0: 72 65 63 74 6f 72 79 20 69 73 20 6e 75 6c 6c 2c rectory is null,
22b0: 20 75 73 65 20 74 68 65 20 64 65 66 61 75 6c 74 use the default
22c0: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d ... //.
22d0: 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 28 64 . if (d
22e0: 69 72 65 63 74 6f 72 79 20 3d 3d 20 6e 75 6c 6c irectory == null
22f0: 29 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 )..
2300: 20 64 69 72 65 63 74 6f 72 79 20 3d 20 47 65 74 directory = Get
2310: 42 61 73 65 44 69 72 65 63 74 6f 72 79 28 29 3b BaseDirectory();
2320: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f .... //
2330: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e .. // N
2340: 4f 54 45 3a 20 49 66 20 77 65 20 66 61 69 6c 65 OTE: If we faile
2350: 64 20 74 6f 20 71 75 65 72 79 20 74 68 65 20 62 d to query the b
2360: 61 73 65 20 64 69 72 65 63 74 6f 72 79 2c 20 73 ase directory, s
2370: 74 6f 70 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 top now...
2380: 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 //..
2390: 20 20 69 66 20 28 64 69 72 65 63 74 6f 72 79 20 if (directory
23a0: 3d 3d 20 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 == null)..
23b0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 49 return I
23c0: 6e 74 50 74 72 2e 5a 65 72 6f 3b 0d 0a 0d 0a 20 ntPtr.Zero;....
23d0: 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 //..
23e0: 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 // NOTE:
23f0: 49 66 20 74 68 65 20 6e 61 74 69 76 65 20 53 51 If the native SQ
2400: 4c 69 74 65 20 6c 69 62 72 61 72 79 20 65 78 69 Lite library exi
2410: 73 74 73 20 69 6e 20 74 68 65 20 62 61 73 65 20 sts in the base
2420: 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 directory..
2430: 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 69 74 // it
2440: 73 65 6c 66 2c 20 73 74 6f 70 20 6e 6f 77 2e 0d self, stop now..
2450: 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 . //..
2460: 20 20 20 20 20 20 20 20 20 73 74 72 69 6e 67 20 string
2470: 66 69 6c 65 4e 61 6d 65 20 3d 20 50 61 74 68 2e fileName = Path.
2480: 43 6f 6d 62 69 6e 65 28 64 69 72 65 63 74 6f 72 Combine(director
2490: 79 2c 20 53 51 4c 49 54 45 5f 44 4c 4c 29 3b 0d y, SQLITE_DLL);.
24a0: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
24b0: 28 46 69 6c 65 2e 45 78 69 73 74 73 28 66 69 6c (File.Exists(fil
24c0: 65 4e 61 6d 65 29 29 0d 0a 20 20 20 20 20 20 20 eName))..
24d0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 49 6e return In
24e0: 74 50 74 72 2e 5a 65 72 6f 3b 0d 0a 0d 0a 20 20 tPtr.Zero;....
24f0: 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 //..
2500: 20 20 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 49 // NOTE: I
2510: 66 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 f the specified
2520: 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 74 processor archit
2530: 65 63 74 75 72 65 20 69 73 20 6e 75 6c 6c 2c 20 ecture is null,
2540: 75 73 65 20 74 68 65 0d 0a 20 20 20 20 20 20 20 use the..
2550: 20 20 20 2f 2f 20 20 20 20 20 20 20 64 65 66 61 // defa
2560: 75 6c 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ult...
2570: 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 //.. if
2580: 20 28 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 (processorArchi
2590: 74 65 63 74 75 72 65 20 3d 3d 20 6e 75 6c 6c 29 tecture == null)
25a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
25b0: 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 processorArchite
25c0: 63 74 75 72 65 20 3d 20 47 65 74 50 72 6f 63 65 cture = GetProce
25d0: 73 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 ssorArchitecture
25e0: 28 29 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ();....
25f0: 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 2f //.. /
2600: 2f 20 4e 4f 54 45 3a 20 49 66 20 77 65 20 66 61 / NOTE: If we fa
2610: 69 6c 65 64 20 74 6f 20 71 75 65 72 79 20 74 68 iled to query th
2620: 65 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 e processor arch
2630: 69 74 65 63 74 75 72 65 2c 20 73 74 6f 70 20 6e itecture, stop n
2640: 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 2f ow... /
2650: 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 /.. if
2660: 28 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 (processorArchit
2670: 65 63 74 75 72 65 20 3d 3d 20 6e 75 6c 6c 29 0d ecture == null).
2680: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 . r
2690: 65 74 75 72 6e 20 49 6e 74 50 74 72 2e 5a 65 72 eturn IntPtr.Zer
26a0: 6f 3b 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 o;....
26b0: 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f //.. //
26c0: 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 NOTE: Build the
26d0: 20 66 75 6c 6c 20 70 61 74 68 20 61 6e 64 20 66 full path and f
26e0: 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 ile name for the
26f0: 20 6e 61 74 69 76 65 20 53 51 4c 69 74 65 0d 0a native SQLite..
2700: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
2710: 20 20 20 6c 69 62 72 61 72 79 20 75 73 69 6e 67 library using
2720: 20 74 68 65 20 70 72 6f 63 65 73 73 6f 72 20 61 the processor a
2730: 72 63 68 69 74 65 63 74 75 72 65 20 6e 61 6d 65 rchitecture name
2740: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d ... //.
2750: 0a 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 4e . fileN
2760: 61 6d 65 20 3d 20 50 61 74 68 2e 43 6f 6d 62 69 ame = Path.Combi
2770: 6e 65 28 50 61 74 68 2e 43 6f 6d 62 69 6e 65 28 ne(Path.Combine(
2780: 64 69 72 65 63 74 6f 72 79 2c 0d 0a 20 20 20 20 directory,..
2790: 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 73 proces
27a0: 73 6f 72 41 72 63 68 69 74 65 63 74 75 72 65 29 sorArchitecture)
27b0: 2c 20 53 51 4c 49 54 45 5f 44 4c 4c 29 3b 0d 0a , SQLITE_DLL);..
27c0: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a .. //..
27d0: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 // NOT
27e0: 45 3a 20 49 66 20 74 68 65 20 66 69 6c 65 20 6e E: If the file n
27f0: 61 6d 65 20 62 61 73 65 64 20 6f 6e 20 74 68 65 ame based on the
2800: 20 70 72 6f 63 65 73 73 6f 72 20 61 72 63 68 69 processor archi
2810: 74 65 63 74 75 72 65 20 6e 61 6d 65 0d 0a 20 20 tecture name..
2820: 20 20 20 20 20 20 20 20 2f 2f 20 69 73 20 6e 6f // is no
2830: 74 20 66 6f 75 6e 64 2c 20 74 72 79 20 75 73 69 t found, try usi
2840: 6e 67 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 ng the associate
2850: 64 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d 65 2e d platform name.
2860: 0d 0a 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a .. //..
2870: 20 20 20 20 20 20 20 20 20 20 69 66 20 28 21 46 if (!F
2880: 69 6c 65 2e 45 78 69 73 74 73 28 66 69 6c 65 4e ile.Exists(fileN
2890: 61 6d 65 29 29 0d 0a 20 20 20 20 20 20 20 20 20 ame))..
28a0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
28b0: 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 20 //..
28c0: 20 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 41 74 74 // NOTE: Att
28d0: 65 6d 70 74 20 74 6f 20 74 72 61 6e 73 6c 61 74 empt to translat
28e0: 65 20 74 68 65 20 70 72 6f 63 65 73 73 6f 72 20 e the processor
28f0: 61 72 63 68 69 74 65 63 74 75 72 65 20 74 6f 20 architecture to
2900: 61 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 a..
2910: 20 2f 2f 20 20 20 20 20 20 20 70 6c 61 74 66 6f // platfo
2920: 72 6d 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 20 rm name...
2930: 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 //..
2940: 20 20 20 20 20 20 20 20 20 20 73 74 72 69 6e 67 string
2950: 20 70 6c 61 74 66 6f 72 6d 4e 61 6d 65 20 3d 20 platformName =
2960: 47 65 74 50 6c 61 74 66 6f 72 6d 4e 61 6d 65 28 GetPlatformName(
2970: 70 72 6f 63 65 73 73 6f 72 41 72 63 68 69 74 65 processorArchite
2980: 63 74 75 72 65 29 3b 0d 0a 0d 0a 20 20 20 20 20 cture);....
2990: 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 //..
29a0: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f // NO
29b0: 54 45 3a 20 49 66 20 77 65 20 66 61 69 6c 65 64 TE: If we failed
29c0: 20 74 6f 20 74 72 61 6e 73 6c 61 74 65 20 74 68 to translate th
29d0: 65 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d 65 2c e platform name,
29e0: 20 73 74 6f 70 20 6e 6f 77 2e 0d 0a 20 20 20 20 stop now...
29f0: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
2a00: 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 if (
2a10: 70 6c 61 74 66 6f 72 6d 4e 61 6d 65 20 3d 3d 20 platformName ==
2a20: 6e 75 6c 6c 29 0d 0a 20 20 20 20 20 20 20 20 20 null)..
2a30: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
2a40: 49 6e 74 50 74 72 2e 5a 65 72 6f 3b 0d 0a 0d 0a IntPtr.Zero;....
2a50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
2a60: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2a70: 2f 2f 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 // NOTE: Build t
2a80: 68 65 20 66 75 6c 6c 20 70 61 74 68 20 61 6e 64 he full path and
2a90: 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 74 file name for t
2aa0: 68 65 20 6e 61 74 69 76 65 20 53 51 4c 69 74 65 he native SQLite
2ab0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2ac0: 2f 2f 20 20 20 20 20 20 20 6c 69 62 72 61 72 79 // library
2ad0: 20 75 73 69 6e 67 20 74 68 65 20 70 6c 61 74 66 using the platf
2ae0: 6f 72 6d 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 orm name...
2af0: 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 //..
2b00: 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 4e fileN
2b10: 61 6d 65 20 3d 20 50 61 74 68 2e 43 6f 6d 62 69 ame = Path.Combi
2b20: 6e 65 28 50 61 74 68 2e 43 6f 6d 62 69 6e 65 28 ne(Path.Combine(
2b30: 64 69 72 65 63 74 6f 72 79 2c 20 70 6c 61 74 66 directory, platf
2b40: 6f 72 6d 4e 61 6d 65 29 2c 0d 0a 20 20 20 20 20 ormName),..
2b50: 20 20 20 20 20 20 20 20 20 20 20 20 20 53 51 4c SQL
2b60: 49 54 45 5f 44 4c 4c 29 3b 0d 0a 0d 0a 20 20 20 ITE_DLL);....
2b70: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 //..
2b80: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 //
2b90: 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 66 69 6c NOTE: If the fil
2ba0: 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 e does not exist
2bb0: 2c 20 73 6b 69 70 20 74 72 79 69 6e 67 20 74 6f , skip trying to
2bc0: 20 6c 6f 61 64 20 69 74 2e 0d 0a 20 20 20 20 20 load it...
2bd0: 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 //..
2be0: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 21 if (!
2bf0: 46 69 6c 65 2e 45 78 69 73 74 73 28 66 69 6c 65 File.Exists(file
2c00: 4e 61 6d 65 29 29 0d 0a 20 20 20 20 20 20 20 20 Name))..
2c10: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
2c20: 20 49 6e 74 50 74 72 2e 5a 65 72 6f 3b 0d 0a 20 IntPtr.Zero;..
2c30: 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
2c40: 20 20 20 20 20 20 20 20 74 72 79 0d 0a 20 20 20 try..
2c50: 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 {..
2c60: 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 //..
2c70: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e 4f 54 // NOT
2c80: 45 3a 20 53 68 6f 77 20 65 78 61 63 74 6c 79 20 E: Show exactly
2c90: 77 68 65 72 65 20 77 65 20 61 72 65 20 74 72 79 where we are try
2ca0: 69 6e 67 20 74 6f 20 6c 6f 61 64 20 74 68 65 20 ing to load the
2cb0: 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 20 20 20 native..
2cc0: 20 20 20 20 20 20 2f 2f 20 20 20 20 20 20 20 53 // S
2cd0: 51 4c 69 74 65 20 6c 69 62 72 61 72 79 20 66 72 QLite library fr
2ce0: 6f 6d 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 om...
2cf0: 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 20 20 //..
2d00: 20 20 20 20 20 54 72 61 63 65 2e 57 72 69 74 65 Trace.Write
2d10: 4c 69 6e 65 28 53 74 72 69 6e 67 2e 46 6f 72 6d Line(String.Form
2d20: 61 74 28 0d 0a 20 20 20 20 20 20 20 20 20 20 20 at(..
2d30: 20 20 20 20 20 20 20 22 54 72 79 69 6e 67 20 74 "Trying t
2d40: 6f 20 6c 6f 61 64 20 6e 61 74 69 76 65 20 53 51 o load native SQ
2d50: 4c 69 74 65 20 6c 69 62 72 61 72 79 20 5c 22 7b Lite library \"{
2d60: 30 7d 5c 22 2e 2e 2e 22 2c 0d 0a 20 20 20 20 20 0}\"...",..
2d70: 20 20 20 20 20 20 20 20 20 20 20 20 20 66 69 6c fil
2d80: 65 4e 61 6d 65 29 29 3b 0d 0a 0d 0a 20 20 20 20 eName));....
2d90: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
2da0: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 4e // N
2db0: 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 OTE: Attempt to
2dc0: 6c 6f 61 64 20 74 68 65 20 6e 61 74 69 76 65 20 load the native
2dd0: 6c 69 62 72 61 72 79 2e 20 20 54 68 69 73 20 77 library. This w
2de0: 69 6c 6c 20 65 69 74 68 65 72 0d 0a 20 20 20 20 ill either..
2df0: 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 20 //
2e00: 20 20 20 72 65 74 75 72 6e 20 61 20 76 61 6c 69 return a vali
2e10: 64 20 6e 61 74 69 76 65 20 6d 6f 64 75 6c 65 20 d native module
2e20: 68 61 6e 64 6c 65 2c 20 72 65 74 75 72 6e 20 49 handle, return I
2e30: 6e 74 50 74 72 2e 5a 65 72 6f 2c 0d 0a 20 20 20 ntPtr.Zero,..
2e40: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 //
2e50: 20 20 20 20 6f 72 20 74 68 72 6f 77 20 61 6e 20 or throw an
2e60: 65 78 63 65 70 74 69 6f 6e 2e 0d 0a 20 20 20 20 exception...
2e70: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
2e80: 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 retu
2e90: 72 6e 20 4c 6f 61 64 4c 69 62 72 61 72 79 28 66 rn LoadLibrary(f
2ea0: 69 6c 65 4e 61 6d 65 29 3b 0d 0a 20 20 20 20 20 ileName);..
2eb0: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
2ec0: 20 20 63 61 74 63 68 20 28 45 78 63 65 70 74 69 catch (Excepti
2ed0: 6f 6e 20 65 29 0d 0a 20 20 20 20 20 20 20 20 20 on e)..
2ee0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2ef0: 20 20 74 72 79 0d 0a 20 20 20 20 20 20 20 20 20 try..
2f00: 20 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 {..
2f10: 20 20 20 20 20 20 20 20 20 20 2f 2f 0d 0a 20 20 //..
2f20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2f30: 2f 2f 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c 20 // NOTE: First,
2f40: 67 72 61 62 20 74 68 65 20 6c 61 73 74 20 57 69 grab the last Wi
2f50: 6e 33 32 20 65 72 72 6f 72 20 6e 75 6d 62 65 72 n32 error number
2f60: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
2f70: 20 20 20 20 20 2f 2f 0d 0a 20 20 20 20 20 20 20 //..
2f80: 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 20 6c int l
2f90: 61 73 74 45 72 72 6f 72 20 3d 20 4d 61 72 73 68 astError = Marsh
2fa0: 61 6c 2e 47 65 74 4c 61 73 74 57 69 6e 33 32 45 al.GetLastWin32E
2fb0: 72 72 6f 72 28 29 3b 0d 0a 0d 0a 20 20 20 20 20 rror();....
2fc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f 0d //.
2fd0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2fe0: 20 20 20 2f 2f 20 4e 4f 54 45 3a 20 53 68 6f 77 // NOTE: Show
2ff0: 20 77 68 65 72 65 20 77 65 20 66 61 69 6c 65 64 where we failed
3000: 20 74 6f 20 6c 6f 61 64 20 74 68 65 20 6e 61 74 to load the nat
3010: 69 76 65 20 53 51 4c 69 74 65 0d 0a 20 20 20 20 ive SQLite..
3020: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
3030: 20 20 20 20 20 20 20 6c 69 62 72 61 72 79 20 66 library f
3040: 72 6f 6d 20 61 6c 6f 6e 67 20 77 69 74 68 20 74 rom along with t
3050: 68 65 20 57 69 6e 33 32 20 65 72 72 6f 72 20 63 he Win32 error c
3060: 6f 64 65 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 ode and..
3070: 20 20 20 20 20 20 20 20 20 20 20 2f 2f 20 20 20 //
3080: 20 20 20 20 65 78 63 65 70 74 69 6f 6e 20 69 6e exception in
3090: 66 6f 72 6d 61 74 69 6f 6e 2e 0d 0a 20 20 20 20 formation...
30a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2f //
30b0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
30c0: 20 20 20 20 54 72 61 63 65 2e 57 72 69 74 65 4c Trace.WriteL
30d0: 69 6e 65 28 53 74 72 69 6e 67 2e 46 6f 72 6d 61 ine(String.Forma
30e0: 74 28 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 t(..
30f0: 20 20 20 20 20 20 20 20 20 20 22 46 61 69 6c 65 "Faile
3100: 64 20 74 6f 20 6c 6f 61 64 20 6e 61 74 69 76 65 d to load native
3110: 20 53 51 4c 69 74 65 20 6c 69 62 72 61 72 79 20 SQLite library
3120: 5c 22 7b 30 7d 5c 22 20 22 20 2b 0d 0a 20 20 20 \"{0}\" " +..
3130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
3140: 20 20 20 22 28 67 65 74 4c 61 73 74 45 72 72 6f "(getLastErro
3150: 72 20 3d 20 7b 31 7d 29 3a 20 7b 32 7d 22 2c 0d r = {1}): {2}",.
3160: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
3170: 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 2c fileName,
3180: 20 6c 61 73 74 45 72 72 6f 72 2c 20 65 29 29 3b lastError, e));
3190: 20 2f 2a 20 74 68 72 6f 77 20 2a 2f 0d 0a 20 20 /* throw */..
31a0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
31b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 74 cat
31c0: 63 68 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ch..
31d0: 20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 {..
31e0: 20 20 20 20 20 20 20 2f 2f 20 64 6f 20 6e 6f 74 // do not
31f0: 68 69 6e 67 2e 0d 0a 20 20 20 20 20 20 20 20 20 hing...
3200: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
3210: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
3220: 20 72 65 74 75 72 6e 20 49 6e 74 50 74 72 2e 5a return IntPtr.Z
3230: 65 72 6f 3b 0d 0a 20 20 20 20 20 20 7d 0d 0a 23 ero;.. }..#
3240: 65 6e 64 69 66 0d 0a 23 65 6e 64 69 66 0d 0a 20 endif..#endif..
3250: 20 20 20 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d #endregion.
3260: 0a 0d 0a 20 20 20 20 20 20 2f 2f 2f 2f 2f 2f 2f ... ///////
3270: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3280: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
3290: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
32a0: 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f ////////////////
32b0: 2f 2f 0d 0a 0d 0a 23 69 66 20 21 53 51 4c 49 54 //....#if !SQLIT
32c0: 45 5f 53 54 41 4e 44 41 52 44 0d 0a 0d 0a 23 69 E_STANDARD....#i
32d0: 66 20 21 55 53 45 5f 49 4e 54 45 52 4f 50 5f 44 f !USE_INTEROP_D
32e0: 4c 4c 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 LL....#if !PLATF
32f0: 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
3300: 57 4f 52 4b 0d 0a 20 20 20 20 70 72 69 76 61 74 WORK.. privat
3310: 65 20 63 6f 6e 73 74 20 73 74 72 69 6e 67 20 53 e const string S
3320: 51 4c 49 54 45 5f 44 4c 4c 20 3d 20 22 53 79 73 QLITE_DLL = "Sys
3330: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
3340: 64 6c 6c 22 3b 0d 0a 23 65 6c 73 65 0d 0a 20 20 dll";..#else..
3350: 20 20 69 6e 74 65 72 6e 61 6c 20 63 6f 6e 73 74 internal const
3360: 20 73 74 72 69 6e 67 20 53 51 4c 49 54 45 5f 44 string SQLITE_D
3370: 4c 4c 20 3d 20 22 53 51 4c 69 74 65 2e 49 6e 74 LL = "SQLite.Int
3380: 65 72 6f 70 2e 30 38 30 2e 64 6c 6c 22 3b 0d 0a erop.080.dll";..
3390: 23 65 6e 64 69 66 20 2f 2f 20 50 4c 41 54 46 4f #endif // PLATFO
33a0: 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
33b0: 4f 52 4b 0d 0a 0d 0a 23 65 6c 73 65 0d 0a 20 20 ORK....#else..
33c0: 20 20 70 72 69 76 61 74 65 20 63 6f 6e 73 74 20 private const
33d0: 73 74 72 69 6e 67 20 53 51 4c 49 54 45 5f 44 4c string SQLITE_DL
33e0: 4c 20 3d 20 22 53 51 4c 69 74 65 2e 49 6e 74 65 L = "SQLite.Inte
33f0: 72 6f 70 2e 64 6c 6c 22 3b 0d 0a 23 65 6e 64 69 rop.dll";..#endi
3400: 66 20 2f 2f 20 55 53 45 5f 49 4e 54 45 52 4f 50 f // USE_INTEROP
3410: 5f 44 4c 4c 0d 0a 0d 0a 23 65 6c 73 65 0d 0a 20 _DLL....#else..
3420: 20 20 20 70 72 69 76 61 74 65 20 63 6f 6e 73 74 private const
3430: 20 73 74 72 69 6e 67 20 53 51 4c 49 54 45 5f 44 string SQLITE_D
3440: 4c 4c 20 3d 20 22 73 71 6c 69 74 65 33 22 3b 0d LL = "sqlite3";.
3450: 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 20 20 20 2f .#endif.... /
3460: 2f 20 54 68 69 73 20 73 65 63 74 69 6f 6e 20 75 / This section u
3470: 73 65 73 20 69 6e 74 65 72 6f 70 20 63 61 6c 6c ses interop call
3480: 73 20 74 68 61 74 20 61 6c 73 6f 20 66 65 74 63 s that also fetc
3490: 68 20 74 65 78 74 20 6c 65 6e 67 74 68 20 74 6f h text length to
34a0: 20 6f 70 74 69 6d 69 7a 65 20 63 6f 6e 76 65 72 optimize conver
34b0: 73 69 6f 6e 2e 20 20 0d 0a 20 20 20 20 2f 2f 20 sion. .. //
34c0: 57 68 65 6e 20 75 73 69 6e 67 20 74 68 65 20 73 When using the s
34d0: 74 61 6e 64 61 72 64 20 64 6c 6c 2c 20 77 65 20 tandard dll, we
34e0: 63 61 6e 20 72 65 70 6c 61 63 65 20 74 68 65 73 can replace thes
34f0: 65 20 63 61 6c 6c 73 20 77 69 74 68 20 6e 6f 72 e calls with nor
3500: 6d 61 6c 20 73 71 6c 69 74 65 20 63 61 6c 6c 73 mal sqlite calls
3510: 20 61 6e 64 20 0d 0a 20 20 20 20 2f 2f 20 64 6f and .. // do
3520: 20 75 6e 6f 70 74 69 6d 69 7a 65 64 20 63 6f 6e unoptimized con
3530: 76 65 72 73 69 6f 6e 73 20 69 6e 73 74 65 61 64 versions instead
3540: 20 61 66 74 65 72 77 61 72 64 73 0d 0a 20 20 20 afterwards..
3550: 20 23 72 65 67 69 6f 6e 20 69 6e 74 65 72 6f 70 #region interop
3560: 20 61 64 64 65 64 20 74 65 78 74 6c 65 6e 67 74 added textlengt
3570: 68 20 63 61 6c 6c 73 0d 0a 0d 0a 23 69 66 20 21 h calls....#if !
3580: 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 0d SQLITE_STANDARD.
3590: 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 ... [DllImpor
35a0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
35b0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
35c0: 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 tic extern IntPt
35d0: 72 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 70 r sqlite3_bind_p
35e0: 61 72 61 6d 65 74 65 72 5f 6e 61 6d 65 5f 69 6e arameter_name_in
35f0: 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d terop(IntPtr stm
3600: 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 6f 75 t, int index, ou
3610: 74 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 t int len);....
3620: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
3630: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
3640: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
3650: 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 extern IntPtr sq
3660: 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 64 61 74 lite3_column_dat
3670: 61 62 61 73 65 5f 6e 61 6d 65 5f 69 6e 74 65 72 abase_name_inter
3680: 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 op(IntPtr stmt,
3690: 69 6e 74 20 69 6e 64 65 78 2c 20 6f 75 74 20 69 int index, out i
36a0: 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 nt len);....
36b0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
36c0: 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 E_DLL)].. int
36d0: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
36e0: 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 ern IntPtr sqlit
36f0: 65 33 5f 63 6f 6c 75 6d 6e 5f 64 61 74 61 62 61 e3_column_databa
3700: 73 65 5f 6e 61 6d 65 31 36 5f 69 6e 74 65 72 6f se_name16_intero
3710: 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 p(IntPtr stmt, i
3720: 6e 74 20 69 6e 64 65 78 2c 20 6f 75 74 20 69 6e nt index, out in
3730: 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b t len);.... [
3740: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
3750: 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 _DLL)].. inte
3760: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
3770: 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 rn IntPtr sqlite
3780: 33 5f 63 6f 6c 75 6d 6e 5f 64 65 63 6c 74 79 70 3_column_decltyp
3790: 65 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 e_interop(IntPtr
37a0: 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 stmt, int index
37b0: 2c 20 6f 75 74 20 69 6e 74 20 6c 65 6e 29 3b 0d , out int len);.
37c0: 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 ... [DllImpor
37d0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
37e0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
37f0: 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 tic extern IntPt
3800: 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e r sqlite3_column
3810: 5f 64 65 63 6c 74 79 70 65 31 36 5f 69 6e 74 65 _decltype16_inte
3820: 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c rop(IntPtr stmt,
3830: 20 69 6e 74 20 69 6e 64 65 78 2c 20 6f 75 74 20 int index, out
3840: 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 int len);....
3850: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
3860: 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e TE_DLL)].. in
3870: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
3880: 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 tern IntPtr sqli
3890: 74 65 33 5f 63 6f 6c 75 6d 6e 5f 6e 61 6d 65 5f te3_column_name_
38a0: 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 interop(IntPtr s
38b0: 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 tmt, int index,
38c0: 6f 75 74 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d out int len);...
38d0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
38e0: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
38f0: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
3900: 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 c extern IntPtr
3910: 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 6e sqlite3_column_n
3920: 61 6d 65 31 36 5f 69 6e 74 65 72 6f 70 28 49 6e ame16_interop(In
3930: 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 tPtr stmt, int i
3940: 6e 64 65 78 2c 20 6f 75 74 20 69 6e 74 20 6c 65 ndex, out int le
3950: 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 n);.... [DllI
3960: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
3970: 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c )].. internal
3980: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 static extern I
3990: 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f ntPtr sqlite3_co
39a0: 6c 75 6d 6e 5f 6f 72 69 67 69 6e 5f 6e 61 6d 65 lumn_origin_name
39b0: 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 _interop(IntPtr
39c0: 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c stmt, int index,
39d0: 20 6f 75 74 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a out int len);..
39e0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
39f0: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 (SQLITE_DLL)]..
3a00: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
3a10: 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 ic extern IntPtr
3a20: 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f sqlite3_column_
3a30: 6f 72 69 67 69 6e 5f 6e 61 6d 65 31 36 5f 69 6e origin_name16_in
3a40: 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d terop(IntPtr stm
3a50: 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 6f 75 t, int index, ou
3a60: 74 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 t int len);....
3a70: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
3a80: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
3a90: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
3aa0: 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 extern IntPtr sq
3ab0: 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 74 61 62 lite3_column_tab
3ac0: 6c 65 5f 6e 61 6d 65 5f 69 6e 74 65 72 6f 70 28 le_name_interop(
3ad0: 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 IntPtr stmt, int
3ae0: 20 69 6e 64 65 78 2c 20 6f 75 74 20 69 6e 74 20 index, out int
3af0: 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c len);.... [Dl
3b00: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
3b10: 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e LL)].. intern
3b20: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
3b30: 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f IntPtr sqlite3_
3b40: 63 6f 6c 75 6d 6e 5f 74 61 62 6c 65 5f 6e 61 6d column_table_nam
3b50: 65 31 36 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 e16_interop(IntP
3b60: 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 tr stmt, int ind
3b70: 65 78 2c 20 6f 75 74 20 69 6e 74 20 6c 65 6e 29 ex, out int len)
3b80: 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ;.... [DllImp
3b90: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
3ba0: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
3bb0: 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
3bc0: 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 Ptr sqlite3_colu
3bd0: 6d 6e 5f 74 65 78 74 5f 69 6e 74 65 72 6f 70 28 mn_text_interop(
3be0: 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 IntPtr stmt, int
3bf0: 20 69 6e 64 65 78 2c 20 6f 75 74 20 69 6e 74 20 index, out int
3c00: 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c len);.... [Dl
3c10: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
3c20: 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e LL)].. intern
3c30: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
3c40: 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f IntPtr sqlite3_
3c50: 63 6f 6c 75 6d 6e 5f 74 65 78 74 31 36 5f 69 6e column_text16_in
3c60: 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d terop(IntPtr stm
3c70: 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 6f 75 t, int index, ou
3c80: 74 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 t int len);....
3c90: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
3ca0: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
3cb0: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
3cc0: 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 extern IntPtr sq
3cd0: 6c 69 74 65 33 5f 65 72 72 6d 73 67 5f 69 6e 74 lite3_errmsg_int
3ce0: 65 72 6f 70 28 49 6e 74 50 74 72 20 64 62 2c 20 erop(IntPtr db,
3cf0: 6f 75 74 20 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d out int len);...
3d00: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
3d10: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
3d20: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
3d30: 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c c extern int sql
3d40: 69 74 65 33 5f 70 72 65 70 61 72 65 5f 69 6e 74 ite3_prepare_int
3d50: 65 72 6f 70 28 49 6e 74 50 74 72 20 64 62 2c 20 erop(IntPtr db,
3d60: 49 6e 74 50 74 72 20 70 53 71 6c 2c 20 69 6e 74 IntPtr pSql, int
3d70: 20 6e 42 79 74 65 73 2c 20 6f 75 74 20 49 6e 74 nBytes, out Int
3d80: 50 74 72 20 73 74 6d 74 2c 20 6f 75 74 20 49 6e Ptr stmt, out In
3d90: 74 50 74 72 20 70 74 72 52 65 6d 61 69 6e 2c 20 tPtr ptrRemain,
3da0: 6f 75 74 20 69 6e 74 20 6e 52 65 6d 61 69 6e 29 out int nRemain)
3db0: 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ;.... [DllImp
3dc0: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
3dd0: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
3de0: 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 tatic extern int
3df0: 20 73 71 6c 69 74 65 33 5f 74 61 62 6c 65 5f 63 sqlite3_table_c
3e00: 6f 6c 75 6d 6e 5f 6d 65 74 61 64 61 74 61 5f 69 olumn_metadata_i
3e10: 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 64 62 nterop(IntPtr db
3e20: 2c 20 62 79 74 65 5b 5d 20 64 62 4e 61 6d 65 2c , byte[] dbName,
3e30: 20 62 79 74 65 5b 5d 20 74 62 6c 4e 61 6d 65 2c byte[] tblName,
3e40: 20 62 79 74 65 5b 5d 20 63 6f 6c 4e 61 6d 65 2c byte[] colName,
3e50: 20 6f 75 74 20 49 6e 74 50 74 72 20 70 74 72 44 out IntPtr ptrD
3e60: 61 74 61 54 79 70 65 2c 20 6f 75 74 20 49 6e 74 ataType, out Int
3e70: 50 74 72 20 70 74 72 43 6f 6c 6c 53 65 71 2c 20 Ptr ptrCollSeq,
3e80: 6f 75 74 20 69 6e 74 20 6e 6f 74 4e 75 6c 6c 2c out int notNull,
3e90: 20 6f 75 74 20 69 6e 74 20 70 72 69 6d 61 72 79 out int primary
3ea0: 4b 65 79 2c 20 6f 75 74 20 69 6e 74 20 61 75 74 Key, out int aut
3eb0: 6f 49 6e 63 2c 20 6f 75 74 20 69 6e 74 20 64 74 oInc, out int dt
3ec0: 4c 65 6e 2c 20 6f 75 74 20 69 6e 74 20 63 73 4c Len, out int csL
3ed0: 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c en);.... [Dll
3ee0: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
3ef0: 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 L)].. interna
3f00: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
3f10: 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 76 IntPtr sqlite3_v
3f20: 61 6c 75 65 5f 74 65 78 74 5f 69 6e 74 65 72 6f alue_text_intero
3f30: 70 28 49 6e 74 50 74 72 20 70 2c 20 6f 75 74 20 p(IntPtr p, out
3f40: 69 6e 74 20 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 int len);....
3f50: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
3f60: 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e TE_DLL)].. in
3f70: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
3f80: 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 tern IntPtr sqli
3f90: 74 65 33 5f 76 61 6c 75 65 5f 74 65 78 74 31 36 te3_value_text16
3fa0: 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 _interop(IntPtr
3fb0: 70 2c 20 6f 75 74 20 69 6e 74 20 6c 65 6e 29 3b p, out int len);
3fc0: 0d 0a 0d 0a 23 65 6e 64 69 66 0d 0a 2f 2f 20 21 ....#endif..// !
3fd0: 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 0d SQLITE_STANDARD.
3fe0: 0a 0d 0a 20 20 20 20 23 65 6e 64 72 65 67 69 6f ... #endregio
3ff0: 6e 0d 0a 0d 0a 20 20 20 20 2f 2f 20 54 68 65 73 n.... // Thes
4000: 65 20 66 75 6e 63 74 69 6f 6e 73 20 61 64 64 20 e functions add
4010: 65 78 69 73 74 69 6e 67 20 66 75 6e 63 74 69 6f existing functio
4020: 6e 61 6c 69 74 79 20 6f 6e 20 74 6f 70 20 6f 66 nality on top of
4030: 20 53 51 4c 69 74 65 20 61 6e 64 20 72 65 71 75 SQLite and requ
4040: 69 72 65 20 61 20 6c 69 74 74 6c 65 20 65 66 66 ire a little eff
4050: 6f 72 74 20 74 6f 0d 0a 20 20 20 20 2f 2f 20 67 ort to.. // g
4060: 65 74 20 77 6f 72 6b 69 6e 67 20 77 68 65 6e 20 et working when
4070: 75 73 69 6e 67 20 74 68 65 20 73 74 61 6e 64 61 using the standa
4080: 72 64 20 53 51 4c 69 74 65 20 6c 69 62 72 61 72 rd SQLite librar
4090: 79 2e 0d 0a 20 20 20 20 23 72 65 67 69 6f 6e 20 y... #region
40a0: 69 6e 74 65 72 6f 70 20 61 64 64 65 64 20 66 75 interop added fu
40b0: 6e 63 74 69 6f 6e 61 6c 69 74 79 0d 0a 0d 0a 23 nctionality....#
40c0: 69 66 20 21 53 51 4c 49 54 45 5f 53 54 41 4e 44 if !SQLITE_STAND
40d0: 41 52 44 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 ARD.... [DllI
40e0: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
40f0: 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c )].. internal
4100: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 static extern i
4110: 6e 74 20 73 71 6c 69 74 65 33 5f 63 6c 6f 73 65 nt sqlite3_close
4120: 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 _interop(IntPtr
4130: 64 62 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c db);.... [Dll
4140: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
4150: 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 L)].. interna
4160: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
4170: 69 6e 74 20 73 71 6c 69 74 65 33 5f 63 72 65 61 int sqlite3_crea
4180: 74 65 5f 66 75 6e 63 74 69 6f 6e 5f 69 6e 74 65 te_function_inte
4190: 72 6f 70 28 49 6e 74 50 74 72 20 64 62 2c 20 62 rop(IntPtr db, b
41a0: 79 74 65 5b 5d 20 73 74 72 4e 61 6d 65 2c 20 69 yte[] strName, i
41b0: 6e 74 20 6e 41 72 67 73 2c 20 69 6e 74 20 6e 54 nt nArgs, int nT
41c0: 79 70 65 2c 20 49 6e 74 50 74 72 20 70 76 55 73 ype, IntPtr pvUs
41d0: 65 72 2c 20 53 51 4c 69 74 65 43 61 6c 6c 62 61 er, SQLiteCallba
41e0: 63 6b 20 66 75 6e 63 2c 20 53 51 4c 69 74 65 43 ck func, SQLiteC
41f0: 61 6c 6c 62 61 63 6b 20 66 73 74 65 70 2c 20 53 allback fstep, S
4200: 51 4c 69 74 65 46 69 6e 61 6c 43 61 6c 6c 62 61 QLiteFinalCallba
4210: 63 6b 20 66 66 69 6e 61 6c 2c 20 69 6e 74 20 6e ck ffinal, int n
4220: 65 65 64 43 6f 6c 6c 53 65 71 29 3b 0d 0a 0d 0a eedCollSeq);....
4230: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
4240: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 QLITE_DLL)]..
4250: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
4260: 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 extern int sqli
4270: 74 65 33 5f 66 69 6e 61 6c 69 7a 65 5f 69 6e 74 te3_finalize_int
4280: 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 erop(IntPtr stmt
4290: 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d );.... [DllIm
42a0: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
42b0: 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 ].. internal
42c0: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e static extern in
42d0: 74 20 73 71 6c 69 74 65 33 5f 6f 70 65 6e 5f 69 t sqlite3_open_i
42e0: 6e 74 65 72 6f 70 28 62 79 74 65 5b 5d 20 75 74 nterop(byte[] ut
42f0: 66 38 46 69 6c 65 6e 61 6d 65 2c 20 69 6e 74 20 f8Filename, int
4300: 66 6c 61 67 73 2c 20 6f 75 74 20 49 6e 74 50 74 flags, out IntPt
4310: 72 20 64 62 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 r db);.... [D
4320: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
4330: 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 DLL)].. inter
4340: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
4350: 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 6f 70 n int sqlite3_op
4360: 65 6e 31 36 5f 69 6e 74 65 72 6f 70 28 62 79 74 en16_interop(byt
4370: 65 5b 5d 20 75 74 66 38 46 69 6c 65 6e 61 6d 65 e[] utf8Filename
4380: 2c 20 69 6e 74 20 66 6c 61 67 73 2c 20 6f 75 74 , int flags, out
4390: 20 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a IntPtr db);....
43a0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
43b0: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 QLITE_DLL)]..
43c0: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
43d0: 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 extern int sqli
43e0: 74 65 33 5f 72 65 73 65 74 5f 69 6e 74 65 72 6f te3_reset_intero
43f0: 70 28 49 6e 74 50 74 72 20 73 74 6d 74 29 3b 0d p(IntPtr stmt);.
4400: 0a 0d 0a 23 65 6e 64 69 66 0d 0a 2f 2f 20 21 53 ...#endif..// !S
4410: 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 0d 0a QLITE_STANDARD..
4420: 0d 0a 20 20 20 20 23 65 6e 64 72 65 67 69 6f 6e .. #endregion
4430: 0d 0a 0d 0a 20 20 20 20 2f 2f 20 54 68 65 20 73 .... // The s
4440: 74 61 6e 64 61 72 64 20 61 70 69 20 63 61 6c 6c tandard api call
4450: 20 65 71 75 69 76 61 6c 65 6e 74 73 20 6f 66 20 equivalents of
4460: 74 68 65 20 61 62 6f 76 65 20 69 6e 74 65 72 6f the above intero
4470: 70 20 63 61 6c 6c 73 0d 0a 20 20 20 20 23 72 65 p calls.. #re
4480: 67 69 6f 6e 20 73 74 61 6e 64 61 72 64 20 76 65 gion standard ve
4490: 72 73 69 6f 6e 73 20 6f 66 20 69 6e 74 65 72 6f rsions of intero
44a0: 70 20 66 75 6e 63 74 69 6f 6e 73 0d 0a 0d 0a 23 p functions....#
44b0: 69 66 20 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 if SQLITE_STANDA
44c0: 52 44 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 RD....#if !PLATF
44d0: 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
44e0: 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
44f0: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
4500: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
4510: 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
4520: 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
4530: 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
4540: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
4550: 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
4560: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
4570: 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 extern int sqlit
4580: 65 33 5f 63 6c 6f 73 65 28 49 6e 74 50 74 72 20 e3_close(IntPtr
4590: 64 62 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 db);....#if !PLA
45a0: 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
45b0: 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
45c0: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
45d0: 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
45e0: 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
45f0: 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
4600: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c ..#else.. [Dl
4610: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
4620: 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 LL)]..#endif..
4630: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
4640: 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c c extern int sql
4650: 69 74 65 33 5f 63 72 65 61 74 65 5f 66 75 6e 63 ite3_create_func
4660: 74 69 6f 6e 28 49 6e 74 50 74 72 20 64 62 2c 20 tion(IntPtr db,
4670: 62 79 74 65 5b 5d 20 73 74 72 4e 61 6d 65 2c 20 byte[] strName,
4680: 69 6e 74 20 6e 41 72 67 73 2c 20 69 6e 74 20 6e int nArgs, int n
4690: 54 79 70 65 2c 20 49 6e 74 50 74 72 20 70 76 55 Type, IntPtr pvU
46a0: 73 65 72 2c 20 53 51 4c 69 74 65 43 61 6c 6c 62 ser, SQLiteCallb
46b0: 61 63 6b 20 66 75 6e 63 2c 20 53 51 4c 69 74 65 ack func, SQLite
46c0: 43 61 6c 6c 62 61 63 6b 20 66 73 74 65 70 2c 20 Callback fstep,
46d0: 53 51 4c 69 74 65 46 69 6e 61 6c 43 61 6c 6c 62 SQLiteFinalCallb
46e0: 61 63 6b 20 66 66 69 6e 61 6c 29 3b 0d 0a 0d 0a ack ffinal);....
46f0: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
4700: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
4710: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
4720: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
4730: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
4740: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
4750: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
4760: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
4770: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
4780: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
4790: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
47a0: 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 66 69 6e int sqlite3_fin
47b0: 61 6c 69 7a 65 28 49 6e 74 50 74 72 20 73 74 6d alize(IntPtr stm
47c0: 74 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 t);....#if !PLAT
47d0: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
47e0: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
47f0: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
4800: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
4810: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
4820: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
4830: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
4840: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
4850: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
4860: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
4870: 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 extern int sqli
4880: 74 65 33 5f 6f 70 65 6e 5f 76 32 28 62 79 74 65 te3_open_v2(byte
4890: 5b 5d 20 75 74 66 38 46 69 6c 65 6e 61 6d 65 2c [] utf8Filename,
48a0: 20 6f 75 74 20 49 6e 74 50 74 72 20 64 62 2c 20 out IntPtr db,
48b0: 69 6e 74 20 66 6c 61 67 73 2c 20 49 6e 74 50 74 int flags, IntPt
48c0: 72 20 76 66 73 29 3b 0d 0a 0d 0a 23 69 66 20 21 r vfs);....#if !
48d0: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
48e0: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
48f0: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
4900: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
4910: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
4920: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
4930: 6c 2c 20 43 68 61 72 53 65 74 20 3d 20 43 68 61 l, CharSet = Cha
4940: 72 53 65 74 2e 55 6e 69 63 6f 64 65 29 5d 0d 0a rSet.Unicode)]..
4950: 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
4960: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
4970: 2c 20 43 68 61 72 53 65 74 20 3d 20 43 68 61 72 , CharSet = Char
4980: 53 65 74 2e 55 6e 69 63 6f 64 65 29 5d 0d 0a 23 Set.Unicode)]..#
4990: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
49a0: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
49b0: 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 6f 70 n int sqlite3_op
49c0: 65 6e 31 36 28 73 74 72 69 6e 67 20 66 69 6c 65 en16(string file
49d0: 4e 61 6d 65 2c 20 6f 75 74 20 49 6e 74 50 74 72 Name, out IntPtr
49e0: 20 64 62 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c db);....#if !PL
49f0: 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
4a00: 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
4a10: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
4a20: 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
4a30: 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
4a40: 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
4a50: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
4a60: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
4a70: 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
4a80: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
4a90: 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 ic extern int sq
4aa0: 6c 69 74 65 33 5f 72 65 73 65 74 28 49 6e 74 50 lite3_reset(IntP
4ab0: 74 72 20 73 74 6d 74 29 3b 0d 0a 0d 0a 23 69 66 tr stmt);....#if
4ac0: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
4ad0: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
4ae0: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
4af0: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
4b00: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
4b10: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
4b20: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
4b30: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
4b40: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
4b50: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
4b60: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
4b70: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 62 69 6e tPtr sqlite3_bin
4b80: 64 5f 70 61 72 61 6d 65 74 65 72 5f 6e 61 6d 65 d_parameter_name
4b90: 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e (IntPtr stmt, in
4ba0: 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 t index);....#if
4bb0: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
4bc0: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
4bd0: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
4be0: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
4bf0: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
4c00: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
4c10: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
4c20: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
4c30: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
4c40: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
4c50: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
4c60: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c tPtr sqlite3_col
4c70: 75 6d 6e 5f 64 61 74 61 62 61 73 65 5f 6e 61 6d umn_database_nam
4c80: 65 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 e(IntPtr stmt, i
4c90: 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 nt index);....#i
4ca0: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
4cb0: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
4cc0: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
4cd0: 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
4ce0: 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
4cf0: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
4d00: 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
4d10: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
4d20: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
4d30: 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
4d40: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 static extern I
4d50: 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f ntPtr sqlite3_co
4d60: 6c 75 6d 6e 5f 64 61 74 61 62 61 73 65 5f 6e 61 lumn_database_na
4d70: 6d 65 31 36 28 49 6e 74 50 74 72 20 73 74 6d 74 me16(IntPtr stmt
4d80: 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d 0a 0d , int index);...
4d90: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
4da0: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
4db0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
4dc0: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
4dd0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
4de0: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
4df0: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
4e00: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
4e10: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
4e20: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
4e30: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
4e40: 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 n IntPtr sqlite3
4e50: 5f 63 6f 6c 75 6d 6e 5f 64 65 63 6c 74 79 70 65 _column_decltype
4e60: 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e (IntPtr stmt, in
4e70: 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 t index);....#if
4e80: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
4e90: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
4ea0: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
4eb0: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
4ec0: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
4ed0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
4ee0: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
4ef0: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
4f00: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
4f10: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
4f20: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
4f30: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c tPtr sqlite3_col
4f40: 75 6d 6e 5f 64 65 63 6c 74 79 70 65 31 36 28 49 umn_decltype16(I
4f50: 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 ntPtr stmt, int
4f60: 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 index);....#if !
4f70: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
4f80: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
4f90: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
4fa0: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
4fb0: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
4fc0: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
4fd0: 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
4fe0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
4ff0: 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
5000: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
5010: 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 atic extern IntP
5020: 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d tr sqlite3_colum
5030: 6e 5f 6e 61 6d 65 28 49 6e 74 50 74 72 20 73 74 n_name(IntPtr st
5040: 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d mt, int index);.
5050: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
5060: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
5070: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
5080: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
5090: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
50a0: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
50b0: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
50c0: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
50d0: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
50e0: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
50f0: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
5100: 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 ern IntPtr sqlit
5110: 65 33 5f 63 6f 6c 75 6d 6e 5f 6e 61 6d 65 31 36 e3_column_name16
5120: 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e (IntPtr stmt, in
5130: 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 t index);....#if
5140: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
5150: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
5160: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
5170: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
5180: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
5190: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
51a0: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
51b0: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
51c0: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
51d0: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
51e0: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
51f0: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c tPtr sqlite3_col
5200: 75 6d 6e 5f 6f 72 69 67 69 6e 5f 6e 61 6d 65 28 umn_origin_name(
5210: 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 IntPtr stmt, int
5220: 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 20 index);....#if
5230: 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
5240: 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
5250: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
5260: 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
5270: 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
5280: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
5290: 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
52a0: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
52b0: 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
52c0: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
52d0: 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
52e0: 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 Ptr sqlite3_colu
52f0: 6d 6e 5f 6f 72 69 67 69 6e 5f 6e 61 6d 65 31 36 mn_origin_name16
5300: 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e (IntPtr stmt, in
5310: 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 t index);....#if
5320: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
5330: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
5340: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
5350: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
5360: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
5370: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
5380: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
5390: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
53a0: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
53b0: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
53c0: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
53d0: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c tPtr sqlite3_col
53e0: 75 6d 6e 5f 74 61 62 6c 65 5f 6e 61 6d 65 28 49 umn_table_name(I
53f0: 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 ntPtr stmt, int
5400: 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 index);....#if !
5410: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
5420: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
5430: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
5440: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
5450: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
5460: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
5470: 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
5480: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
5490: 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
54a0: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
54b0: 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 atic extern IntP
54c0: 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d tr sqlite3_colum
54d0: 6e 5f 74 61 62 6c 65 5f 6e 61 6d 65 31 36 28 49 n_table_name16(I
54e0: 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 ntPtr stmt, int
54f0: 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 index);....#if !
5500: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
5510: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
5520: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
5530: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
5540: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
5550: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
5560: 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
5570: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
5580: 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
5590: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
55a0: 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 atic extern IntP
55b0: 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d tr sqlite3_colum
55c0: 6e 5f 74 65 78 74 28 49 6e 74 50 74 72 20 73 74 n_text(IntPtr st
55d0: 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d mt, int index);.
55e0: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
55f0: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
5600: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
5610: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
5620: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
5630: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
5640: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
5650: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
5660: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
5670: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
5680: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
5690: 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 74 ern IntPtr sqlit
56a0: 65 33 5f 63 6f 6c 75 6d 6e 5f 74 65 78 74 31 36 e3_column_text16
56b0: 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e (IntPtr stmt, in
56c0: 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 t index);....#if
56d0: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
56e0: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
56f0: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
5700: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
5710: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
5720: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
5730: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
5740: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
5750: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
5760: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
5770: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
5780: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 65 72 72 tPtr sqlite3_err
5790: 6d 73 67 28 49 6e 74 50 74 72 20 64 62 29 3b 0d msg(IntPtr db);.
57a0: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
57b0: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
57c0: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
57d0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
57e0: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
57f0: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
5800: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
5810: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
5820: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
5830: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
5840: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
5850: 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f ern int sqlite3_
5860: 70 72 65 70 61 72 65 28 49 6e 74 50 74 72 20 64 prepare(IntPtr d
5870: 62 2c 20 49 6e 74 50 74 72 20 70 53 71 6c 2c 20 b, IntPtr pSql,
5880: 69 6e 74 20 6e 42 79 74 65 73 2c 20 6f 75 74 20 int nBytes, out
5890: 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 6f 75 74 IntPtr stmt, out
58a0: 20 49 6e 74 50 74 72 20 70 74 72 52 65 6d 61 69 IntPtr ptrRemai
58b0: 6e 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 n);....#if !PLAT
58c0: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
58d0: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
58e0: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
58f0: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
5900: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
5910: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
5920: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
5930: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
5940: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
5950: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
5960: 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 extern int sqli
5970: 74 65 33 5f 74 61 62 6c 65 5f 63 6f 6c 75 6d 6e te3_table_column
5980: 5f 6d 65 74 61 64 61 74 61 28 49 6e 74 50 74 72 _metadata(IntPtr
5990: 20 64 62 2c 20 62 79 74 65 5b 5d 20 64 62 4e 61 db, byte[] dbNa
59a0: 6d 65 2c 20 62 79 74 65 5b 5d 20 74 62 6c 4e 61 me, byte[] tblNa
59b0: 6d 65 2c 20 62 79 74 65 5b 5d 20 63 6f 6c 4e 61 me, byte[] colNa
59c0: 6d 65 2c 20 6f 75 74 20 49 6e 74 50 74 72 20 70 me, out IntPtr p
59d0: 74 72 44 61 74 61 54 79 70 65 2c 20 6f 75 74 20 trDataType, out
59e0: 49 6e 74 50 74 72 20 70 74 72 43 6f 6c 6c 53 65 IntPtr ptrCollSe
59f0: 71 2c 20 6f 75 74 20 69 6e 74 20 6e 6f 74 4e 75 q, out int notNu
5a00: 6c 6c 2c 20 6f 75 74 20 69 6e 74 20 70 72 69 6d ll, out int prim
5a10: 61 72 79 4b 65 79 2c 20 6f 75 74 20 69 6e 74 20 aryKey, out int
5a20: 61 75 74 6f 49 6e 63 29 3b 0d 0a 0d 0a 23 69 66 autoInc);....#if
5a30: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
5a40: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
5a50: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
5a60: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
5a70: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
5a80: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
5a90: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
5aa0: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
5ab0: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
5ac0: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
5ad0: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
5ae0: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 76 61 6c tPtr sqlite3_val
5af0: 75 65 5f 74 65 78 74 28 49 6e 74 50 74 72 20 70 ue_text(IntPtr p
5b00: 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 );....#if !PLATF
5b10: 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
5b20: 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
5b30: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
5b40: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
5b50: 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
5b60: 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
5b70: 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
5b80: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
5b90: 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
5ba0: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
5bb0: 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 extern IntPtr sq
5bc0: 6c 69 74 65 33 5f 76 61 6c 75 65 5f 74 65 78 74 lite3_value_text
5bd0: 31 36 28 49 6e 74 50 74 72 20 70 29 3b 0d 0a 0d 16(IntPtr p);...
5be0: 0a 23 65 6e 64 69 66 0d 0a 2f 2f 20 53 51 4c 49 .#endif..// SQLI
5bf0: 54 45 5f 53 54 41 4e 44 41 52 44 0d 0a 0d 0a 20 TE_STANDARD....
5c00: 20 20 20 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 0d #endregion...
5c10: 0a 20 20 20 20 2f 2f 20 54 68 65 73 65 20 66 75 . // These fu
5c20: 6e 63 74 69 6f 6e 73 20 61 72 65 20 63 75 73 74 nctions are cust
5c30: 6f 6d 20 61 6e 64 20 68 61 76 65 20 6e 6f 20 65 om and have no e
5c40: 71 75 69 76 61 6c 65 6e 74 20 73 74 61 6e 64 61 quivalent standa
5c50: 72 64 20 6c 69 62 72 61 72 79 20 6d 65 74 68 6f rd library metho
5c60: 64 2e 0d 0a 20 20 20 20 2f 2f 20 41 6c 6c 20 6f d... // All o
5c70: 66 20 74 68 65 6d 20 61 72 65 20 22 6e 69 63 65 f them are "nice
5c80: 20 74 6f 20 68 61 76 65 73 22 20 61 6e 64 20 6e to haves" and n
5c90: 6f 74 20 6e 65 63 65 73 73 61 72 69 6c 79 20 22 ot necessarily "
5ca0: 6e 65 65 64 20 74 6f 20 68 61 76 65 73 22 2e 0d need to haves"..
5cb0: 0a 20 20 20 20 23 72 65 67 69 6f 6e 20 6e 6f 20 . #region no
5cc0: 65 71 75 69 76 61 6c 65 6e 74 20 73 74 61 6e 64 equivalent stand
5cd0: 61 72 64 20 6d 65 74 68 6f 64 0d 0a 0d 0a 23 69 ard method....#i
5ce0: 66 20 21 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 f !SQLITE_STANDA
5cf0: 52 44 0d 0a 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d RD.... [DllIm
5d00: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
5d10: 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 ].. internal
5d20: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
5d30: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6e tPtr sqlite3_con
5d40: 74 65 78 74 5f 63 6f 6c 6c 73 65 71 28 49 6e 74 text_collseq(Int
5d50: 50 74 72 20 63 6f 6e 74 65 78 74 2c 20 6f 75 74 Ptr context, out
5d60: 20 69 6e 74 20 74 79 70 65 2c 20 6f 75 74 20 69 int type, out i
5d70: 6e 74 20 65 6e 63 2c 20 6f 75 74 20 69 6e 74 20 nt enc, out int
5d80: 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 5b 44 6c len);.... [Dl
5d90: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
5da0: 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e LL)].. intern
5db0: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
5dc0: 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 63 6f 6e int sqlite3_con
5dd0: 74 65 78 74 5f 63 6f 6c 6c 63 6f 6d 70 61 72 65 text_collcompare
5de0: 28 49 6e 74 50 74 72 20 63 6f 6e 74 65 78 74 2c (IntPtr context,
5df0: 20 62 79 74 65 5b 5d 20 70 31 2c 20 69 6e 74 20 byte[] p1, int
5e00: 70 31 6c 65 6e 2c 20 62 79 74 65 5b 5d 20 70 32 p1len, byte[] p2
5e10: 2c 20 69 6e 74 20 70 32 6c 65 6e 29 3b 0d 0a 0d , int p2len);...
5e20: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
5e30: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
5e40: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
5e50: 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c c extern int sql
5e60: 69 74 65 33 5f 63 75 72 73 6f 72 5f 72 6f 77 69 ite3_cursor_rowi
5e70: 64 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 d(IntPtr stmt, i
5e80: 6e 74 20 63 75 72 73 6f 72 2c 20 6f 75 74 20 6c nt cursor, out l
5e90: 6f 6e 67 20 72 6f 77 69 64 29 3b 0d 0a 0d 0a 20 ong rowid);....
5ea0: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
5eb0: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 LITE_DLL)]..
5ec0: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
5ed0: 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 extern int sqlit
5ee0: 65 33 5f 69 6e 64 65 78 5f 63 6f 6c 75 6d 6e 5f e3_index_column_
5ef0: 69 6e 66 6f 5f 69 6e 74 65 72 6f 70 28 49 6e 74 info_interop(Int
5f00: 50 74 72 20 64 62 2c 20 62 79 74 65 5b 5d 20 63 Ptr db, byte[] c
5f10: 61 74 61 6c 6f 67 2c 20 62 79 74 65 5b 5d 20 49 atalog, byte[] I
5f20: 6e 64 65 78 4e 61 6d 65 2c 20 62 79 74 65 5b 5d ndexName, byte[]
5f30: 20 43 6f 6c 75 6d 6e 4e 61 6d 65 2c 20 6f 75 74 ColumnName, out
5f40: 20 69 6e 74 20 73 6f 72 74 4f 72 64 65 72 2c 20 int sortOrder,
5f50: 6f 75 74 20 69 6e 74 20 6f 6e 45 72 72 6f 72 2c out int onError,
5f60: 20 6f 75 74 20 49 6e 74 50 74 72 20 43 6f 6c 6c out IntPtr Coll
5f70: 61 74 69 6f 6e 2c 20 6f 75 74 20 69 6e 74 20 63 ation, out int c
5f80: 6f 6c 6c 6c 65 6e 29 3b 0d 0a 0d 0a 20 20 20 20 olllen);....
5f90: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
5fa0: 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 E_DLL)].. int
5fb0: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
5fc0: 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 33 ern void sqlite3
5fd0: 5f 72 65 73 65 74 61 6c 6c 5f 69 6e 74 65 72 6f _resetall_intero
5fe0: 70 28 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d p(IntPtr db);...
5ff0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
6000: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
6010: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
6020: 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c c extern int sql
6030: 69 74 65 33 5f 74 61 62 6c 65 5f 63 75 72 73 6f ite3_table_curso
6040: 72 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 r(IntPtr stmt, i
6050: 6e 74 20 64 62 2c 20 69 6e 74 20 74 61 62 6c 65 nt db, int table
6060: 52 6f 6f 74 50 61 67 65 29 3b 0d 0a 0d 0a 23 65 RootPage);....#e
6070: 6e 64 69 66 0d 0a 2f 2f 20 21 53 51 4c 49 54 45 ndif..// !SQLITE
6080: 5f 53 54 41 4e 44 41 52 44 0d 0a 0d 0a 20 20 20 _STANDARD....
6090: 20 23 65 6e 64 72 65 67 69 6f 6e 0d 0a 0d 0a 20 #endregion....
60a0: 20 20 20 2f 2f 20 53 74 61 6e 64 61 72 64 20 41 // Standard A
60b0: 50 49 20 63 61 6c 6c 73 20 67 6c 6f 62 61 6c 20 PI calls global
60c0: 61 63 72 6f 73 73 20 76 65 72 73 69 6f 6e 73 2e across versions.
60d0: 20 20 54 68 65 72 65 20 61 72 65 20 61 20 66 65 There are a fe
60e0: 77 20 69 6e 73 74 61 6e 63 65 73 20 6f 66 20 69 w instances of i
60f0: 6e 74 65 72 6f 70 20 63 61 6c 6c 73 0d 0a 20 20 nterop calls..
6100: 20 20 2f 2f 20 73 63 61 74 74 65 72 65 64 20 69 // scattered i
6110: 6e 20 68 65 72 65 2c 20 62 75 74 20 74 68 65 79 n here, but they
6120: 20 61 72 65 20 6f 6e 6c 79 20 61 63 74 69 76 65 are only active
6130: 20 77 68 65 6e 20 50 4c 41 54 46 4f 52 4d 5f 43 when PLATFORM_C
6140: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 20 OMPACTFRAMEWORK
6150: 69 73 20 64 65 63 6c 61 72 65 64 2e 0d 0a 20 20 is declared...
6160: 20 20 23 72 65 67 69 6f 6e 20 73 74 61 6e 64 61 #region standa
6170: 72 64 20 73 71 6c 69 74 65 20 61 70 69 20 63 61 rd sqlite api ca
6180: 6c 6c 73 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 lls....#if !PLAT
6190: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
61a0: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
61b0: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
61c0: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
61d0: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
61e0: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
61f0: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
6200: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
6210: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
6220: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
6230: 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 extern IntPtr s
6240: 71 6c 69 74 65 33 5f 6c 69 62 76 65 72 73 69 6f qlite3_libversio
6250: 6e 28 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 n();....#if !PLA
6260: 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
6270: 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
6280: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
6290: 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
62a0: 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
62b0: 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
62c0: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c ..#else.. [Dl
62d0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
62e0: 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 LL)]..#endif..
62f0: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
6300: 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 c extern IntPtr
6310: 73 71 6c 69 74 65 33 5f 73 6f 75 72 63 65 69 64 sqlite3_sourceid
6320: 28 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 ();....#if !PLAT
6330: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
6340: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
6350: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
6360: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
6370: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
6380: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
6390: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
63a0: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
63b0: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
63c0: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
63d0: 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 71 6c extern void sql
63e0: 69 74 65 33 5f 69 6e 74 65 72 72 75 70 74 28 49 ite3_interrupt(I
63f0: 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 23 69 ntPtr db);....#i
6400: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
6410: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
6420: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
6430: 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
6440: 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
6450: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
6460: 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
6470: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
6480: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
6490: 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
64a0: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 6c static extern l
64b0: 6f 6e 67 20 73 71 6c 69 74 65 33 5f 6c 61 73 74 ong sqlite3_last
64c0: 5f 69 6e 73 65 72 74 5f 72 6f 77 69 64 28 49 6e _insert_rowid(In
64d0: 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 23 69 66 tPtr db);....#if
64e0: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
64f0: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
6500: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
6510: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
6520: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
6530: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
6540: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
6550: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
6560: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
6570: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
6580: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e static extern in
6590: 74 20 73 71 6c 69 74 65 33 5f 63 68 61 6e 67 65 t sqlite3_change
65a0: 73 28 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d s(IntPtr db);...
65b0: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
65c0: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
65d0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
65e0: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
65f0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
6600: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
6610: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
6620: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
6630: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
6640: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
6650: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
6660: 6e 20 6c 6f 6e 67 20 73 71 6c 69 74 65 33 5f 6d n long sqlite3_m
6670: 65 6d 6f 72 79 5f 75 73 65 64 28 29 3b 0d 0a 0d emory_used();...
6680: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
6690: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
66a0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
66b0: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
66c0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
66d0: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
66e0: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
66f0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
6700: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
6710: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
6720: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
6730: 6e 20 6c 6f 6e 67 20 73 71 6c 69 74 65 33 5f 6d n long sqlite3_m
6740: 65 6d 6f 72 79 5f 68 69 67 68 77 61 74 65 72 28 emory_highwater(
6750: 69 6e 74 20 72 65 73 65 74 46 6c 61 67 29 3b 0d int resetFlag);.
6760: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
6770: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
6780: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
6790: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
67a0: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
67b0: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
67c0: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
67d0: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
67e0: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
67f0: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
6800: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
6810: 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f ern int sqlite3_
6820: 73 68 75 74 64 6f 77 6e 28 29 3b 0d 0a 0d 0a 23 shutdown();....#
6830: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
6840: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
6850: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
6860: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
6870: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
6880: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
6890: 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
68a0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
68b0: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
68c0: 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
68d0: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
68e0: 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 75 73 79 int sqlite3_busy
68f0: 5f 74 69 6d 65 6f 75 74 28 49 6e 74 50 74 72 20 _timeout(IntPtr
6900: 64 62 2c 20 69 6e 74 20 6d 73 29 3b 0d 0a 0d 0a db, int ms);....
6910: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
6920: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
6930: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
6940: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
6950: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
6960: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
6970: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
6980: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
6990: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
69a0: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
69b0: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
69c0: 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 69 6e int sqlite3_bin
69d0: 64 5f 62 6c 6f 62 28 49 6e 74 50 74 72 20 73 74 d_blob(IntPtr st
69e0: 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 42 mt, int index, B
69f0: 79 74 65 5b 5d 20 76 61 6c 75 65 2c 20 69 6e 74 yte[] value, int
6a00: 20 6e 53 69 7a 65 2c 20 49 6e 74 50 74 72 20 6e nSize, IntPtr n
6a10: 54 72 61 6e 73 69 65 6e 74 29 3b 0d 0a 0d 0a 23 Transient);....#
6a20: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
6a30: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
6a40: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
6a50: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
6a60: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
6a70: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
6a80: 43 64 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 Cdecl)].. int
6a90: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
6aa0: 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f ern int sqlite3_
6ab0: 62 69 6e 64 5f 64 6f 75 62 6c 65 28 49 6e 74 50 bind_double(IntP
6ac0: 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 tr stmt, int ind
6ad0: 65 78 2c 20 64 6f 75 62 6c 65 20 76 61 6c 75 65 ex, double value
6ae0: 29 3b 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b );..#else.. [
6af0: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
6b00: 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 _DLL)].. inte
6b10: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
6b20: 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 rn int sqlite3_b
6b30: 69 6e 64 5f 64 6f 75 62 6c 65 5f 69 6e 74 65 72 ind_double_inter
6b40: 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 op(IntPtr stmt,
6b50: 69 6e 74 20 69 6e 64 65 78 2c 20 72 65 66 20 64 int index, ref d
6b60: 6f 75 62 6c 65 20 76 61 6c 75 65 29 3b 0d 0a 23 ouble value);..#
6b70: 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 4c endif....#if !PL
6b80: 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
6b90: 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
6ba0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
6bb0: 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
6bc0: 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
6bd0: 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
6be0: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
6bf0: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
6c00: 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
6c10: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
6c20: 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 ic extern int sq
6c30: 6c 69 74 65 33 5f 62 69 6e 64 5f 69 6e 74 28 49 lite3_bind_int(I
6c40: 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 ntPtr stmt, int
6c50: 69 6e 64 65 78 2c 20 69 6e 74 20 76 61 6c 75 65 index, int value
6c60: 29 3b 0d 0a 0d 0a 20 20 20 20 2f 2f 0d 0a 20 20 );.... //..
6c70: 20 20 2f 2f 20 4e 4f 54 45 3a 20 54 68 69 73 20 // NOTE: This
6c80: 72 65 61 6c 6c 79 20 6a 75 73 74 20 63 61 6c 6c really just call
6c90: 73 20 22 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f s "sqlite3_bind_
6ca0: 69 6e 74 22 3b 20 68 6f 77 65 76 65 72 2c 20 69 int"; however, i
6cb0: 74 20 68 61 73 20 74 68 65 0d 0a 20 20 20 20 2f t has the.. /
6cc0: 2f 20 20 20 20 20 20 20 63 6f 72 72 65 63 74 20 / correct
6cd0: 74 79 70 65 20 73 69 67 6e 61 74 75 72 65 20 66 type signature f
6ce0: 6f 72 20 61 6e 20 75 6e 73 69 67 6e 65 64 20 28 or an unsigned (
6cf0: 33 32 2d 62 69 74 29 20 69 6e 74 65 67 65 72 2e 32-bit) integer.
6d00: 0d 0a 20 20 20 20 2f 2f 0d 0a 23 69 66 20 21 50 .. //..#if !P
6d10: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
6d20: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
6d30: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
6d40: 44 4c 4c 2c 20 45 6e 74 72 79 50 6f 69 6e 74 20 DLL, EntryPoint
6d50: 3d 20 22 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f = "sqlite3_bind_
6d60: 69 6e 74 22 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e int", CallingCon
6d70: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
6d80: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
6d90: 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
6da0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
6db0: 45 5f 44 4c 4c 2c 20 45 6e 74 72 79 50 6f 69 6e E_DLL, EntryPoin
6dc0: 74 20 3d 20 22 73 71 6c 69 74 65 33 5f 62 69 6e t = "sqlite3_bin
6dd0: 64 5f 69 6e 74 22 29 5d 0d 0a 23 65 6e 64 69 66 d_int")]..#endif
6de0: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
6df0: 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 tatic extern int
6e00: 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 75 69 sqlite3_bind_ui
6e10: 6e 74 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 nt(IntPtr stmt,
6e20: 69 6e 74 20 69 6e 64 65 78 2c 20 75 69 6e 74 20 int index, uint
6e30: 76 61 6c 75 65 29 3b 0d 0a 0d 0a 23 69 66 20 21 value);....#if !
6e40: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
6e50: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
6e60: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
6e70: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
6e80: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
6e90: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
6ea0: 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 l)].. interna
6eb0: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
6ec0: 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 69 6e 64 int sqlite3_bind
6ed0: 5f 69 6e 74 36 34 28 49 6e 74 50 74 72 20 73 74 _int64(IntPtr st
6ee0: 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 6c mt, int index, l
6ef0: 6f 6e 67 20 76 61 6c 75 65 29 3b 0d 0a 23 65 6c ong value);..#el
6f00: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
6f10: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
6f20: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
6f30: 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 atic extern int
6f40: 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 69 6e 74 sqlite3_bind_int
6f50: 36 34 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 64_interop(IntPt
6f60: 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 r stmt, int inde
6f70: 78 2c 20 72 65 66 20 6c 6f 6e 67 20 76 61 6c 75 x, ref long valu
6f80: 65 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a 20 e);..#endif....
6f90: 20 20 20 2f 2f 0d 0a 20 20 20 20 2f 2f 20 4e 4f //.. // NO
6fa0: 54 45 3a 20 54 68 69 73 20 72 65 61 6c 6c 79 20 TE: This really
6fb0: 6a 75 73 74 20 63 61 6c 6c 73 20 22 73 71 6c 69 just calls "sqli
6fc0: 74 65 33 5f 62 69 6e 64 5f 69 6e 74 36 34 22 3b te3_bind_int64";
6fd0: 20 68 6f 77 65 76 65 72 2c 20 69 74 20 68 61 73 however, it has
6fe0: 20 74 68 65 0d 0a 20 20 20 20 2f 2f 20 20 20 20 the.. //
6ff0: 20 20 20 63 6f 72 72 65 63 74 20 74 79 70 65 20 correct type
7000: 73 69 67 6e 61 74 75 72 65 20 66 6f 72 20 61 6e signature for an
7010: 20 75 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 20 28 unsigned long (
7020: 36 34 2d 62 69 74 29 20 69 6e 74 65 67 65 72 2e 64-bit) integer.
7030: 0d 0a 20 20 20 20 2f 2f 0d 0a 23 69 66 20 21 50 .. //..#if !P
7040: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
7050: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
7060: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
7070: 44 4c 4c 2c 20 45 6e 74 72 79 50 6f 69 6e 74 20 DLL, EntryPoint
7080: 3d 20 22 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f = "sqlite3_bind_
7090: 69 6e 74 36 34 22 2c 20 43 61 6c 6c 69 6e 67 43 int64", CallingC
70a0: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
70b0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
70c0: 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 ecl)].. inter
70d0: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
70e0: 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 69 n int sqlite3_bi
70f0: 6e 64 5f 75 69 6e 74 36 34 28 49 6e 74 50 74 72 nd_uint64(IntPtr
7100: 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 stmt, int index
7110: 2c 20 75 6c 6f 6e 67 20 76 61 6c 75 65 29 3b 0d , ulong value);.
7120: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
7130: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
7140: 4c 2c 20 45 6e 74 72 79 50 6f 69 6e 74 20 3d 20 L, EntryPoint =
7150: 22 73 71 6c 69 74 65 33 5f 62 69 6e 64 5f 69 6e "sqlite3_bind_in
7160: 74 36 34 5f 69 6e 74 65 72 6f 70 22 29 5d 0d 0a t64_interop")]..
7170: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
7180: 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 tic extern int s
7190: 71 6c 69 74 65 33 5f 62 69 6e 64 5f 75 69 6e 74 qlite3_bind_uint
71a0: 36 34 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 64_interop(IntPt
71b0: 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 r stmt, int inde
71c0: 78 2c 20 72 65 66 20 75 6c 6f 6e 67 20 76 61 6c x, ref ulong val
71d0: 75 65 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d 0a ue);..#endif....
71e0: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
71f0: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
7200: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
7210: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
7220: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
7230: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
7240: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
7250: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
7260: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
7270: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
7280: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
7290: 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 69 6e int sqlite3_bin
72a0: 64 5f 6e 75 6c 6c 28 49 6e 74 50 74 72 20 73 74 d_null(IntPtr st
72b0: 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d mt, int index);.
72c0: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
72d0: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
72e0: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
72f0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
7300: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
7310: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
7320: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
7330: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
7340: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
7350: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
7360: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
7370: 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f ern int sqlite3_
7380: 62 69 6e 64 5f 74 65 78 74 28 49 6e 74 50 74 72 bind_text(IntPtr
7390: 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 stmt, int index
73a0: 2c 20 62 79 74 65 5b 5d 20 76 61 6c 75 65 2c 20 , byte[] value,
73b0: 69 6e 74 20 6e 6c 65 6e 2c 20 49 6e 74 50 74 72 int nlen, IntPtr
73c0: 20 70 76 52 65 73 65 72 76 65 64 29 3b 0d 0a 0d pvReserved);...
73d0: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
73e0: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
73f0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
7400: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
7410: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
7420: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
7430: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
7440: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
7450: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
7460: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
7470: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
7480: 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 62 69 n int sqlite3_bi
7490: 6e 64 5f 70 61 72 61 6d 65 74 65 72 5f 63 6f 75 nd_parameter_cou
74a0: 6e 74 28 49 6e 74 50 74 72 20 73 74 6d 74 29 3b nt(IntPtr stmt);
74b0: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
74c0: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
74d0: 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
74e0: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
74f0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
7500: 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
7510: 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
7520: 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
7530: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
7540: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
7550: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
7560: 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 tern int sqlite3
7570: 5f 62 69 6e 64 5f 70 61 72 61 6d 65 74 65 72 5f _bind_parameter_
7580: 69 6e 64 65 78 28 49 6e 74 50 74 72 20 73 74 6d index(IntPtr stm
7590: 74 2c 20 62 79 74 65 5b 5d 20 73 74 72 4e 61 6d t, byte[] strNam
75a0: 65 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 e);....#if !PLAT
75b0: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
75c0: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
75d0: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
75e0: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
75f0: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
7600: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
7610: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
7620: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
7630: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
7640: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
7650: 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 extern int sqli
7660: 74 65 33 5f 63 6f 6c 75 6d 6e 5f 63 6f 75 6e 74 te3_column_count
7670: 28 49 6e 74 50 74 72 20 73 74 6d 74 29 3b 0d 0a (IntPtr stmt);..
7680: 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
7690: 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
76a0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
76b0: 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
76c0: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
76d0: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
76e0: 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
76f0: 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
7700: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
7710: 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
7720: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
7730: 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 73 rn int sqlite3_s
7740: 74 65 70 28 49 6e 74 50 74 72 20 73 74 6d 74 29 tep(IntPtr stmt)
7750: 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f ;....#if !PLATFO
7760: 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
7770: 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
7780: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
7790: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
77a0: 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
77b0: 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 20 ntion.Cdecl)]..
77c0: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
77d0: 69 63 20 65 78 74 65 72 6e 20 64 6f 75 62 6c 65 ic extern double
77e0: 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f sqlite3_column_
77f0: 64 6f 75 62 6c 65 28 49 6e 74 50 74 72 20 73 74 double(IntPtr st
7800: 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d mt, int index);.
7810: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
7820: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
7830: 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 L)].. interna
7840: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
7850: 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 63 6f 6c void sqlite3_col
7860: 75 6d 6e 5f 64 6f 75 62 6c 65 5f 69 6e 74 65 72 umn_double_inter
7870: 6f 70 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 op(IntPtr stmt,
7880: 69 6e 74 20 69 6e 64 65 78 2c 20 6f 75 74 20 64 int index, out d
7890: 6f 75 62 6c 65 20 76 61 6c 75 65 29 3b 0d 0a 23 ouble value);..#
78a0: 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 4c endif....#if !PL
78b0: 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
78c0: 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
78d0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
78e0: 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
78f0: 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
7900: 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
7910: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
7920: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
7930: 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
7940: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
7950: 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 ic extern int sq
7960: 6c 69 74 65 33 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 lite3_column_int
7970: 28 49 6e 74 50 74 72 20 73 74 6d 74 2c 20 69 6e (IntPtr stmt, in
7980: 74 20 69 6e 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 t index);....#if
7990: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
79a0: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
79b0: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
79c0: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
79d0: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
79e0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
79f0: 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 ecl)].. inter
7a00: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
7a10: 6e 20 6c 6f 6e 67 20 73 71 6c 69 74 65 33 5f 63 n long sqlite3_c
7a20: 6f 6c 75 6d 6e 5f 69 6e 74 36 34 28 49 6e 74 50 olumn_int64(IntP
7a30: 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 tr stmt, int ind
7a40: 65 78 29 3b 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 ex);..#else..
7a50: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
7a60: 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e TE_DLL)].. in
7a70: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
7a80: 74 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 tern void sqlite
7a90: 33 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 36 34 5f 69 3_column_int64_i
7aa0: 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 73 74 nterop(IntPtr st
7ab0: 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 2c 20 6f mt, int index, o
7ac0: 75 74 20 6c 6f 6e 67 20 76 61 6c 75 65 29 3b 0d ut long value);.
7ad0: 0a 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 .#endif....#if !
7ae0: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
7af0: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
7b00: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
7b10: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
7b20: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
7b30: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
7b40: 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
7b50: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
7b60: 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
7b70: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
7b80: 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 atic extern IntP
7b90: 74 72 20 73 71 6c 69 74 65 33 5f 63 6f 6c 75 6d tr sqlite3_colum
7ba0: 6e 5f 62 6c 6f 62 28 49 6e 74 50 74 72 20 73 74 n_blob(IntPtr st
7bb0: 6d 74 2c 20 69 6e 74 20 69 6e 64 65 78 29 3b 0d mt, int index);.
7bc0: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
7bd0: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
7be0: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
7bf0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
7c00: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
7c10: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
7c20: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
7c30: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
7c40: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
7c50: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
7c60: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
7c70: 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 5f ern int sqlite3_
7c80: 63 6f 6c 75 6d 6e 5f 62 79 74 65 73 28 49 6e 74 column_bytes(Int
7c90: 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e Ptr stmt, int in
7ca0: 64 65 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c dex);....#if !PL
7cb0: 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 ATFORM_COMPACTFR
7cc0: 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c AMEWORK.. [Dl
7cd0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
7ce0: 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 LL, CallingConve
7cf0: 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 ntion = CallingC
7d00: 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 onvention.Cdecl)
7d10: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
7d20: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
7d30: 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 DLL)]..#endif..
7d40: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
7d50: 69 63 20 65 78 74 65 72 6e 20 54 79 70 65 41 66 ic extern TypeAf
7d60: 66 69 6e 69 74 79 20 73 71 6c 69 74 65 33 5f 63 finity sqlite3_c
7d70: 6f 6c 75 6d 6e 5f 74 79 70 65 28 49 6e 74 50 74 olumn_type(IntPt
7d80: 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e 64 65 r stmt, int inde
7d90: 78 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 x);....#if !PLAT
7da0: 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d FORM_COMPACTFRAM
7db0: 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 EWORK.. [DllI
7dc0: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
7dd0: 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 , CallingConvent
7de0: 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e ion = CallingCon
7df0: 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d vention.Cdecl)].
7e00: 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c .#else.. [Dll
7e10: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
7e20: 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 L)]..#endif..
7e30: 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 internal static
7e40: 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 extern int sqli
7e50: 74 65 33 5f 63 72 65 61 74 65 5f 63 6f 6c 6c 61 te3_create_colla
7e60: 74 69 6f 6e 28 49 6e 74 50 74 72 20 64 62 2c 20 tion(IntPtr db,
7e70: 62 79 74 65 5b 5d 20 73 74 72 4e 61 6d 65 2c 20 byte[] strName,
7e80: 69 6e 74 20 6e 54 79 70 65 2c 20 49 6e 74 50 74 int nType, IntPt
7e90: 72 20 70 76 55 73 65 72 2c 20 53 51 4c 69 74 65 r pvUser, SQLite
7ea0: 43 6f 6c 6c 61 74 69 6f 6e 20 66 75 6e 63 29 3b Collation func);
7eb0: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
7ec0: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
7ed0: 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
7ee0: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
7ef0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
7f00: 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
7f10: 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
7f20: 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
7f30: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
7f40: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
7f50: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
7f60: 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 tern int sqlite3
7f70: 5f 61 67 67 72 65 67 61 74 65 5f 63 6f 75 6e 74 _aggregate_count
7f80: 28 49 6e 74 50 74 72 20 63 6f 6e 74 65 78 74 29 (IntPtr context)
7f90: 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f ;....#if !PLATFO
7fa0: 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
7fb0: 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
7fc0: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
7fd0: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
7fe0: 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
7ff0: 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 ntion.Cdecl)]..#
8000: 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d else.. [DllIm
8010: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
8020: 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 ]..#endif.. i
8030: 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 nternal static e
8040: 78 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c xtern IntPtr sql
8050: 69 74 65 33 5f 76 61 6c 75 65 5f 62 6c 6f 62 28 ite3_value_blob(
8060: 49 6e 74 50 74 72 20 70 29 3b 0d 0a 0d 0a 23 69 IntPtr p);....#i
8070: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
8080: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
8090: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
80a0: 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
80b0: 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
80c0: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
80d0: 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
80e0: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
80f0: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
8100: 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
8110: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 static extern i
8120: 6e 74 20 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 nt sqlite3_value
8130: 5f 62 79 74 65 73 28 49 6e 74 50 74 72 20 70 29 _bytes(IntPtr p)
8140: 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f ;....#if !PLATFO
8150: 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
8160: 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
8170: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
8180: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
8190: 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
81a0: 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 20 ntion.Cdecl)]..
81b0: 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 internal stat
81c0: 69 63 20 65 78 74 65 72 6e 20 64 6f 75 62 6c 65 ic extern double
81d0: 20 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 64 sqlite3_value_d
81e0: 6f 75 62 6c 65 28 49 6e 74 50 74 72 20 70 29 3b ouble(IntPtr p);
81f0: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c ..#else.. [Dl
8200: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
8210: 4c 4c 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e LL)].. intern
8220: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
8230: 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 76 61 void sqlite3_va
8240: 6c 75 65 5f 64 6f 75 62 6c 65 5f 69 6e 74 65 72 lue_double_inter
8250: 6f 70 28 49 6e 74 50 74 72 20 70 2c 20 6f 75 74 op(IntPtr p, out
8260: 20 64 6f 75 62 6c 65 20 76 61 6c 75 65 29 3b 0d double value);.
8270: 0a 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 .#endif....#if !
8280: 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
8290: 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b FRAMEWORK.. [
82a0: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
82b0: 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e _DLL, CallingCon
82c0: 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e vention = Callin
82d0: 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 gConvention.Cdec
82e0: 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 l)]..#else..
82f0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
8300: 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d E_DLL)]..#endif.
8310: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
8320: 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 20 atic extern int
8330: 73 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 69 6e sqlite3_value_in
8340: 74 28 49 6e 74 50 74 72 20 70 29 3b 0d 0a 0d 0a t(IntPtr p);....
8350: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
8360: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
8370: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
8380: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
8390: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
83a0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
83b0: 2e 43 64 65 63 6c 29 5d 0d 0a 20 20 20 20 69 6e .Cdecl)].. in
83c0: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
83d0: 74 65 72 6e 20 6c 6f 6e 67 20 73 71 6c 69 74 65 tern long sqlite
83e0: 33 5f 76 61 6c 75 65 5f 69 6e 74 36 34 28 49 6e 3_value_int64(In
83f0: 74 50 74 72 20 70 29 3b 0d 0a 23 65 6c 73 65 0d tPtr p);..#else.
8400: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
8410: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
8420: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
8430: 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 71 c extern void sq
8440: 6c 69 74 65 33 5f 76 61 6c 75 65 5f 69 6e 74 36 lite3_value_int6
8450: 34 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 4_interop(IntPtr
8460: 20 70 2c 20 6f 75 74 20 49 6e 74 36 34 20 76 61 p, out Int64 va
8470: 6c 75 65 29 3b 0d 0a 23 65 6e 64 69 66 0d 0a 0d lue);..#endif...
8480: 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 .#if !PLATFORM_C
8490: 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d OMPACTFRAMEWORK.
84a0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
84b0: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c SQLITE_DLL, Call
84c0: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 ingConvention =
84d0: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
84e0: 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 n.Cdecl)]..#else
84f0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
8500: 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 (SQLITE_DLL)]..#
8510: 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 endif.. inter
8520: 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 nal static exter
8530: 6e 20 54 79 70 65 41 66 66 69 6e 69 74 79 20 73 n TypeAffinity s
8540: 71 6c 69 74 65 33 5f 76 61 6c 75 65 5f 74 79 70 qlite3_value_typ
8550: 65 28 49 6e 74 50 74 72 20 70 29 3b 0d 0a 0d 0a e(IntPtr p);....
8560: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
8570: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
8580: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
8590: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
85a0: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
85b0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
85c0: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
85d0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
85e0: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
85f0: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
8600: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
8610: 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 void sqlite3_re
8620: 73 75 6c 74 5f 62 6c 6f 62 28 49 6e 74 50 74 72 sult_blob(IntPtr
8630: 20 63 6f 6e 74 65 78 74 2c 20 62 79 74 65 5b 5d context, byte[]
8640: 20 76 61 6c 75 65 2c 20 69 6e 74 20 6e 53 69 7a value, int nSiz
8650: 65 2c 20 49 6e 74 50 74 72 20 70 76 52 65 73 65 e, IntPtr pvRese
8660: 72 76 65 64 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 rved);....#if !P
8670: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
8680: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
8690: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
86a0: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
86b0: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
86c0: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
86d0: 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c )].. internal
86e0: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 static extern v
86f0: 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 73 75 oid sqlite3_resu
8700: 6c 74 5f 64 6f 75 62 6c 65 28 49 6e 74 50 74 72 lt_double(IntPtr
8710: 20 63 6f 6e 74 65 78 74 2c 20 64 6f 75 62 6c 65 context, double
8720: 20 76 61 6c 75 65 29 3b 0d 0a 23 65 6c 73 65 0d value);..#else.
8730: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
8740: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 SQLITE_DLL)]..
8750: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
8760: 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 73 71 c extern void sq
8770: 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 64 6f 75 lite3_result_dou
8780: 62 6c 65 5f 69 6e 74 65 72 6f 70 28 49 6e 74 50 ble_interop(IntP
8790: 74 72 20 63 6f 6e 74 65 78 74 2c 20 72 65 66 20 tr context, ref
87a0: 64 6f 75 62 6c 65 20 76 61 6c 75 65 29 3b 0d 0a double value);..
87b0: 23 65 6e 64 69 66 0d 0a 0d 0a 23 69 66 20 21 50 #endif....#if !P
87c0: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
87d0: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
87e0: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
87f0: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
8800: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
8810: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
8820: 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
8830: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
8840: 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
8850: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
8860: 74 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 tic extern void
8870: 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 65 sqlite3_result_e
8880: 72 72 6f 72 28 49 6e 74 50 74 72 20 63 6f 6e 74 rror(IntPtr cont
8890: 65 78 74 2c 20 62 79 74 65 5b 5d 20 73 74 72 45 ext, byte[] strE
88a0: 72 72 2c 20 69 6e 74 20 6e 4c 65 6e 29 3b 0d 0a rr, int nLen);..
88b0: 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
88c0: 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
88d0: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
88e0: 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
88f0: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
8900: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
8910: 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
8920: 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
8930: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
8940: 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
8950: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
8960: 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f rn void sqlite3_
8970: 72 65 73 75 6c 74 5f 69 6e 74 28 49 6e 74 50 74 result_int(IntPt
8980: 72 20 63 6f 6e 74 65 78 74 2c 20 69 6e 74 20 76 r context, int v
8990: 61 6c 75 65 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 alue);....#if !P
89a0: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
89b0: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
89c0: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
89d0: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
89e0: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
89f0: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
8a00: 29 5d 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c )].. internal
8a10: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 76 static extern v
8a20: 6f 69 64 20 73 71 6c 69 74 65 33 5f 72 65 73 75 oid sqlite3_resu
8a30: 6c 74 5f 69 6e 74 36 34 28 49 6e 74 50 74 72 20 lt_int64(IntPtr
8a40: 63 6f 6e 74 65 78 74 2c 20 6c 6f 6e 67 20 76 61 context, long va
8a50: 6c 75 65 29 3b 0d 0a 23 65 6c 73 65 0d 0a 20 20 lue);..#else..
8a60: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
8a70: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 20 20 20 20 69 ITE_DLL)].. i
8a80: 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 nternal static e
8a90: 78 74 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 xtern void sqlit
8aa0: 65 33 5f 72 65 73 75 6c 74 5f 69 6e 74 36 34 5f e3_result_int64_
8ab0: 69 6e 74 65 72 6f 70 28 49 6e 74 50 74 72 20 63 interop(IntPtr c
8ac0: 6f 6e 74 65 78 74 2c 20 72 65 66 20 49 6e 74 36 ontext, ref Int6
8ad0: 34 20 76 61 6c 75 65 29 3b 0d 0a 23 65 6e 64 69 4 value);..#endi
8ae0: 66 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f f....#if !PLATFO
8af0: 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
8b00: 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
8b10: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
8b20: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
8b30: 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
8b40: 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 ntion.Cdecl)]..#
8b50: 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d else.. [DllIm
8b60: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 port(SQLITE_DLL)
8b70: 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 ]..#endif.. i
8b80: 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 nternal static e
8b90: 78 74 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 xtern void sqlit
8ba0: 65 33 5f 72 65 73 75 6c 74 5f 6e 75 6c 6c 28 49 e3_result_null(I
8bb0: 6e 74 50 74 72 20 63 6f 6e 74 65 78 74 29 3b 0d ntPtr context);.
8bc0: 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d ...#if !PLATFORM
8bd0: 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 _COMPACTFRAMEWOR
8be0: 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 K.. [DllImpor
8bf0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 t(SQLITE_DLL, Ca
8c00: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 llingConvention
8c10: 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 = CallingConvent
8c20: 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c ion.Cdecl)]..#el
8c30: 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f se.. [DllImpo
8c40: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d rt(SQLITE_DLL)].
8c50: 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 .#endif.. int
8c60: 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 ernal static ext
8c70: 65 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 33 ern void sqlite3
8c80: 5f 72 65 73 75 6c 74 5f 74 65 78 74 28 49 6e 74 _result_text(Int
8c90: 50 74 72 20 63 6f 6e 74 65 78 74 2c 20 62 79 74 Ptr context, byt
8ca0: 65 5b 5d 20 76 61 6c 75 65 2c 20 69 6e 74 20 6e e[] value, int n
8cb0: 4c 65 6e 2c 20 49 6e 74 50 74 72 20 70 76 52 65 Len, IntPtr pvRe
8cc0: 73 65 72 76 65 64 29 3b 0d 0a 0d 0a 23 69 66 20 served);....#if
8cd0: 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
8ce0: 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
8cf0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
8d00: 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
8d10: 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
8d20: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
8d30: 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
8d40: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
8d50: 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
8d60: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
8d70: 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 tatic extern Int
8d80: 50 74 72 20 73 71 6c 69 74 65 33 5f 61 67 67 72 Ptr sqlite3_aggr
8d90: 65 67 61 74 65 5f 63 6f 6e 74 65 78 74 28 49 6e egate_context(In
8da0: 74 50 74 72 20 63 6f 6e 74 65 78 74 2c 20 69 6e tPtr context, in
8db0: 74 20 6e 42 79 74 65 73 29 3b 0d 0a 0d 0a 23 69 t nBytes);....#i
8dc0: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
8dd0: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
8de0: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
8df0: 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
8e00: 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
8e10: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
8e20: 64 65 63 6c 2c 20 43 68 61 72 53 65 74 20 3d 20 decl, CharSet =
8e30: 43 68 61 72 53 65 74 2e 55 6e 69 63 6f 64 65 29 CharSet.Unicode)
8e40: 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 ]..#else.. [D
8e50: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
8e60: 44 4c 4c 2c 20 43 68 61 72 53 65 74 20 3d 20 43 DLL, CharSet = C
8e70: 68 61 72 53 65 74 2e 55 6e 69 63 6f 64 65 29 5d harSet.Unicode)]
8e80: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
8e90: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
8ea0: 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 tern int sqlite3
8eb0: 5f 62 69 6e 64 5f 74 65 78 74 31 36 28 49 6e 74 _bind_text16(Int
8ec0: 50 74 72 20 73 74 6d 74 2c 20 69 6e 74 20 69 6e Ptr stmt, int in
8ed0: 64 65 78 2c 20 73 74 72 69 6e 67 20 76 61 6c 75 dex, string valu
8ee0: 65 2c 20 69 6e 74 20 6e 6c 65 6e 2c 20 49 6e 74 e, int nlen, Int
8ef0: 50 74 72 20 70 76 52 65 73 65 72 76 65 64 29 3b Ptr pvReserved);
8f00: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
8f10: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
8f20: 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
8f30: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
8f40: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
8f50: 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
8f60: 74 69 6f 6e 2e 43 64 65 63 6c 2c 20 43 68 61 72 tion.Cdecl, Char
8f70: 53 65 74 20 3d 20 43 68 61 72 53 65 74 2e 55 6e Set = CharSet.Un
8f80: 69 63 6f 64 65 29 5d 0d 0a 23 65 6c 73 65 0d 0a icode)]..#else..
8f90: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
8fa0: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 68 61 72 53 QLITE_DLL, CharS
8fb0: 65 74 20 3d 20 43 68 61 72 53 65 74 2e 55 6e 69 et = CharSet.Uni
8fc0: 63 6f 64 65 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a code)]..#endif..
8fd0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
8fe0: 74 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 20 tic extern void
8ff0: 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f 65 sqlite3_result_e
9000: 72 72 6f 72 31 36 28 49 6e 74 50 74 72 20 63 6f rror16(IntPtr co
9010: 6e 74 65 78 74 2c 20 73 74 72 69 6e 67 20 73 74 ntext, string st
9020: 72 4e 61 6d 65 2c 20 69 6e 74 20 6e 4c 65 6e 29 rName, int nLen)
9030: 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f ;....#if !PLATFO
9040: 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 RM_COMPACTFRAMEW
9050: 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 ORK.. [DllImp
9060: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 ort(SQLITE_DLL,
9070: 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f CallingConventio
9080: 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 n = CallingConve
9090: 6e 74 69 6f 6e 2e 43 64 65 63 6c 2c 20 43 68 61 ntion.Cdecl, Cha
90a0: 72 53 65 74 20 3d 20 43 68 61 72 53 65 74 2e 55 rSet = CharSet.U
90b0: 6e 69 63 6f 64 65 29 5d 0d 0a 23 65 6c 73 65 0d nicode)]..#else.
90c0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
90d0: 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 68 61 72 SQLITE_DLL, Char
90e0: 53 65 74 20 3d 20 43 68 61 72 53 65 74 2e 55 6e Set = CharSet.Un
90f0: 69 63 6f 64 65 29 5d 0d 0a 23 65 6e 64 69 66 0d icode)]..#endif.
9100: 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 . internal st
9110: 61 74 69 63 20 65 78 74 65 72 6e 20 76 6f 69 64 atic extern void
9120: 20 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f sqlite3_result_
9130: 74 65 78 74 31 36 28 49 6e 74 50 74 72 20 63 6f text16(IntPtr co
9140: 6e 74 65 78 74 2c 20 73 74 72 69 6e 67 20 73 74 ntext, string st
9150: 72 4e 61 6d 65 2c 20 69 6e 74 20 6e 4c 65 6e 2c rName, int nLen,
9160: 20 49 6e 74 50 74 72 20 70 76 52 65 73 65 72 76 IntPtr pvReserv
9170: 65 64 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 ed);....#if !PLA
9180: 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
9190: 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
91a0: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
91b0: 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
91c0: 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
91d0: 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
91e0: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c ..#else.. [Dl
91f0: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
9200: 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 LL)]..#endif..
9210: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
9220: 63 20 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c c extern int sql
9230: 69 74 65 33 5f 6b 65 79 28 49 6e 74 50 74 72 20 ite3_key(IntPtr
9240: 64 62 2c 20 62 79 74 65 5b 5d 20 6b 65 79 2c 20 db, byte[] key,
9250: 69 6e 74 20 6b 65 79 6c 65 6e 29 3b 0d 0a 0d 0a int keylen);....
9260: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
9270: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
9280: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
9290: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
92a0: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
92b0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
92c0: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
92d0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
92e0: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
92f0: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
9300: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
9310: 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 72 65 6b int sqlite3_rek
9320: 65 79 28 49 6e 74 50 74 72 20 64 62 2c 20 62 79 ey(IntPtr db, by
9330: 74 65 5b 5d 20 6b 65 79 2c 20 69 6e 74 20 6b 65 te[] key, int ke
9340: 79 6c 65 6e 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 ylen);....#if !P
9350: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
9360: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 RAMEWORK.. [D
9370: 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f llImport(SQLITE_
9380: 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 DLL, CallingConv
9390: 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 ention = Calling
93a0: 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c Convention.Cdecl
93b0: 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b )]..#else.. [
93c0: 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 DllImport(SQLITE
93d0: 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a _DLL)]..#endif..
93e0: 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 internal sta
93f0: 74 69 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 tic extern IntPt
9400: 72 20 73 71 6c 69 74 65 33 5f 75 70 64 61 74 65 r sqlite3_update
9410: 5f 68 6f 6f 6b 28 49 6e 74 50 74 72 20 64 62 2c _hook(IntPtr db,
9420: 20 53 51 4c 69 74 65 55 70 64 61 74 65 43 61 6c SQLiteUpdateCal
9430: 6c 62 61 63 6b 20 66 75 6e 63 2c 20 49 6e 74 50 lback func, IntP
9440: 74 72 20 70 76 55 73 65 72 29 3b 0d 0a 0d 0a 23 tr pvUser);....#
9450: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
9460: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
9470: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
9480: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
9490: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
94a0: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
94b0: 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
94c0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
94d0: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
94e0: 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
94f0: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
9500: 49 6e 74 50 74 72 20 73 71 6c 69 74 65 33 5f 63 IntPtr sqlite3_c
9510: 6f 6d 6d 69 74 5f 68 6f 6f 6b 28 49 6e 74 50 74 ommit_hook(IntPt
9520: 72 20 64 62 2c 20 53 51 4c 69 74 65 43 6f 6d 6d r db, SQLiteComm
9530: 69 74 43 61 6c 6c 62 61 63 6b 20 66 75 6e 63 2c itCallback func,
9540: 20 49 6e 74 50 74 72 20 70 76 55 73 65 72 29 3b IntPtr pvUser);
9550: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
9560: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
9570: 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
9580: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
9590: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
95a0: 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
95b0: 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
95c0: 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
95d0: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
95e0: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
95f0: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
9600: 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 tern IntPtr sqli
9610: 74 65 33 5f 74 72 61 63 65 28 49 6e 74 50 74 72 te3_trace(IntPtr
9620: 20 64 62 2c 20 53 51 4c 69 74 65 54 72 61 63 65 db, SQLiteTrace
9630: 43 61 6c 6c 62 61 63 6b 20 66 75 6e 63 2c 20 49 Callback func, I
9640: 6e 74 50 74 72 20 70 76 55 73 65 72 29 3b 0d 0a ntPtr pvUser);..
9650: 0d 0a 20 20 20 20 2f 2f 20 53 69 6e 63 65 20 73 .. // Since s
9660: 71 6c 69 74 65 33 5f 63 6f 6e 66 69 67 28 29 20 qlite3_config()
9670: 74 61 6b 65 73 20 61 20 76 61 72 69 61 62 6c 65 takes a variable
9680: 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 2c 20 argument list,
9690: 77 65 20 68 61 76 65 20 74 6f 20 6f 76 65 72 6c we have to overl
96a0: 6f 61 64 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 oad declarations
96b0: 0d 0a 20 20 20 20 2f 2f 20 66 6f 72 20 61 6c 6c .. // for all
96c0: 20 70 6f 73 73 69 62 6c 65 20 63 61 6c 6c 73 2e possible calls.
96d0: 20 20 46 6f 72 20 6e 6f 77 2c 20 77 65 20 61 72 For now, we ar
96e0: 65 20 6f 6e 6c 79 20 65 78 70 6f 73 69 6e 67 20 e only exposing
96f0: 74 68 65 20 53 51 4c 49 54 45 5f 43 4f 4e 46 49 the SQLITE_CONFI
9700: 47 5f 4c 4f 47 20 63 61 6c 6c 2e 0d 0a 23 69 66 G_LOG call...#if
9710: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
9720: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
9730: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
9740: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
9750: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
9760: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
9770: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
9780: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
9790: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
97a0: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
97b0: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e static extern in
97c0: 74 20 73 71 6c 69 74 65 33 5f 63 6f 6e 66 69 67 t sqlite3_config
97d0: 28 69 6e 74 20 6f 70 2c 20 53 51 4c 69 74 65 4c (int op, SQLiteL
97e0: 6f 67 43 61 6c 6c 62 61 63 6b 20 66 75 6e 63 2c ogCallback func,
97f0: 20 49 6e 74 50 74 72 20 70 76 55 73 65 72 29 3b IntPtr pvUser);
9800: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
9810: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
9820: 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
9830: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
9840: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
9850: 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
9860: 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
9870: 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
9880: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
9890: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
98a0: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
98b0: 74 65 72 6e 20 49 6e 74 50 74 72 20 73 71 6c 69 tern IntPtr sqli
98c0: 74 65 33 5f 72 6f 6c 6c 62 61 63 6b 5f 68 6f 6f te3_rollback_hoo
98d0: 6b 28 49 6e 74 50 74 72 20 64 62 2c 20 53 51 4c k(IntPtr db, SQL
98e0: 69 74 65 52 6f 6c 6c 62 61 63 6b 43 61 6c 6c 62 iteRollbackCallb
98f0: 61 63 6b 20 66 75 6e 63 2c 20 49 6e 74 50 74 72 ack func, IntPtr
9900: 20 70 76 55 73 65 72 29 3b 0d 0a 0d 0a 23 69 66 pvUser);....#if
9910: 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 !PLATFORM_COMPA
9920: 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 CTFRAMEWORK..
9930: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
9940: 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 TE_DLL, CallingC
9950: 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c onvention = Call
9960: 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 ingConvention.Cd
9970: 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 ecl)]..#else..
9980: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
9990: 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 ITE_DLL)]..#endi
99a0: 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 f.. internal
99b0: 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 49 6e static extern In
99c0: 74 50 74 72 20 73 71 6c 69 74 65 33 5f 64 62 5f tPtr sqlite3_db_
99d0: 68 61 6e 64 6c 65 28 49 6e 74 50 74 72 20 73 74 handle(IntPtr st
99e0: 6d 74 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 mt);....#if !PLA
99f0: 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 TFORM_COMPACTFRA
9a00: 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c MEWORK.. [Dll
9a10: 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c Import(SQLITE_DL
9a20: 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e L, CallingConven
9a30: 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f tion = CallingCo
9a40: 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d nvention.Cdecl)]
9a50: 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c ..#else.. [Dl
9a60: 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 lImport(SQLITE_D
9a70: 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 LL)]..#endif..
9a80: 20 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 internal stati
9a90: 63 20 65 78 74 65 72 6e 20 49 6e 74 50 74 72 20 c extern IntPtr
9aa0: 73 71 6c 69 74 65 33 5f 6e 65 78 74 5f 73 74 6d sqlite3_next_stm
9ab0: 74 28 49 6e 74 50 74 72 20 64 62 2c 20 49 6e 74 t(IntPtr db, Int
9ac0: 50 74 72 20 73 74 6d 74 29 3b 0d 0a 0d 0a 23 69 Ptr stmt);....#i
9ad0: 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 f !PLATFORM_COMP
9ae0: 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 ACTFRAMEWORK..
9af0: 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c [DllImport(SQL
9b00: 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 ITE_DLL, Calling
9b10: 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c Convention = Cal
9b20: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 lingConvention.C
9b30: 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 decl)]..#else..
9b40: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
9b50: 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 LITE_DLL)]..#end
9b60: 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c if.. internal
9b70: 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 static extern i
9b80: 6e 74 20 73 71 6c 69 74 65 33 5f 65 78 65 63 28 nt sqlite3_exec(
9b90: 49 6e 74 50 74 72 20 64 62 2c 20 62 79 74 65 5b IntPtr db, byte[
9ba0: 5d 20 73 74 72 53 71 6c 2c 20 49 6e 74 50 74 72 ] strSql, IntPtr
9bb0: 20 70 76 43 61 6c 6c 62 61 63 6b 2c 20 49 6e 74 pvCallback, Int
9bc0: 50 74 72 20 70 76 50 61 72 61 6d 2c 20 6f 75 74 Ptr pvParam, out
9bd0: 20 49 6e 74 50 74 72 20 65 72 72 4d 73 67 29 3b IntPtr errMsg);
9be0: 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 ....#if !PLATFOR
9bf0: 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f M_COMPACTFRAMEWO
9c00: 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f RK.. [DllImpo
9c10: 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 rt(SQLITE_DLL, C
9c20: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
9c30: 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e = CallingConven
9c40: 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 tion.Cdecl)]..#e
9c50: 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 lse.. [DllImp
9c60: 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d ort(SQLITE_DLL)]
9c70: 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e ..#endif.. in
9c80: 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 ternal static ex
9c90: 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 65 33 tern int sqlite3
9ca0: 5f 67 65 74 5f 61 75 74 6f 63 6f 6d 6d 69 74 28 _get_autocommit(
9cb0: 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 23 IntPtr db);....#
9cc0: 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d if !PLATFORM_COM
9cd0: 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 PACTFRAMEWORK..
9ce0: 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 [DllImport(SQ
9cf0: 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e LITE_DLL, Callin
9d00: 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 gConvention = Ca
9d10: 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e llingConvention.
9d20: 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a Cdecl)]..#else..
9d30: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
9d40: 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e QLITE_DLL)]..#en
9d50: 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 dif.. interna
9d60: 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e 20 l static extern
9d70: 69 6e 74 20 73 71 6c 69 74 65 33 5f 65 78 74 65 int sqlite3_exte
9d80: 6e 64 65 64 5f 72 65 73 75 6c 74 5f 63 6f 64 65 nded_result_code
9d90: 73 28 49 6e 74 50 74 72 20 64 62 2c 20 69 6e 74 s(IntPtr db, int
9da0: 20 6f 6e 6f 66 66 29 3b 0d 0a 0d 0a 23 69 66 20 onoff);....#if
9db0: 21 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 !PLATFORM_COMPAC
9dc0: 54 46 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 20 20 TFRAMEWORK..
9dd0: 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 54 [DllImport(SQLIT
9de0: 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 6e 67 43 6f E_DLL, CallingCo
9df0: 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 61 6c 6c 69 nvention = Calli
9e00: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 2e 43 64 65 ngConvention.Cde
9e10: 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 cl)]..#else..
9e20: 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 51 4c 49 [DllImport(SQLI
9e30: 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 6e 64 69 66 TE_DLL)]..#endif
9e40: 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 73 .. internal s
9e50: 74 61 74 69 63 20 65 78 74 65 72 6e 20 69 6e 74 tatic extern int
9e60: 20 73 71 6c 69 74 65 33 5f 65 72 72 63 6f 64 65 sqlite3_errcode
9e70: 28 49 6e 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a (IntPtr db);....
9e80: 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f 43 4f #if !PLATFORM_CO
9e90: 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b 0d 0a MPACTFRAMEWORK..
9ea0: 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 53 [DllImport(S
9eb0: 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c 6c 69 QLITE_DLL, Calli
9ec0: 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d 20 43 ngConvention = C
9ed0: 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e allingConvention
9ee0: 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 65 0d .Cdecl)]..#else.
9ef0: 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 28 . [DllImport(
9f00: 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a 23 65 SQLITE_DLL)]..#e
9f10: 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 72 6e ndif.. intern
9f20: 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 72 6e al static extern
9f30: 20 69 6e 74 20 73 71 6c 69 74 65 33 5f 65 78 74 int sqlite3_ext
9f40: 65 6e 64 65 64 5f 65 72 72 63 6f 64 65 28 49 6e ended_errcode(In
9f50: 74 50 74 72 20 64 62 29 3b 0d 0a 0d 0a 20 20 20 tPtr db);....
9f60: 20 2f 2f 20 53 69 6e 63 65 20 73 71 6c 69 74 65 // Since sqlite
9f70: 33 5f 6c 6f 67 28 29 20 74 61 6b 65 73 20 61 20 3_log() takes a
9f80: 76 61 72 69 61 62 6c 65 20 61 72 67 75 6d 65 6e variable argumen
9f90: 74 20 6c 69 73 74 2c 20 77 65 20 68 61 76 65 20 t list, we have
9fa0: 74 6f 20 6f 76 65 72 6c 6f 61 64 20 64 65 63 6c to overload decl
9fb0: 61 72 61 74 69 6f 6e 73 0d 0a 20 20 20 20 2f 2f arations.. //
9fc0: 20 66 6f 72 20 61 6c 6c 20 70 6f 73 73 69 62 6c for all possibl
9fd0: 65 20 63 61 6c 6c 73 2e 20 20 46 6f 72 20 6e 6f e calls. For no
9fe0: 77 2c 20 77 65 20 61 72 65 20 6f 6e 6c 79 20 65 w, we are only e
9ff0: 78 70 6f 73 69 6e 67 20 61 20 73 69 6e 67 6c 65 xposing a single
a000: 20 73 74 72 69 6e 67 2c 20 61 6e 64 20 0d 0a 20 string, and ..
a010: 20 20 20 2f 2f 20 64 65 70 65 6e 64 20 6f 6e 20 // depend on
a020: 74 68 65 20 63 61 6c 6c 65 72 20 74 6f 20 66 6f the caller to fo
a030: 72 6d 61 74 20 74 68 65 20 73 74 72 69 6e 67 2e rmat the string.
a040: 0d 0a 23 69 66 20 21 50 4c 41 54 46 4f 52 4d 5f ..#if !PLATFORM_
a050: 43 4f 4d 50 41 43 54 46 52 41 4d 45 57 4f 52 4b COMPACTFRAMEWORK
a060: 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 74 .. [DllImport
a070: 28 53 51 4c 49 54 45 5f 44 4c 4c 2c 20 43 61 6c (SQLITE_DLL, Cal
a080: 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 6f 6e 20 3d lingConvention =
a090: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
a0a0: 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a 23 65 6c 73 on.Cdecl)]..#els
a0b0: 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d 70 6f 72 e.. [DllImpor
a0c0: 74 28 53 51 4c 49 54 45 5f 44 4c 4c 29 5d 0d 0a t(SQLITE_DLL)]..
a0d0: 23 65 6e 64 69 66 0d 0a 20 20 20 20 69 6e 74 65 #endif.. inte
a0e0: 72 6e 61 6c 20 73 74 61 74 69 63 20 65 78 74 65 rnal static exte
a0f0: 72 6e 20 76 6f 69 64 20 73 71 6c 69 74 65 33 5f rn void sqlite3_
a100: 6c 6f 67 28 69 6e 74 20 69 45 72 72 43 6f 64 65 log(int iErrCode
a110: 2c 20 62 79 74 65 5b 5d 20 7a 46 6f 72 6d 61 74 , byte[] zFormat
a120: 29 3b 0d 0a 0d 0a 23 69 66 20 21 50 4c 41 54 46 );....#if !PLATF
a130: 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
a140: 57 4f 52 4b 0d 0a 20 20 20 20 5b 44 6c 6c 49 6d WORK.. [DllIm
a150: 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c 2c port(SQLITE_DLL,
a160: 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 65 6e 74 69 CallingConventi
a170: 6f 6e 20 3d 20 43 61 6c 6c 69 6e 67 43 6f 6e 76 on = CallingConv
a180: 65 6e 74 69 6f 6e 2e 43 64 65 63 6c 29 5d 0d 0a ention.Cdecl)]..
a190: 23 65 6c 73 65 0d 0a 20 20 20 20 5b 44 6c 6c 49 #else.. [DllI
a1a0: 6d 70 6f 72 74 28 53 51 4c 49 54 45 5f 44 4c 4c mport(SQLITE_DLL
a1b0: 29 5d 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 20 20 )]..#endif..
a1c0: 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 69 63 20 internal static
a1d0: 65 78 74 65 72 6e 20 69 6e 74 20 73 71 6c 69 74 extern int sqlit
a1e0: 65 33 5f 66 69 6c 65 5f 63 6f 6e 74 72 6f 6c 28 e3_file_control(
a1f0: 49 6e 74 50 74 72 20 64 62 2c 20 62 79 74 65 5b IntPtr db, byte[
a200: 5d 20 7a 44 62 4e 61 6d 65 2c 20 69 6e 74 20 6f ] zDbName, int o
a210: 70 2c 20 49 6e 74 50 74 72 20 70 41 72 67 29 3b p, IntPtr pArg);
a220: 0d 0a 0d 0a 20 20 20 20 23 65 6e 64 72 65 67 69 .... #endregi
a230: 6f 6e 0d 0a 20 20 7d 0d 0a 0d 0a 23 69 66 20 50 on.. }....#if P
a240: 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 LATFORM_COMPACTF
a250: 52 41 4d 45 57 4f 52 4b 0d 0a 20 20 69 6e 74 65 RAMEWORK.. inte
a260: 72 6e 61 6c 20 61 62 73 74 72 61 63 74 20 63 6c rnal abstract cl
a270: 61 73 73 20 43 72 69 74 69 63 61 6c 48 61 6e 64 ass CriticalHand
a280: 6c 65 20 3a 20 49 44 69 73 70 6f 73 61 62 6c 65 le : IDisposable
a290: 0d 0a 20 20 7b 0d 0a 20 20 20 20 70 72 69 76 61 .. {.. priva
a2a0: 74 65 20 62 6f 6f 6c 20 5f 69 73 43 6c 6f 73 65 te bool _isClose
a2b0: 64 3b 0d 0a 20 20 20 20 70 72 6f 74 65 63 74 65 d;.. protecte
a2c0: 64 20 49 6e 74 50 74 72 20 68 61 6e 64 6c 65 3b d IntPtr handle;
a2d0: 0d 0a 20 20 20 20 0d 0a 20 20 20 20 70 72 6f 74 .. .. prot
a2e0: 65 63 74 65 64 20 43 72 69 74 69 63 61 6c 48 61 ected CriticalHa
a2f0: 6e 64 6c 65 28 49 6e 74 50 74 72 20 69 6e 76 61 ndle(IntPtr inva
a300: 6c 69 64 48 61 6e 64 6c 65 56 61 6c 75 65 29 0d lidHandleValue).
a310: 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 68 61 . {.. ha
a320: 6e 64 6c 65 20 3d 20 69 6e 76 61 6c 69 64 48 61 ndle = invalidHa
a330: 6e 64 6c 65 56 61 6c 75 65 3b 0d 0a 20 20 20 20 ndleValue;..
a340: 20 20 5f 69 73 43 6c 6f 73 65 64 20 3d 20 66 61 _isClosed = fa
a350: 6c 73 65 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 lse;.. }....
a360: 20 20 20 7e 43 72 69 74 69 63 61 6c 48 61 6e 64 ~CriticalHand
a370: 6c 65 28 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 le().. {..
a380: 20 20 20 44 69 73 70 6f 73 65 28 66 61 6c 73 65 Dispose(false
a390: 29 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 );.. }....
a3a0: 20 70 72 69 76 61 74 65 20 76 6f 69 64 20 43 6c private void Cl
a3b0: 65 61 6e 75 70 28 29 0d 0a 20 20 20 20 7b 0d 0a eanup().. {..
a3c0: 20 20 20 20 20 20 69 66 20 28 21 49 73 43 6c 6f if (!IsClo
a3d0: 73 65 64 29 0d 0a 20 20 20 20 20 20 7b 0d 0a 20 sed).. {..
a3e0: 20 20 20 20 20 20 20 74 68 69 73 2e 5f 69 73 43 this._isC
a3f0: 6c 6f 73 65 64 20 3d 20 74 72 75 65 3b 0d 0a 20 losed = true;..
a400: 20 20 20 20 20 20 20 69 66 20 28 21 49 73 49 6e if (!IsIn
a410: 76 61 6c 69 64 29 0d 0a 20 20 20 20 20 20 20 20 valid)..
a420: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 52 65 6c {.. Rel
a430: 65 61 73 65 48 61 6e 64 6c 65 28 29 3b 0d 0a 20 easeHandle();..
a440: 20 20 20 20 20 20 20 20 20 47 43 2e 53 75 70 70 GC.Supp
a450: 72 65 73 73 46 69 6e 61 6c 69 7a 65 28 74 68 69 ressFinalize(thi
a460: 73 29 3b 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a s);.. }..
a470: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
a480: 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 76 6f 69 .. public voi
a490: 64 20 43 6c 6f 73 65 28 29 0d 0a 20 20 20 20 7b d Close().. {
a4a0: 0d 0a 20 20 20 20 20 20 44 69 73 70 6f 73 65 28 .. Dispose(
a4b0: 74 72 75 65 29 3b 0d 0a 20 20 20 20 7d 0d 0a 0d true);.. }...
a4c0: 0a 20 20 20 20 70 75 62 6c 69 63 20 76 6f 69 64 . public void
a4d0: 20 44 69 73 70 6f 73 65 28 29 0d 0a 20 20 20 20 Dispose()..
a4e0: 7b 0d 0a 20 20 20 20 20 20 44 69 73 70 6f 73 65 {.. Dispose
a4f0: 28 74 72 75 65 29 3b 0d 0a 20 20 20 20 7d 0d 0a (true);.. }..
a500: 0d 0a 20 20 20 20 70 72 6f 74 65 63 74 65 64 20 .. protected
a510: 76 69 72 74 75 61 6c 20 76 6f 69 64 20 44 69 73 virtual void Dis
a520: 70 6f 73 65 28 62 6f 6f 6c 20 64 69 73 70 6f 73 pose(bool dispos
a530: 69 6e 67 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 ing).. {..
a540: 20 20 20 43 6c 65 61 6e 75 70 28 29 3b 0d 0a 20 Cleanup();..
a550: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 72 6f 74 }.... prot
a560: 65 63 74 65 64 20 61 62 73 74 72 61 63 74 20 62 ected abstract b
a570: 6f 6f 6c 20 52 65 6c 65 61 73 65 48 61 6e 64 6c ool ReleaseHandl
a580: 65 28 29 3b 0d 0a 0d 0a 20 20 20 20 70 72 6f 74 e();.... prot
a590: 65 63 74 65 64 20 76 6f 69 64 20 53 65 74 48 61 ected void SetHa
a5a0: 6e 64 6c 65 28 49 6e 74 50 74 72 20 76 61 6c 75 ndle(IntPtr valu
a5b0: 65 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 e).. {..
a5c0: 20 68 61 6e 64 6c 65 20 3d 20 76 61 6c 75 65 3b handle = value;
a5d0: 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 .. }.... p
a5e0: 75 62 6c 69 63 20 76 6f 69 64 20 53 65 74 48 61 ublic void SetHa
a5f0: 6e 64 6c 65 41 73 49 6e 76 61 6c 69 64 28 29 0d ndleAsInvalid().
a600: 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 5f 69 . {.. _i
a610: 73 43 6c 6f 73 65 64 20 3d 20 74 72 75 65 3b 0d sClosed = true;.
a620: 0a 20 20 20 20 20 20 47 43 2e 53 75 70 70 72 65 . GC.Suppre
a630: 73 73 46 69 6e 61 6c 69 7a 65 28 74 68 69 73 29 ssFinalize(this)
a640: 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 ;.. }....
a650: 70 75 62 6c 69 63 20 62 6f 6f 6c 20 49 73 43 6c public bool IsCl
a660: 6f 73 65 64 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 osed.. {..
a670: 20 20 20 67 65 74 20 7b 20 72 65 74 75 72 6e 20 get { return
a680: 5f 69 73 43 6c 6f 73 65 64 3b 20 7d 0d 0a 20 20 _isClosed; }..
a690: 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 75 62 6c 69 }.... publi
a6a0: 63 20 61 62 73 74 72 61 63 74 20 62 6f 6f 6c 20 c abstract bool
a6b0: 49 73 49 6e 76 61 6c 69 64 0d 0a 20 20 20 20 7b IsInvalid.. {
a6c0: 0d 0a 20 20 20 20 20 20 67 65 74 3b 0d 0a 20 20 .. get;..
a6d0: 20 20 7d 0d 0a 0d 0a 20 20 7d 0d 0a 0d 0a 23 65 }.... }....#e
a6e0: 6e 64 69 66 0d 0a 0d 0a 20 20 2f 2f 20 48 61 6e ndif.... // Han
a6f0: 64 6c 65 73 20 74 68 65 20 75 6e 6d 61 6e 61 67 dles the unmanag
a700: 65 64 20 64 61 74 61 62 61 73 65 20 70 6f 69 6e ed database poin
a710: 74 65 72 2c 20 61 6e 64 20 70 72 6f 76 69 64 65 ter, and provide
a720: 73 20 66 69 6e 61 6c 69 7a 61 74 69 6f 6e 20 73 s finalization s
a730: 75 70 70 6f 72 74 20 66 6f 72 20 69 74 2e 0d 0a upport for it...
a740: 20 20 69 6e 74 65 72 6e 61 6c 20 63 6c 61 73 73 internal class
a750: 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f SQLiteConnectio
a760: 6e 48 61 6e 64 6c 65 20 3a 20 43 72 69 74 69 63 nHandle : Critic
a770: 61 6c 48 61 6e 64 6c 65 0d 0a 20 20 7b 0d 0a 20 alHandle.. {..
a780: 20 20 20 70 75 62 6c 69 63 20 73 74 61 74 69 63 public static
a790: 20 69 6d 70 6c 69 63 69 74 20 6f 70 65 72 61 74 implicit operat
a7a0: 6f 72 20 49 6e 74 50 74 72 28 53 51 4c 69 74 65 or IntPtr(SQLite
a7b0: 43 6f 6e 6e 65 63 74 69 6f 6e 48 61 6e 64 6c 65 ConnectionHandle
a7c0: 20 64 62 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 db).. {..
a7d0: 20 20 20 72 65 74 75 72 6e 20 28 64 62 20 21 3d return (db !=
a7e0: 20 6e 75 6c 6c 29 20 3f 20 64 62 2e 68 61 6e 64 null) ? db.hand
a7f0: 6c 65 20 3a 20 49 6e 74 50 74 72 2e 5a 65 72 6f le : IntPtr.Zero
a800: 3b 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 ;.. }....
a810: 70 75 62 6c 69 63 20 73 74 61 74 69 63 20 69 6d public static im
a820: 70 6c 69 63 69 74 20 6f 70 65 72 61 74 6f 72 20 plicit operator
a830: 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e SQLiteConnection
a840: 48 61 6e 64 6c 65 28 49 6e 74 50 74 72 20 64 62 Handle(IntPtr db
a850: 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 ).. {..
a860: 72 65 74 75 72 6e 20 6e 65 77 20 53 51 4c 69 74 return new SQLit
a870: 65 43 6f 6e 6e 65 63 74 69 6f 6e 48 61 6e 64 6c eConnectionHandl
a880: 65 28 64 62 29 3b 0d 0a 20 20 20 20 7d 0d 0a 0d e(db);.. }...
a890: 0a 20 20 20 20 70 72 69 76 61 74 65 20 53 51 4c . private SQL
a8a0: 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 48 61 6e iteConnectionHan
a8b0: 64 6c 65 28 49 6e 74 50 74 72 20 64 62 29 0d 0a dle(IntPtr db)..
a8c0: 20 20 20 20 20 20 3a 20 74 68 69 73 28 29 0d 0a : this()..
a8d0: 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 53 65 74 {.. Set
a8e0: 48 61 6e 64 6c 65 28 64 62 29 3b 0d 0a 20 20 20 Handle(db);..
a8f0: 20 7d 0d 0a 0d 0a 20 20 20 20 69 6e 74 65 72 6e }.... intern
a900: 61 6c 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 al SQLiteConnect
a910: 69 6f 6e 48 61 6e 64 6c 65 28 29 0d 0a 20 20 20 ionHandle()..
a920: 20 20 20 3a 20 62 61 73 65 28 49 6e 74 50 74 72 : base(IntPtr
a930: 2e 5a 65 72 6f 29 0d 0a 20 20 20 20 7b 0d 0a 20 .Zero).. {..
a940: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 72 6f 74 }.... prot
a950: 65 63 74 65 64 20 6f 76 65 72 72 69 64 65 20 62 ected override b
a960: 6f 6f 6c 20 52 65 6c 65 61 73 65 48 61 6e 64 6c ool ReleaseHandl
a970: 65 28 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 e().. {..
a980: 20 20 74 72 79 0d 0a 20 20 20 20 20 20 7b 0d 0a try.. {..
a990: 20 20 20 20 20 20 20 20 53 51 4c 69 74 65 42 61 SQLiteBa
a9a0: 73 65 2e 43 6c 6f 73 65 43 6f 6e 6e 65 63 74 69 se.CloseConnecti
a9b0: 6f 6e 28 74 68 69 73 29 3b 0d 0a 0d 0a 23 69 66 on(this);....#if
a9c0: 20 44 45 42 55 47 0d 0a 20 20 20 20 20 20 20 20 DEBUG..
a9d0: 74 72 79 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a try.. {..
a9e0: 20 20 20 20 20 20 20 20 20 20 54 72 61 63 65 2e Trace.
a9f0: 57 72 69 74 65 4c 69 6e 65 28 53 74 72 69 6e 67 WriteLine(String
aa00: 2e 46 6f 72 6d 61 74 28 0d 0a 20 20 20 20 20 20 .Format(..
aa10: 20 20 20 20 20 20 20 20 22 43 6c 6f 73 65 43 6f "CloseCo
aa20: 6e 6e 65 63 74 69 6f 6e 3a 20 7b 30 7d 22 2c 20 nnection: {0}",
aa30: 68 61 6e 64 6c 65 29 29 3b 0d 0a 20 20 20 20 20 handle));..
aa40: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 63 61 }.. ca
aa50: 74 63 68 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a tch.. {..
aa60: 20 20 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 }..#endi
aa70: 66 0d 0a 0d 0a 23 69 66 20 44 45 42 55 47 0d 0a f....#if DEBUG..
aa80: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 return t
aa90: 72 75 65 3b 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 rue;..#endif..
aaa0: 20 20 20 20 7d 0d 0a 23 69 66 20 44 45 42 55 47 }..#if DEBUG
aab0: 0d 0a 20 20 20 20 20 20 63 61 74 63 68 20 28 53 .. catch (S
aac0: 51 4c 69 74 65 45 78 63 65 70 74 69 6f 6e 20 65 QLiteException e
aad0: 29 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 20 20 )..#else..
aae0: 63 61 74 63 68 20 28 53 51 4c 69 74 65 45 78 63 catch (SQLiteExc
aaf0: 65 70 74 69 6f 6e 29 0d 0a 23 65 6e 64 69 66 0d eption)..#endif.
ab00: 0a 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 44 45 . {..#if DE
ab10: 42 55 47 0d 0a 20 20 20 20 20 20 20 20 74 72 79 BUG.. try
ab20: 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 .. {..
ab30: 20 20 20 20 20 20 20 54 72 61 63 65 2e 57 72 69 Trace.Wri
ab40: 74 65 4c 69 6e 65 28 53 74 72 69 6e 67 2e 46 6f teLine(String.Fo
ab50: 72 6d 61 74 28 0d 0a 20 20 20 20 20 20 20 20 20 rmat(..
ab60: 20 20 20 20 20 22 43 6c 6f 73 65 43 6f 6e 6e 65 "CloseConne
ab70: 63 74 69 6f 6e 3a 20 7b 30 7d 2c 20 65 78 63 65 ction: {0}, exce
ab80: 70 74 69 6f 6e 3a 20 7b 31 7d 22 2c 0d 0a 20 20 ption: {1}",..
ab90: 20 20 20 20 20 20 20 20 20 20 20 20 68 61 6e 64 hand
aba0: 6c 65 2c 20 65 29 29 3b 0d 0a 20 20 20 20 20 20 le, e));..
abb0: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 63 61 74 }.. cat
abc0: 63 68 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 ch.. {..
abd0: 20 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 66 }..#endif
abe0: 0d 0a 20 20 20 20 20 20 7d 0d 0a 23 69 66 20 44 .. }..#if D
abf0: 45 42 55 47 0d 0a 20 20 20 20 20 20 72 65 74 75 EBUG.. retu
ac00: 72 6e 20 66 61 6c 73 65 3b 0d 0a 23 65 6c 73 65 rn false;..#else
ac10: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 .. return t
ac20: 72 75 65 3b 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 rue;..#endif..
ac30: 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 75 62 6c 69 }.... publi
ac40: 63 20 6f 76 65 72 72 69 64 65 20 62 6f 6f 6c 20 c override bool
ac50: 49 73 49 6e 76 61 6c 69 64 0d 0a 20 20 20 20 7b IsInvalid.. {
ac60: 0d 0a 20 20 20 20 20 20 67 65 74 20 7b 20 72 65 .. get { re
ac70: 74 75 72 6e 20 28 68 61 6e 64 6c 65 20 3d 3d 20 turn (handle ==
ac80: 49 6e 74 50 74 72 2e 5a 65 72 6f 29 3b 20 7d 0d IntPtr.Zero); }.
ac90: 0a 20 20 20 20 7d 0d 0a 20 20 7d 0d 0a 0d 0a 20 . }.. }....
aca0: 20 2f 2f 20 50 72 6f 76 69 64 65 73 20 66 69 6e // Provides fin
acb0: 61 6c 69 7a 61 74 69 6f 6e 20 73 75 70 70 6f 72 alization suppor
acc0: 74 20 66 6f 72 20 75 6e 6d 61 6e 61 67 65 64 20 t for unmanaged
acd0: 53 51 4c 69 74 65 20 73 74 61 74 65 6d 65 6e 74 SQLite statement
ace0: 73 2e 0d 0a 20 20 69 6e 74 65 72 6e 61 6c 20 63 s... internal c
acf0: 6c 61 73 73 20 53 51 4c 69 74 65 53 74 61 74 65 lass SQLiteState
ad00: 6d 65 6e 74 48 61 6e 64 6c 65 20 3a 20 43 72 69 mentHandle : Cri
ad10: 74 69 63 61 6c 48 61 6e 64 6c 65 0d 0a 20 20 7b ticalHandle.. {
ad20: 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 73 74 61 .. public sta
ad30: 74 69 63 20 69 6d 70 6c 69 63 69 74 20 6f 70 65 tic implicit ope
ad40: 72 61 74 6f 72 20 49 6e 74 50 74 72 28 53 51 4c rator IntPtr(SQL
ad50: 69 74 65 53 74 61 74 65 6d 65 6e 74 48 61 6e 64 iteStatementHand
ad60: 6c 65 20 73 74 6d 74 29 0d 0a 20 20 20 20 7b 0d le stmt).. {.
ad70: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 28 73 . return (s
ad80: 74 6d 74 20 21 3d 20 6e 75 6c 6c 29 20 3f 20 73 tmt != null) ? s
ad90: 74 6d 74 2e 68 61 6e 64 6c 65 20 3a 20 49 6e 74 tmt.handle : Int
ada0: 50 74 72 2e 5a 65 72 6f 3b 0d 0a 20 20 20 20 7d Ptr.Zero;.. }
adb0: 0d 0a 0d 0a 20 20 20 20 70 75 62 6c 69 63 20 73 .... public s
adc0: 74 61 74 69 63 20 69 6d 70 6c 69 63 69 74 20 6f tatic implicit o
add0: 70 65 72 61 74 6f 72 20 53 51 4c 69 74 65 53 74 perator SQLiteSt
ade0: 61 74 65 6d 65 6e 74 48 61 6e 64 6c 65 28 49 6e atementHandle(In
adf0: 74 50 74 72 20 73 74 6d 74 29 0d 0a 20 20 20 20 tPtr stmt)..
ae00: 7b 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 {.. return
ae10: 6e 65 77 20 53 51 4c 69 74 65 53 74 61 74 65 6d new SQLiteStatem
ae20: 65 6e 74 48 61 6e 64 6c 65 28 73 74 6d 74 29 3b entHandle(stmt);
ae30: 0d 0a 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 .. }.... p
ae40: 72 69 76 61 74 65 20 53 51 4c 69 74 65 53 74 61 rivate SQLiteSta
ae50: 74 65 6d 65 6e 74 48 61 6e 64 6c 65 28 49 6e 74 tementHandle(Int
ae60: 50 74 72 20 73 74 6d 74 29 0d 0a 20 20 20 20 20 Ptr stmt)..
ae70: 20 3a 20 74 68 69 73 28 29 0d 0a 20 20 20 20 7b : this().. {
ae80: 0d 0a 20 20 20 20 20 20 53 65 74 48 61 6e 64 6c .. SetHandl
ae90: 65 28 73 74 6d 74 29 3b 0d 0a 20 20 20 20 7d 0d e(stmt);.. }.
aea0: 0a 0d 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 20 ... internal
aeb0: 53 51 4c 69 74 65 53 74 61 74 65 6d 65 6e 74 48 SQLiteStatementH
aec0: 61 6e 64 6c 65 28 29 0d 0a 20 20 20 20 20 20 3a andle().. :
aed0: 20 62 61 73 65 28 49 6e 74 50 74 72 2e 5a 65 72 base(IntPtr.Zer
aee0: 6f 29 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 7d o).. {.. }
aef0: 0d 0a 0d 0a 20 20 20 20 70 72 6f 74 65 63 74 65 .... protecte
af00: 64 20 6f 76 65 72 72 69 64 65 20 62 6f 6f 6c 20 d override bool
af10: 52 65 6c 65 61 73 65 48 61 6e 64 6c 65 28 29 0d ReleaseHandle().
af20: 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 74 72 . {.. tr
af30: 79 0d 0a 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 y.. {..
af40: 20 20 20 20 53 51 4c 69 74 65 42 61 73 65 2e 46 SQLiteBase.F
af50: 69 6e 61 6c 69 7a 65 53 74 61 74 65 6d 65 6e 74 inalizeStatement
af60: 28 74 68 69 73 29 3b 0d 0a 0d 0a 23 69 66 20 44 (this);....#if D
af70: 45 42 55 47 0d 0a 20 20 20 20 20 20 20 20 74 72 EBUG.. tr
af80: 79 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 y.. {..
af90: 20 20 20 20 20 20 20 20 54 72 61 63 65 2e 57 72 Trace.Wr
afa0: 69 74 65 4c 69 6e 65 28 53 74 72 69 6e 67 2e 46 iteLine(String.F
afb0: 6f 72 6d 61 74 28 0d 0a 20 20 20 20 20 20 20 20 ormat(..
afc0: 20 20 20 20 20 20 22 46 69 6e 61 6c 69 7a 65 53 "FinalizeS
afd0: 74 61 74 65 6d 65 6e 74 3a 20 7b 30 7d 22 2c 20 tatement: {0}",
afe0: 68 61 6e 64 6c 65 29 29 3b 0d 0a 20 20 20 20 20 handle));..
aff0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 63 61 }.. ca
b000: 74 63 68 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a tch.. {..
b010: 20 20 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 69 }..#endi
b020: 66 0d 0a 0d 0a 23 69 66 20 44 45 42 55 47 0d 0a f....#if DEBUG..
b030: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 return t
b040: 72 75 65 3b 0d 0a 23 65 6e 64 69 66 0d 0a 20 20 rue;..#endif..
b050: 20 20 20 20 7d 0d 0a 23 69 66 20 44 45 42 55 47 }..#if DEBUG
b060: 0d 0a 20 20 20 20 20 20 63 61 74 63 68 20 28 53 .. catch (S
b070: 51 4c 69 74 65 45 78 63 65 70 74 69 6f 6e 20 65 QLiteException e
b080: 29 0d 0a 23 65 6c 73 65 0d 0a 20 20 20 20 20 20 )..#else..
b090: 63 61 74 63 68 20 28 53 51 4c 69 74 65 45 78 63 catch (SQLiteExc
b0a0: 65 70 74 69 6f 6e 29 0d 0a 23 65 6e 64 69 66 0d eption)..#endif.
b0b0: 0a 20 20 20 20 20 20 7b 0d 0a 23 69 66 20 44 45 . {..#if DE
b0c0: 42 55 47 0d 0a 20 20 20 20 20 20 20 20 74 72 79 BUG.. try
b0d0: 0d 0a 20 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 .. {..
b0e0: 20 20 20 20 20 20 20 54 72 61 63 65 2e 57 72 69 Trace.Wri
b0f0: 74 65 4c 69 6e 65 28 53 74 72 69 6e 67 2e 46 6f teLine(String.Fo
b100: 72 6d 61 74 28 0d 0a 20 20 20 20 20 20 20 20 20 rmat(..
b110: 20 20 20 20 20 22 46 69 6e 61 6c 69 7a 65 53 74 "FinalizeSt
b120: 61 74 65 6d 65 6e 74 3a 20 7b 30 7d 2c 20 65 78 atement: {0}, ex
b130: 63 65 70 74 69 6f 6e 3a 20 7b 31 7d 22 2c 0d 0a ception: {1}",..
b140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 68 61 ha
b150: 6e 64 6c 65 2c 20 65 29 29 3b 0d 0a 20 20 20 20 ndle, e));..
b160: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 63 }.. c
b170: 61 74 63 68 0d 0a 20 20 20 20 20 20 20 20 7b 0d atch.. {.
b180: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 23 65 6e 64 . }..#end
b190: 69 66 0d 0a 20 20 20 20 20 20 7d 0d 0a 23 69 66 if.. }..#if
b1a0: 20 44 45 42 55 47 0d 0a 20 20 20 20 20 20 72 65 DEBUG.. re
b1b0: 74 75 72 6e 20 66 61 6c 73 65 3b 0d 0a 23 65 6c turn false;..#el
b1c0: 73 65 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e se.. return
b1d0: 20 74 72 75 65 3b 0d 0a 23 65 6e 64 69 66 0d 0a true;..#endif..
b1e0: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 70 75 62 }.... pub
b1f0: 6c 69 63 20 6f 76 65 72 72 69 64 65 20 62 6f 6f lic override boo
b200: 6c 20 49 73 49 6e 76 61 6c 69 64 0d 0a 20 20 20 l IsInvalid..
b210: 20 7b 0d 0a 20 20 20 20 20 20 67 65 74 20 7b 20 {.. get {
b220: 72 65 74 75 72 6e 20 28 68 61 6e 64 6c 65 20 3d return (handle =
b230: 3d 20 49 6e 74 50 74 72 2e 5a 65 72 6f 29 3b 20 = IntPtr.Zero);
b240: 7d 0d 0a 20 20 20 20 7d 0d 0a 20 20 7d 0d 0a 7d }.. }.. }..}
b250: 0d 0a ..