wasCSharpSQLite – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System; |
2 | using System.Diagnostics; |
||
3 | using System.Text; |
||
4 | |||
5 | namespace Community.CsharpSqlite |
||
6 | { |
||
7 | using sqlite3_value = Sqlite3.Mem; |
||
8 | |||
9 | public partial class Sqlite3 |
||
10 | { |
||
11 | /* |
||
12 | ** 2008 June 13 |
||
13 | ** |
||
14 | ** The author disclaims copyright to this source code. In place of |
||
15 | ** a legal notice, here is a blessing: |
||
16 | ** |
||
17 | ** May you do good and not evil. |
||
18 | ** May you find forgiveness for yourself and forgive others. |
||
19 | ** May you share freely, never taking more than you give. |
||
20 | ** |
||
21 | ************************************************************************* |
||
22 | ** |
||
23 | ** This file contains definitions of global variables and contants. |
||
24 | ************************************************************************* |
||
25 | ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart |
||
26 | ** C#-SQLite is an independent reimplementation of the SQLite software library |
||
27 | ** |
||
28 | ** SQLITE_SOURCE_ID: 2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2 |
||
29 | ** |
||
30 | ************************************************************************* |
||
31 | */ |
||
32 | //#include "sqliteInt.h" |
||
33 | |||
34 | |||
35 | /* An array to map all upper-case characters into their corresponding |
||
36 | ** lower-case character. |
||
37 | ** |
||
38 | ** SQLite only considers US-ASCII (or EBCDIC) characters. We do not |
||
39 | ** handle case conversions for the UTF character set since the tables |
||
40 | ** involved are nearly as big or bigger than SQLite itself. |
||
41 | */ |
||
42 | /* An array to map all upper-case characters into their corresponding |
||
43 | ** lower-case character. |
||
44 | */ |
||
45 | // |
||
46 | // Replaced in C# with sqlite3UpperToLower class |
||
47 | // static int[] sqlite3UpperToLower = new int[] { |
||
48 | //#if SQLITE_ASCII |
||
49 | //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, |
||
50 | //18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
||
51 | //36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
||
52 | //54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99,100,101,102,103, |
||
53 | //104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121, |
||
54 | //122, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107, |
||
55 | //108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125, |
||
56 | //126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, |
||
57 | //144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161, |
||
58 | //162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179, |
||
59 | //180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197, |
||
60 | //198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215, |
||
61 | //216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233, |
||
62 | //234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251, |
||
63 | //252,253,254,255 |
||
64 | //#endif |
||
65 | //#if SQLITE_EBCDIC |
||
66 | //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 0x */ |
||
67 | //16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 1x */ |
||
68 | //32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 2x */ |
||
69 | //48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 3x */ |
||
70 | //64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, /* 4x */ |
||
71 | //80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 5x */ |
||
72 | //96, 97, 66, 67, 68, 69, 70, 71, 72, 73,106,107,108,109,110,111, /* 6x */ |
||
73 | //112, 81, 82, 83, 84, 85, 86, 87, 88, 89,122,123,124,125,126,127, /* 7x */ |
||
74 | //128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, /* 8x */ |
||
75 | //144,145,146,147,148,149,150,151,152,153,154,155,156,157,156,159, /* 9x */ |
||
76 | //160,161,162,163,164,165,166,167,168,169,170,171,140,141,142,175, /* Ax */ |
||
77 | //176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, /* Bx */ |
||
78 | //192,129,130,131,132,133,134,135,136,137,202,203,204,205,206,207, /* Cx */ |
||
79 | //208,145,146,147,148,149,150,151,152,153,218,219,220,221,222,223, /* Dx */ |
||
80 | //224,225,162,163,164,165,166,167,168,169,232,203,204,205,206,207, /* Ex */ |
||
81 | //239,240,241,242,243,244,245,246,247,248,249,219,220,221,222,255, /* Fx */ |
||
82 | //#endif |
||
83 | //}; |
||
84 | |||
85 | /* |
||
86 | ** The following 256 byte lookup table is used to support SQLites built-in |
||
87 | ** equivalents to the following standard library functions: |
||
88 | ** |
||
89 | ** isspace() 0x01 |
||
90 | ** isalpha() 0x02 |
||
91 | ** isdigit() 0x04 |
||
92 | ** isalnum() 0x06 |
||
93 | ** isxdigit() 0x08 |
||
94 | ** toupper() 0x20 |
||
95 | ** SQLite identifier character 0x40 |
||
96 | ** |
||
97 | ** Bit 0x20 is set if the mapped character requires translation to upper |
||
98 | ** case. i.e. if the character is a lower-case ASCII character. |
||
99 | ** If x is a lower-case ASCII character, then its upper-case equivalent |
||
100 | ** is (x - 0x20). Therefore toupper() can be implemented as: |
||
101 | ** |
||
102 | ** (x & ~(map[x]&0x20)) |
||
103 | ** |
||
104 | ** Standard function tolower() is implemented using the sqlite3UpperToLower[] |
||
105 | ** array. tolower() is used more often than toupper() by SQLite. |
||
106 | ** |
||
107 | ** Bit 0x40 is set if the character non-alphanumeric and can be used in an |
||
108 | ** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any |
||
109 | ** non-ASCII UTF character. Hence the test for whether or not a character is |
||
110 | ** part of an identifier is 0x46. |
||
111 | ** |
||
112 | ** SQLite's versions are identical to the standard versions assuming a |
||
113 | ** locale of "C". They are implemented as macros in sqliteInt.h. |
||
114 | */ |
||
115 | #if SQLITE_ASCII |
||
116 | static byte[] sqlite3CtypeMap = new byte[] { |
||
117 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */ |
||
118 | 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */ |
||
119 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10..17 ........ */ |
||
120 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 18..1f ........ */ |
||
121 | 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, /* 20..27 !"#$%&' */ |
||
122 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28..2f ()*+,-./ */ |
||
123 | 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, /* 30..37 01234567 */ |
||
124 | 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38..3f 89:;<=>? */ |
||
125 | |||
126 | 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02, /* 40..47 @ABCDEFG */ |
||
127 | 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 48..4f HIJKLMNO */ |
||
128 | 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 50..57 PQRSTUVW */ |
||
129 | 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, /* 58..5f XYZ[\]^_ */ |
||
130 | 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22, /* 60..67 `abcdefg */ |
||
131 | 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 68..6f hijklmno */ |
||
132 | 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 70..77 pqrstuvw */ |
||
133 | 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78..7f xyz{|}~. */ |
||
134 | |||
135 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 80..87 ........ */ |
||
136 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 88..8f ........ */ |
||
137 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 90..97 ........ */ |
||
138 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 98..9f ........ */ |
||
139 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a0..a7 ........ */ |
||
140 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a8..af ........ */ |
||
141 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* b0..b7 ........ */ |
||
142 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* b8..bf ........ */ |
||
143 | |||
144 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* c0..c7 ........ */ |
||
145 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* c8..cf ........ */ |
||
146 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* d0..d7 ........ */ |
||
147 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* d8..df ........ */ |
||
148 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* e0..e7 ........ */ |
||
149 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* e8..ef ........ */ |
||
150 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* f0..f7 ........ */ |
||
151 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 /* f8..ff ........ */ |
||
152 | }; |
||
153 | #endif |
||
154 | |||
155 | #if SQLITE_USE_URI |
||
156 | const bool SQLITE_USE_URI = true; |
||
157 | #else |
||
158 | //# define SQLITE_USE_URI 0 |
||
159 | const bool SQLITE_USE_URI = false; |
||
160 | #endif |
||
161 | |||
162 | /* |
||
163 | ** The following singleton contains the global configuration for |
||
164 | ** the SQLite library. |
||
165 | */ |
||
166 | static Sqlite3Config sqlite3Config = new Sqlite3Config( |
||
167 | SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ |
||
168 | 1, /* bCoreMutex */ |
||
169 | SQLITE_THREADSAFE != 0, /* bFullMutex */ |
||
170 | SQLITE_USE_URI, /* bOpenUri */ |
||
171 | 0x7ffffffe, /* mxStrlen */ |
||
172 | 100, /* szLookaside */ |
||
173 | 500, /* nLookaside */ |
||
174 | new sqlite3_mem_methods(), /* m */ |
||
175 | new sqlite3_mutex_methods( null, null, null, null, null, null, null, null, null ), /* mutex */ |
||
176 | new sqlite3_pcache_methods(),/* pcache */ |
||
177 | null, /* pHeap */ |
||
178 | 0, /* nHeap */ |
||
179 | 0, 0, /* mnHeap, mxHeap */ |
||
180 | null, /* pScratch */ |
||
181 | 0, /* szScratch */ |
||
182 | 0, /* nScratch */ |
||
183 | null, /* pPage */ |
||
184 | SQLITE_DEFAULT_PAGE_SIZE, /* szPage */ |
||
185 | 0, /* nPage */ |
||
186 | 0, /* mxParserStack */ |
||
187 | false, /* sharedCacheEnabled */ |
||
188 | /* All the rest should always be initialized to zero */ |
||
189 | 0, /* isInit */ |
||
190 | 0, /* inProgress */ |
||
191 | 0, /* isMutexInit */ |
||
192 | 0, /* isMallocInit */ |
||
193 | 0, /* isPCacheInit */ |
||
194 | null, /* pInitMutex */ |
||
195 | 0, /* nRefInitMutex */ |
||
196 | null, /* xLog */ |
||
197 | 0, /* pLogArg */ |
||
198 | false /* bLocaltimeFault */ |
||
199 | ); |
||
200 | |||
201 | /* |
||
202 | ** Hash table for global functions - functions common to all |
||
203 | ** database connections. After initialization, this table is |
||
204 | ** read-only. |
||
205 | */ |
||
206 | static FuncDefHash sqlite3GlobalFunctions; |
||
207 | /* |
||
208 | ** Constant tokens for values 0 and 1. |
||
209 | */ |
||
210 | static Token[] sqlite3IntTokens = { |
||
211 | new Token( "0", 1 ), |
||
212 | new Token( "1", 1 ) |
||
213 | }; |
||
214 | |||
215 | /* |
||
216 | ** The value of the "pending" byte must be 0x40000000 (1 byte past the |
||
217 | ** 1-gibabyte boundary) in a compatible database. SQLite never uses |
||
218 | ** the database page that contains the pending byte. It never attempts |
||
219 | ** to read or write that page. The pending byte page is set assign |
||
220 | ** for use by the VFS layers as space for managing file locks. |
||
221 | ** |
||
222 | ** During testing, it is often desirable to move the pending byte to |
||
223 | ** a different position in the file. This allows code that has to |
||
224 | ** deal with the pending byte to run on files that are much smaller |
||
225 | ** than 1 GiB. The sqlite3_test_control() interface can be used to |
||
226 | ** move the pending byte. |
||
227 | ** |
||
228 | ** IMPORTANT: Changing the pending byte to any value other than |
||
229 | ** 0x40000000 results in an incompatible database file format! |
||
230 | ** Changing the pending byte during operating results in undefined |
||
231 | ** and dileterious behavior. |
||
232 | */ |
||
233 | #if !SQLITE_OMIT_WSD |
||
234 | static int sqlite3PendingByte = 0x40000000; |
||
235 | #endif |
||
236 | |||
237 | //#include "opcodes.h" |
||
238 | /* |
||
239 | ** Properties of opcodes. The OPFLG_INITIALIZER macro is |
||
240 | ** created by mkopcodeh.awk during compilation. Data is obtained |
||
241 | ** from the comments following the "case OP_xxxx:" statements in |
||
242 | ** the vdbe.c file. |
||
243 | */ |
||
244 | public static int[] sqlite3OpcodeProperty; |
||
245 | } |
||
246 | } |