System.Data.SQLite
Check-in [198f7e0e95]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:1.0.12 - Compact Framework Support
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 198f7e0e95626238e413ba8f469791cb4a61876d
User & Date: rmsimpson 2005-08-02 05:35:45
Context
2005-08-02
05:36
1.0.12 - Compact Framework Support check-in: f341de7fd7 user: rmsimpson tags: sourceforge
05:35
1.0.12 - Compact Framework Support check-in: 198f7e0e95 user: rmsimpson tags: sourceforge
2005-08-01
19:26
1.11 updates check-in: 607e1f2325 user: rmsimpson tags: sourceforge
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite.Interop/SQLite.Interop.vcproj.

16
17
18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
...
212
213
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228
229
230
231
232

233
234
235
236
237
238
239
...
248
249
250
251
252
253
254

255
256


257
258
259



260
261
262
263
264
265
266
...
269
270
271
272
273
274
275






276
277
278
279
280
281



282
283
284
285
286
287






288
289
290
291
292
293
294
...
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
...
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344

















345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
			Name="Pocket PC 2003 (ARMV4)"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Compact|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"

			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				UsePrecompiledHeader="0"
				WarningLevel="1"
				DebugInformationFormat="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="$(SolutionDir)bin/$(ProjectName).dll"
				LinkIncremental="1"
				GenerateManifest="false"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)/$(ProjectName).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCWebDeploymentTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Compact|Pocket PC 2003 (ARMV4)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
................................................................................
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory=""
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
				Description="Build SQLite netmodule ..."
				CommandLine="cd ..\System.Data.SQLite&#x0D;&#x0A;csc /target:module /out:..\SQLite.Interop\SQlite.netmodule /o SQLite3.cs SQLite3_UTF16.cs SQLiteBase.cs SQLiteCommand.cs SQLiteCommandBuilder.cs SQLiteConnection.cs SQLiteConnectionStringBuilder.cs SQLiteConvert.cs SQLiteDataAdapter.cs SQLiteDataReader.cs SQLiteException.cs SQLiteFactory.cs SQLiteFunction.cs SQLiteFunctionAttribute.cs SQLiteParameter.cs SQLiteParameterCollection.cs SQLiteStatement.cs SQLiteTransaction.cs UnsafeNativeMethods.cs&#x0D;&#x0A;cd ..\SQLite.Interop&#x0D;&#x0A;"
			/>
			<Tool
				Name="VCCustomBuildTool"
				CommandLine=""
				Outputs=""
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				UsePrecompiledHeader="0"
				WarningLevel="1"
				DebugInformationFormat="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
................................................................................
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalDependencies="SQLite.netmodule $(NOINHERIT)"
				OutputFile="$(SolutionDir)bin/System.Data.SQLite.DLL"
				LinkIncremental="1"
				GenerateManifest="false"

				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)/$(ProjectName).lib"
				TargetMachine="1"
				KeyFile="..\System.Data.SQlite\System.Data.SQLite.snk"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"

			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
................................................................................
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"

			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="1"


			>
			<Tool
				Name="VCPreBuildEventTool"



			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
................................................................................
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"






			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"



			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"






			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
................................................................................
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory=""
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
	</Configurations>
................................................................................
			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\src\alter.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\AssemblyInfo.cpp"
				>

















			</File>
			<File
				RelativePath=".\src\attach.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\auth.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\btree.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\build.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\callback.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\date.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\delete.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\expr.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\func.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\hash.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\insert.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\legacy.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\main.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\opcodes.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\os_unix.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\os_win.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\pager.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\parse.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\pragma.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\prepare.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\printf.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\random.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\select.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\table.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\tclsqlite.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\tokenize.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\trigger.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\update.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\utf.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\util.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vacuum.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vdbe.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vdbeapi.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vdbeaux.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vdbemem.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\where.c"
				>
				<FileConfiguration
					Name="Compact|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>







|




>




<
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



<

<
<
<
<
<







 







<

>
|
<
<
<
<
|






>







 







>

|
>
>



>
>
>







 







>
>
>
>
>
>






>
>
>






>
>
>
>
>
>







 







|







 







|







|










>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|








|


|







|








|


|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|











|







|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33
34












































































35
36
37
38
39
40
41
..
43
44
45
46
47
48
49





































































50
51
52

53





54
55
56
57
58
59
60
..
61
62
63
64
65
66
67

68
69
70




71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
..
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
...
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702




















703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
			Name="Pocket PC 2003 (ARMV4)"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"

				Description="Building SQLite netmodule ..."
				CommandLine="cd ..\System.Data.SQLite&#x0D;&#x0A;csc /target:module /out:..\SQLite.Interop\SQlite.netmodule /o SQLite3.cs SQLite3_UTF16.cs SQLiteBase.cs SQLiteCommand.cs SQLiteCommandBuilder.cs SQLiteConnection.cs SQLiteConnectionStringBuilder.cs SQLiteConvert.cs SQLiteDataAdapter.cs SQLiteDataReader.cs SQLiteException.cs SQLiteFactory.cs SQLiteFunction.cs SQLiteFunctionAttribute.cs SQLiteParameter.cs SQLiteParameterCollection.cs SQLiteStatement.cs SQLiteTransaction.cs UnsafeNativeMethods.cs&#x0D;&#x0A;cd ..\SQLite.Interop&#x0D;&#x0A;"












































































			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
................................................................................
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"





































































				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE"
				StringPooling="true"

				RuntimeLibrary="2"





			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
................................................................................
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalDependencies="SQLite.netmodule $(NOINHERIT)"
				OutputFile="$(SolutionDir)bin/System.Data.SQLite.DLL"

				GenerateManifest="false"
				ModuleDefinitionFile="src\sqlite3.def"
				ImportLibrary="$(ConfigurationName)\$(TargetName).lib"




				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
................................................................................
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="1"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				Description="Building SQLite netmodule ..."
				CommandLine="cd ..\System.Data.SQLite&#x0D;&#x0A;csc /target:module /out:..\SQLite.Interop\SQlite.netmodule /o SQLite3.cs SQLite3_UTF16.cs SQLiteBase.cs SQLiteCommand.cs SQLiteCommandBuilder.cs SQLiteConnection.cs SQLiteConnectionStringBuilder.cs SQLiteConvert.cs SQLiteDataAdapter.cs SQLiteDataReader.cs SQLiteException.cs SQLiteFactory.cs SQLiteFunction.cs SQLiteFunctionAttribute.cs SQLiteParameter.cs SQLiteParameterCollection.cs SQLiteStatement.cs SQLiteTransaction.cs UnsafeNativeMethods.cs&#x0D;&#x0A;cd ..\SQLite.Interop&#x0D;&#x0A;"
				ExcludedFromBuild="true"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
................................................................................
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				AdditionalOptions="/GS-"
				Optimization="3"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE"
				StringPooling="true"
				FloatingPointModel="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				IgnoreImportLibrary="true"
				AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE"
				OutputFile="$(SolutionDir)bin/CompactFramework/$(ProjectName).dll"
				IgnoreDefaultLibraryNames="oldnames.lib"
				ModuleDefinitionFile="src\sqlite3.def"
				ImportLibrary="Pocket PC 2003 (ARMV4)\$(ConfigurationName)\$(TargetName).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
................................................................................
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_WINDOWS%"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
	</Configurations>
................................................................................
			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\src\alter.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\AssemblyInfo.cpp"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\attach.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\auth.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\btree.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\build.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\callback.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\date.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\delete.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\expr.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\func.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\hash.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\insert.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\legacy.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\main.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\opcodes.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\os_win.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\os_wince.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\pager.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\parse.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\pragma.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\prepare.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\printf.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\random.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\select.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\table.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"




















					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\tokenize.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\trigger.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\update.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\utf.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\util.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vacuum.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vdbe.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vdbeapi.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vdbeaux.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\vdbemem.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\where.c"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					>
					<Tool
						Name="VCCLCompilerTool"
						CompileAs="2"
					/>
				</FileConfiguration>
			</File>

Changes to SQLite.Interop/src/os_common.h.

24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
** switch.  The following code should catch this problem at compile-time.
*/
#ifdef MEMORY_DEBUG
# error "The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead."
#endif


int sqlite3_os_trace = 0;
#ifdef SQLITE_DEBUG

static int last_page = 0;
#define SEEK(X)           last_page=(X)
#define TRACE1(X)         if( sqlite3_os_trace ) sqlite3DebugPrintf(X)
#define TRACE2(X,Y)       if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y)
#define TRACE3(X,Y,Z)     if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z)
#define TRACE4(X,Y,Z,A)   if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A)
#define TRACE5(X,Y,Z,A,B) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A,B)







<

>







24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
** switch.  The following code should catch this problem at compile-time.
*/
#ifdef MEMORY_DEBUG
# error "The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead."
#endif



#ifdef SQLITE_DEBUG
int sqlite3_os_trace = 0;
static int last_page = 0;
#define SEEK(X)           last_page=(X)
#define TRACE1(X)         if( sqlite3_os_trace ) sqlite3DebugPrintf(X)
#define TRACE2(X,Y)       if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y)
#define TRACE3(X,Y,Z)     if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z)
#define TRACE4(X,Y,Z,A)   if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A)
#define TRACE5(X,Y,Z,A,B) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A,B)

Changes to SQLite.Interop/src/os_win.c.

1
2
3
4
5
6
7
8
..
56
57
58
59
60
61
62

63
64
65
66
67
68
69
...
183
184
185
186
187
188
189

190
191
192
193
194
195
196
...
247
248
249
250
251
252
253

254
255
256
257
258
259
260
261
262
263
264
265

266
267
268
269
270
271
272
...
363
364
365
366
367
368
369

370
371
372
373
374
375
376
...
630
631
632
633
634
635
636

637
638
639
640
641
642
643
#pragma unmanaged
extern "C"
{
/*
** 2004 May 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
................................................................................
/*
** Return TRUE if the named file exists.
*/
int sqlite3OsFileExists(const char *zFilename){
  return GetFileAttributesA(zFilename) != 0xffffffff;
}


/*
** Attempt to open a file for both reading and writing.  If that
** fails, try opening it read-only.  If the file does not exist,
** try to create it.
**
** On success, a handle for the open file is written to *id
** and *pReadonly is set to 0 if the file was opened for reading and
................................................................................
  id->locktype = NO_LOCK;
  id->sharedLockByte = 0;
  id->isOpen = 1;
  OpenCounter(+1);
  TRACE3("OPEN RO %d \"%s\"\n", h, zFilename);
  return SQLITE_OK;
}


/*
** Attempt to open a file descriptor for the directory that contains a
** file.  This file descriptor can be used to fsync() the directory
** in order to make sure the creation of a new file is actually written
** to disk.
**
................................................................................
    zBuf[j] = 0;
    if( !sqlite3OsFileExists(zBuf) ) break;
  }
  TRACE2("TEMP FILENAME: %s\n", zBuf);
  return SQLITE_OK; 
}


/*
** Close a file.
*/
int sqlite3OsClose(OsFile *id){
  if( id->isOpen ){
    TRACE2("CLOSE %d\n", id->h);
    CloseHandle(id->h);
    OpenCounter(-1);
    id->isOpen = 0;
  }
  return SQLITE_OK;
}


/*
** Read data from a file into a buffer.  Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
................................................................................
  assert( id->isOpen );
  SimulateIOError(SQLITE_IOERR);
  lowerBits = GetFileSize(id->h, &upperBits);
  *pSize = (((i64)upperBits)<<32) + lowerBits;
  return SQLITE_OK;
}


/*
** Return true (non-zero) if we are running under WinNT, Win2K or WinXP.
** Return false (zero) for Win95, Win98, or WinME.
**
** Here is an interesting observation:  Win95, Win98, and WinME lack
** the LockFileEx() API.  But we can still statically link against that
** API as long as we don't call it win running Win95/98/ME.  A call to
................................................................................
  }
  if( type>=PENDING_LOCK ){
    UnlockFile(id->h, PENDING_BYTE, 0, 1, 0);
  }
  id->locktype = locktype;
  return rc;
}


/*
** Turn a relative pathname into a full pathname.  Return a pointer
** to the full pathname stored in space obtained from sqliteMalloc().
** The calling function is responsible for freeing this space once it
** is no longer needed.
*/
<







 







>







 







>







 







>












>







 







>







 







>








1
2
3
4
5
6
7
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
...
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
...
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
...
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
...
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648

extern "C"
{
/*
** 2004 May 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
................................................................................
/*
** Return TRUE if the named file exists.
*/
int sqlite3OsFileExists(const char *zFilename){
  return GetFileAttributesA(zFilename) != 0xffffffff;
}

#ifndef _WIN32_WCE
/*
** Attempt to open a file for both reading and writing.  If that
** fails, try opening it read-only.  If the file does not exist,
** try to create it.
**
** On success, a handle for the open file is written to *id
** and *pReadonly is set to 0 if the file was opened for reading and
................................................................................
  id->locktype = NO_LOCK;
  id->sharedLockByte = 0;
  id->isOpen = 1;
  OpenCounter(+1);
  TRACE3("OPEN RO %d \"%s\"\n", h, zFilename);
  return SQLITE_OK;
}
#endif /* !defined(_WIN32_WCE) */

/*
** Attempt to open a file descriptor for the directory that contains a
** file.  This file descriptor can be used to fsync() the directory
** in order to make sure the creation of a new file is actually written
** to disk.
**
................................................................................
    zBuf[j] = 0;
    if( !sqlite3OsFileExists(zBuf) ) break;
  }
  TRACE2("TEMP FILENAME: %s\n", zBuf);
  return SQLITE_OK; 
}

#ifndef _WIN32_WCE
/*
** Close a file.
*/
int sqlite3OsClose(OsFile *id){
  if( id->isOpen ){
    TRACE2("CLOSE %d\n", id->h);
    CloseHandle(id->h);
    OpenCounter(-1);
    id->isOpen = 0;
  }
  return SQLITE_OK;
}
#endif

/*
** Read data from a file into a buffer.  Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
................................................................................
  assert( id->isOpen );
  SimulateIOError(SQLITE_IOERR);
  lowerBits = GetFileSize(id->h, &upperBits);
  *pSize = (((i64)upperBits)<<32) + lowerBits;
  return SQLITE_OK;
}

#ifndef _WIN32_WCE
/*
** Return true (non-zero) if we are running under WinNT, Win2K or WinXP.
** Return false (zero) for Win95, Win98, or WinME.
**
** Here is an interesting observation:  Win95, Win98, and WinME lack
** the LockFileEx() API.  But we can still statically link against that
** API as long as we don't call it win running Win95/98/ME.  A call to
................................................................................
  }
  if( type>=PENDING_LOCK ){
    UnlockFile(id->h, PENDING_BYTE, 0, 1, 0);
  }
  id->locktype = locktype;
  return rc;
}
#endif /* !defined(_WIN32_WCE) */

/*
** Turn a relative pathname into a full pathname.  Return a pointer
** to the full pathname stored in space obtained from sqliteMalloc().
** The calling function is responsible for freeing this space once it
** is no longer needed.
*/

Changes to SQLite.Interop/src/os_win.h.

14
15
16
17
18
19
20




21
22
23
24
25
26
27
28
29
30
31
32









33
34
35
36
37
38
39





























40
*/
#ifndef _SQLITE_OS_WIN_H_
#define _SQLITE_OS_WIN_H_

#include <windows.h>
#include <winbase.h>





/*
** The OsFile structure is a operating-system independing representation
** of an open file handle.  It is defined differently for each architecture.
**
** This is the definition for Win32.
*/
typedef struct OsFile OsFile;
struct OsFile {
  HANDLE h;               /* Handle for accessing the file */
  unsigned char locktype; /* Type of lock currently held on this file */
  unsigned char isOpen;   /* True if needs to be closed */
  short sharedLockByte;   /* Randomly chosen byte used as a shared lock */









};


#define SQLITE_TEMPNAME_SIZE (MAX_PATH+50)
#define SQLITE_MIN_SLEEP_MS 1































#endif /* _SQLITE_OS_WIN_H_ */







>
>
>
>












>
>
>
>
>
>
>
>
>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
*/
#ifndef _SQLITE_OS_WIN_H_
#define _SQLITE_OS_WIN_H_

#include <windows.h>
#include <winbase.h>

#ifdef _WIN32_WCE
typedef struct sqlitewce_lockdata_t sqlitewce_lockdata_t;
#endif

/*
** The OsFile structure is a operating-system independing representation
** of an open file handle.  It is defined differently for each architecture.
**
** This is the definition for Win32.
*/
typedef struct OsFile OsFile;
struct OsFile {
  HANDLE h;               /* Handle for accessing the file */
  unsigned char locktype; /* Type of lock currently held on this file */
  unsigned char isOpen;   /* True if needs to be closed */
  short sharedLockByte;   /* Randomly chosen byte used as a shared lock */
#ifdef _WIN32_WCE
  int delOnClose;         /* To delete file on close */
  WCHAR * wFilename;      /* filename (for delete & global name generation) */
# ifndef SQLITE_WCE_OMIT_FILELOCK
  HANDLE  hMux;           /* Named mutex handle */
  HANDLE  hMem;           /* Named memory file mapping handle */
  sqlitewce_lockdata_t * lockdata; /* shared locking data (map view) */
# endif //!SQLITE_WCE_OMIT_FILELOCK
#endif //_WIN32_WCE
};


#define SQLITE_TEMPNAME_SIZE (MAX_PATH+50)
#define SQLITE_MIN_SLEEP_MS 1


/*
** This are WIN32 API functions not present in WinCE.
** They are implemented in the "os_wince.c" file.
**/
#ifdef _WIN32_WCE
# define DeleteFileA				sqlitewce_DeleteFileA
# define GetFileAttributesA			sqlitewce_GetFileAttributesA
# define GetTempPathA				sqlitewce_GetTempPathA
# define GetFullPathNameA			sqlitewce_GetFullPathNameA
# define GetSystemTimeAsFileTime	sqlitewce_GetSystemTimeAsFileTime
BOOL sqlitewce_DeleteFileA( LPCSTR zFilename );
DWORD sqlitewce_GetFileAttributesA( LPCSTR lpFileName );
DWORD sqlitewce_GetTempPathA( DWORD bufLen, LPSTR buf );
DWORD sqlitewce_GetFullPathNameA( LPCSTR,DWORD,LPSTR,LPSTR* );
void sqlitewce_GetSystemTimeAsFileTime( LPFILETIME );
#endif

/*
** It seems WinCE 4.x (don't know about 5) implements localtime,
** but only in the MFC library.
** To avoid any problems I just use my own implementation.
** It should be safe, as this header is not included by normal
** programs, only by the SQLite library.
**/
#if _WIN32_WCE >= 400
# define localtime					sqlitewce_localtime
#endif


#endif /* _SQLITE_OS_WIN_H_ */

Added SQLite.Interop/src/os_wince.c.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
extern "C"
{
/*
** 2005 April 1 - Nuno Lucas
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to Windows CE.
*/
#include "sqliteInt.h"
#include "os.h"          /* Must be first to enable large file support */
#ifdef _WIN32_WCE        /* This file is used for Windows CE only */
#include <time.h>

/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"


/*
**
** Implementation of the assert function for systems not having it
**
** Very basic, just opens a message box displaying where and what fired the
** the assert failure.
*/
void sqlitewce_assert( int x, char * test, char * file, int line )
{
	/* This should be fixed somehow, to avoid overflows.
	 * Also, when an assert is caused by memory allocation faillure, this
	 * will probably fail.
	 */
	WCHAR buf[2048];
	if (x) return;
	swprintf( buf, L"assert( %hs )\r\n\r\nFile: '%hs'  Line: %d", test, file, line );
	MessageBoxW( 0, buf, L"Assertion Error", MB_ICONERROR );
}

/*
** Implementation of the localtime function for systems not having it.
** Convert time_t to local time in tm struct format.
*/
struct tm * sqlitewce_localtime( const time_t *timer )
{
	static struct tm s_tm;
	FILETIME	uf, lf;
	SYSTEMTIME	ls;
	// Convert time_t to FILETIME
	unsigned __int64 i64 = Int32x32To64(timer, 10000000) + 116444736000000000;
	uf.dwLowDateTime = (DWORD) i64;
	uf.dwHighDateTime = (DWORD) (i64 >> 32);
	// Convert UTC(GMT) FILETIME to local FILETIME
	FileTimeToLocalFileTime( &uf, &lf );
	// Convert FILETIME to SYSTEMTIME
	FileTimeToSystemTime( &lf, &ls );
	// Convert SYSTEMTIME to tm
	s_tm.tm_sec  = ls.wSecond;
	s_tm.tm_min  = ls.wMinute;
	s_tm.tm_hour = ls.wHour;
	s_tm.tm_mday = ls.wDay;
	s_tm.tm_mon  = ls.wMonth -1;
	s_tm.tm_year = ls.wYear - 1900;
	s_tm.tm_wday = ls.wDayOfWeek;
	// Return pointer to static data
	return &s_tm;
}

/*
** Similar to strdup, but first converts the MBCS string to UNICODE
** and then returns the UNICODE clone.
** Don't forget to free() the returned string.
** I assume a 2 byte size per character for unicode. That's what windows
** thinks unicode strings are (expect having to change this in 2010 ;)
*/
static WCHAR * StrDupW( const char * str )
{
	size_t size = strlen(str) + 1; // +1 for terminating '\0'
	WCHAR * aux = (WCHAR *) malloc( size*sizeof(WCHAR) );
	MultiByteToWideChar( CP_ACP, 0, str,-1, aux, size );
	return aux;
}

/*
** Windows CE versions prior to 3.0 don't implement atof(), so we
** implement it here as a wrapper to wcstod().
*/
double sqlitewce_atof( const char *str )
{
	wchar_t * aux = StrDupW( str );
	double d = wcstod( aux, NULL );
	free( aux );
	return d;
}

/*
** This is needed for the command line version of sqlite to compile.
**/
int isatty( int handle )
{
	UNREFERENCED_PARAMETER(handle);
	return 1;
}

/*
** Converts a relative path to an absolute path.
** There is no current directory concept on Windows CE, so we assume
** we are working always with absolute paths and simply copy
** the given path to the provided buffer.
*/
DWORD sqlitewce_GetFullPathNameA
	(
		LPCSTR	lpFileName,
		DWORD	nBufferLength,
		LPSTR	lpBuffer,
		LPSTR *	lpFilePart
	)
{
	DWORD i = 0;
	for ( ; i < nBufferLength; ++i )
	{
		lpBuffer[i] = lpFileName[i];
		if ( lpBuffer[i] == '\\' || lpBuffer[i] == '/' )
			*lpFilePart = lpBuffer + i + 1;
		if ( lpBuffer[i] == '\0' )
			break;
	}
	return (i >= nBufferLength)? strlen(lpFileName) + 1 : i;
}

/*
** Simple wrapper to the Unicode version of GetFileAttributes().
*/
DWORD sqlitewce_GetFileAttributesA( LPCSTR lpFileName )
{
	wchar_t * aux = StrDupW( lpFileName );
	DWORD ret = GetFileAttributesW( aux );
	free( aux );
	return ret;
}

/*
** WinCE doesn't implement GetSystemTimeAsFileTime(), but is
** trivial to code.
*/
void sqlitewce_GetSystemTimeAsFileTime( LPFILETIME ft )
{
	SYSTEMTIME st;
	GetSystemTime( &st );
	SystemTimeToFileTime( &st, ft );
}

/*
** Simple wrapper to the Unicode version of DeleteFile().
*/
BOOL sqlitewce_DeleteFileA( LPCSTR zFilename )
{
	wchar_t * aux = StrDupW( zFilename );
	BOOL ret = DeleteFileW( aux );
	free( aux );
	return ret;
}

/*
** Wrapper to the Unicode version of GetTempPath().
**
** NOTE: The MSDN says GetTempPath() can fail if no temporary path
**       defined. No check for this, as now is possible to define
**       an alternate temporary path for sqlite.
*/
DWORD sqlitewce_GetTempPathA( DWORD bufLen, LPSTR buf )
{
	int len = GetTempPathW( 0,0 );
	LPWSTR wTempPath = (LPWSTR) malloc( (len+1)*sizeof(WCHAR) );
	GetTempPathW( len+1, wTempPath );
	len = WideCharToMultiByte( CP_ACP, 0, wTempPath,-1, buf,bufLen, 0,0 );
	free( wTempPath );
	return len;
}


/**********************************************************************
 * File locking helper functions for Windows CE
 *********************************************************************/

#ifndef SQLITE_WCE_OMIT_FILELOCK

/*
** Structure holding the global locking data for each open database/file.
** sqlitewce_LockMutex() must be used before using this data.
**
** <lock> holds the global lock state of the file. Every time a process
**			holds a lock on the file, 1 << locktype is set, i.e., bit 1
**			if any process with a SHARED lock, bit 2 is set if any with
**			a RESERVED lock, bit 3 for the PENDING lock and bit 4 for
**			the EXCLUSIVE lock. bit 0 is ignored, and may be set or not
**          in between (if it simplifies the algorithm).
** <shared> is the count of processes holding the SHARED lock.
**
*/
typedef struct sqlitewce_lockdata_t
{
	unsigned	lock;	/* global lock state */
	unsigned	shared;	/* global share count */
} sqlitewce_lockdata_t;

/*
** Lock access to file locking data.
** Only returns on success.
**
** NOTE: I'm not sure in what conditions this can turn into an infinite
**       loop. I don't think it is possible without a serious bug in
**       sqlite or windows, but i'm not sure of this.
*/
static void lock_file( OsFile *id )
{
	DWORD res;
	while ( 1 )
	{
		res = WaitForSingleObject( id->hMux, INFINITE );
		// I don't know very well what I have to do in this case.
		// The MSDN says that this case is when a thread terminates without
		// releasing the mutex. So I have to release it and try again
		if ( res == WAIT_ABANDONED )
		{
			ReleaseMutex( id->hMux );
			continue;
		}
		// success ?
		if ( res == WAIT_OBJECT_0 )
			break;
		// Let the owner have time to release it
		Sleep( 1 );
	}
}

/*
** Releases ownership of the file mutex.
** Always success
*/
static void unlock_file( OsFile *id )
{
	ReleaseMutex( id->hMux );
}

/*
** Acquire a lock on the file.
** Returns non-zero on success, zero on failure.
*/
static int getLock( OsFile *id, int locktype )
{
	int rc = 0;
	lock_file( id );
	if ( locktype == SHARED_LOCK )
	{
		assert( id->lockdata->shared >= 0 );
		++id->lockdata->shared;	/* Increment number of readers */
		id->lockdata->lock |= 1 << SHARED_LOCK;
	}
	else
	{
		if ( id->lockdata->lock & (1 << locktype) )
		{
			unlock_file( id );
			return 0;	/* Already locked by others */
		}
		id->lockdata->lock |= 1 << locktype;
	}
	unlock_file( id );
	return 1;
}

/*
** Releases lock on the file.
** Always succeeds, so no return value.
*/
static void unsetLock( OsFile *id, int locktype )
{
	assert( locktype >= SHARED_LOCK );
	lock_file( id );
	if ( locktype == SHARED_LOCK )
	{
		assert( id->lockdata->shared > 0 );
		--id->lockdata->shared;	/* Decrement number of readers */
		if ( id->lockdata->shared == 0 )	/* Last reader? */
			id->lockdata->lock &= ~(1 << SHARED_LOCK);
	}
	else
	{
		id->lockdata->lock &= ~(1 << locktype);
	}
	unlock_file( id );
}

/*
** Initializes file locking struture.
** Returns non-zero on success, zero on error.
**
** Each open file will have an associated shared memory area, where the global
** lock information will be stored.
** The file path is used to generate a unique name for each file.
** An aditional global mutex per file is created, for syncronization between
** processes.
*/
static int sqlitewce_InitLocks( OsFile *id )
{
	WCHAR * aux;
	WCHAR muxName[256] = L"sqwce_mux_";
	WCHAR memName[256] = L"sqwce_mem_";
	int i, exists;

	// Generate resource names suffix from the file name
	aux = _wcsdup( id->wFilename );
	if ( aux == NULL )	return 0; // No mem
	for ( i = 0; aux[i]; ++i )
	{
		if ( aux[i] == '\\' )
			aux[i] = '/'; // can't use '\\' in name
		else
			aux[i] = towlower( aux[i] ); // names are case sensitive
	}
	wcsncat( muxName, aux, 256 );
	wcsncat( memName, aux, 256 );
	free( aux );

	// Create named mutex (or open existing)
	id->hMux = CreateMutex( NULL, FALSE, muxName );
	if ( id->hMux == NULL )
		return 0; // No mem or something weird

	// Lock access to file data (avoid race condition on create/open)
	lock_file( id );

	// Create shared memory mapping or open existing
	id->hMem = CreateFileMapping(
					INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
					0, sizeof(sqlitewce_lockdata_t),
					memName );
	if ( id->hMem == NULL )
	{
		unlock_file( id );
		CloseHandle( id->hMux );
		return 0;	// No mem or something weird
	}

	// Check if already exists (created by other process)
	exists = (GetLastError() == ERROR_ALREADY_EXISTS);

	// Open view to the data
	id->lockdata = (sqlitewce_lockdata_t *)MapViewOfFile( id->hMem, FILE_MAP_WRITE, 0,0, 0 );
	if ( id->lockdata == NULL )
	{
		unlock_file( id );
		CloseHandle( id->hMem );
		CloseHandle( id->hMux );
		return 0;	// No mem or something weird
	}

	// Initialize lockdata, if first time
	if ( ! exists )
		memset( id->lockdata, 0, sizeof(sqlitewce_lockdata_t) );

	// Done, release global lock on the file.
	unlock_file( id );

	return 1;
}

/*
** Releases any locks held on the file and releases locking data.
** Doesn't return anything, because there is no way to recover
** from a faillure to remove the lock (and a faillure to do so
** would be a bug either in windows or in sqlite).
*/
static void sqlitewce_ReleaseLocks( OsFile *id )
{
	if ( id->lockdata )
	{
		sqlite3OsUnlock( id, NO_LOCK );
		UnmapViewOfFile( id->lockdata );
		CloseHandle( id->hMem );
		CloseHandle( id->hMux );
	}
}

#endif // !defined(SQLITE_WCE_OMIT_FILELOCK)


/**********************************************************************
 * sqlite3Os functions implemented specificaly for WinCE
 *********************************************************************/

/*
** Attempt to open a file for both reading and writing.  If that
** fails, try opening it read-only.  If the file does not exist,
** try to create it.
**
** On success, a handle for the open file is written to *id
** and *pReadonly is set to 0 if the file was opened for reading and
** writing or 1 if the file was opened read-only.  The function returns
** SQLITE_OK.
**
** On failure, the function returns SQLITE_CANTOPEN and leaves
** *id and *pReadonly unchanged.
*/
int sqlite3OsOpenReadWrite( const char *zFilename, OsFile *id, int *pReadonly )
{
	HANDLE h;
	WCHAR *wFilename = StrDupW( zFilename );
	if ( wFilename == NULL )
		return SQLITE_NOMEM;
	assert( !id->isOpen );
	h = CreateFileW( wFilename, GENERIC_READ | GENERIC_WRITE,
					FILE_SHARE_READ | FILE_SHARE_WRITE,
					NULL, OPEN_ALWAYS,
					FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
					NULL );
	if ( h == INVALID_HANDLE_VALUE )
	{
		h = CreateFileW( wFilename, GENERIC_READ,
					FILE_SHARE_READ,
					NULL, OPEN_ALWAYS,
					FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
					NULL );
		if ( h == INVALID_HANDLE_VALUE )
		{
			free( wFilename );
			return SQLITE_CANTOPEN;
		}
		*pReadonly = 1;
	}
	else
	{
		*pReadonly = 0;
	}
	// Fill file context data
	id->h = h;
	id->locktype = NO_LOCK;
	id->sharedLockByte = 0;
	id->isOpen = 1;
	id->wFilename = wFilename;
	id->delOnClose = 0;
#ifndef SQLITE_WCE_OMIT_FILELOCK
	if ( ! sqlitewce_InitLocks(id) )
	{	// Failled to initialize file lock mechanism
		free( wFilename );
		CloseHandle( h );
		return SQLITE_NOMEM;
	}
#endif
	OpenCounter(+1);
	TRACE3("OPEN R/W %d \"%s\"\n", h, zFilename);
	return SQLITE_OK;
}

/*
** Attempt to open a new file for exclusive access by this process.
** The file will be opened for both reading and writing.  To avoid
** a potential security problem, we do not allow the file to have
** previously existed.  Nor do we allow the file to be a symbolic
** link.
**
** If delFlag is true, then make arrangements to automatically delete
** the file when it is closed.
**
** On success, write the file handle into *id and return SQLITE_OK.
**
** On failure, return SQLITE_CANTOPEN.
*/
int sqlite3OsOpenExclusive( const char *zFilename, OsFile *id, int delFlag )
{
	HANDLE h;
	WCHAR * wFilename = StrDupW( zFilename );
	assert( !id->isOpen );
	h = CreateFileW( wFilename, GENERIC_READ | GENERIC_WRITE, 0,
					NULL, CREATE_ALWAYS, FILE_FLAG_RANDOM_ACCESS, NULL );
	if ( h == INVALID_HANDLE_VALUE )
	{
		free( wFilename );
		return SQLITE_CANTOPEN;
	}
	id->h = h;
	id->locktype = NO_LOCK;
	id->sharedLockByte = 0;
	id->isOpen = 1;
	id->wFilename = wFilename;
	id->delOnClose = delFlag;
#ifndef SQLITE_WCE_OMIT_FILELOCK
	// Not shared, so no need to lock file (it would fail to open)
	id->hMux = NULL;
	id->hMem = NULL;
	id->lockdata = NULL;
#endif
	OpenCounter(+1);
	TRACE3("OPEN EX %d \"%s\"\n", h, zFilename);
	return SQLITE_OK;
}

/*
** Attempt to open a new file for read-only access.
**
** On success, write the file handle into *id and return SQLITE_OK.
**
** On failure, return SQLITE_CANTOPEN.
*/
int sqlite3OsOpenReadOnly( const char *zFilename, OsFile *id )
{
	HANDLE h;
	WCHAR * wFilename = StrDupW( zFilename );
	assert( !id->isOpen );
	h = CreateFileW( wFilename, GENERIC_READ, 0, NULL, OPEN_EXISTING,
					FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL );
	if ( h == INVALID_HANDLE_VALUE )
	{
		free( wFilename );
		return SQLITE_CANTOPEN;
	}
	id->h = h;
	id->locktype = NO_LOCK;
	id->sharedLockByte = 0;
	id->isOpen = 1;
	id->wFilename = wFilename;
	id->delOnClose = 0;
#ifndef SQLITE_WCE_OMIT_FILELOCK
	// Not shared, so no need to lock file
	id->hMux = NULL;
	id->hMem = NULL;
	id->lockdata = NULL;
#endif
	OpenCounter(+1);
	TRACE3("OPEN RO %d \"%s\"\n", h, zFilename);
	return SQLITE_OK;
}

/*
** Close a file.
*/
int sqlite3OsClose( OsFile *id )
{
	if ( id->isOpen )
	{
		TRACE2("CLOSE %d\n", id->h);
#ifndef SQLITE_WCE_OMIT_FILELOCK
		sqlitewce_ReleaseLocks( id );
#endif
		CloseHandle(id->h);
		OpenCounter(-1);
		id->isOpen = 0;
		if ( id->delOnClose )
			DeleteFileW( id->wFilename );
		free( id->wFilename );
	}
	return SQLITE_OK;
}

/*
** Lock the file with the lock specified by parameter locktype - one
** of the following:
**
**     (1) SHARED_LOCK
**     (2) RESERVED_LOCK
**     (3) PENDING_LOCK
**     (4) EXCLUSIVE_LOCK
**
** Sometimes when requesting one lock state, additional lock states
** are inserted in between.  The locking might fail on one of the later
** transitions leaving the lock state different from what it started but
** still short of its goal.  The following chart shows the allowed
** transitions and the inserted intermediate states:
**
**    UNLOCKED -> SHARED
**    SHARED -> RESERVED
**    SHARED -> (PENDING) -> EXCLUSIVE
**    RESERVED -> (PENDING) -> EXCLUSIVE
**    PENDING -> EXCLUSIVE
**
** This routine will only increase a lock.  The sqlite3OsUnlock() routine
** erases all locks at once and returns us immediately to locking level 0.
** It is not possible to lower the locking level one step at a time.  You
** must go straight to locking level 0.
*/
int sqlite3OsLock( OsFile *id, int locktype )
{
#ifdef SQLITE_WCE_OMIT_FILELOCK
	id->locktype = locktype;
	return SQLITE_OK;
#else
  int rc = SQLITE_OK;    /* Return code from subroutines */
  int res = 1;           /* Result of a windows lock call */
  int newLocktype;       /* Set id->locktype to this value before exiting */
  int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */

  assert( id->isOpen );
  TRACE5("LOCK %d %d was %d(%d)\n",
          id->h, locktype, id->locktype, id->sharedLockByte);

  /* If there is already a lock of this type or more restrictive on the
  ** OsFile, do nothing. Don't use the end_lock: exit path, as
  ** sqlite3OsEnterMutex() hasn't been called yet.
  */
  if( id->locktype>=locktype ){
    return SQLITE_OK;
  }

  /* Make sure the locking sequence is correct
  */
  assert( id->locktype!=NO_LOCK || locktype==SHARED_LOCK );
  assert( locktype!=PENDING_LOCK );
  assert( locktype!=RESERVED_LOCK || id->locktype==SHARED_LOCK );

  /* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or
  ** a SHARED lock.  If we are acquiring a SHARED lock, the acquisition of
  ** the PENDING_LOCK byte is temporary.
  */
  newLocktype = id->locktype;
  if( id->locktype==NO_LOCK
   || (locktype==EXCLUSIVE_LOCK && id->locktype==RESERVED_LOCK)
  ){
    int cnt = 3;
    while( cnt-->0 && (res = getLock(id, PENDING_LOCK))==0 ){
      /* Try 3 times to get the pending lock.  The pending lock might be
      ** held by another reader process who will release it momentarily.
      */
      TRACE2("could not get a PENDING lock. cnt=%d\n", cnt);
      Sleep(1);
    }
    gotPendingLock = res;
  }

  /* Acquire a shared lock
  */
  if( locktype==SHARED_LOCK && res ){
    assert( id->locktype==NO_LOCK );
    res = getLock( id, SHARED_LOCK );
    if( res ){
      newLocktype = SHARED_LOCK;
    }
  }

  /* Acquire a RESERVED lock
  */
  if( locktype==RESERVED_LOCK && res ){
    assert( id->locktype==SHARED_LOCK );
    res = getLock( id, RESERVED_LOCK );
    if( res ){
      newLocktype = RESERVED_LOCK;
    }
  }

  /* Acquire a PENDING lock
  */
  if( locktype==EXCLUSIVE_LOCK && res ){
    newLocktype = PENDING_LOCK;
    gotPendingLock = 0;
  }

  /* Acquire an EXCLUSIVE lock
  */
  if( locktype==EXCLUSIVE_LOCK && res ){
    assert( id->locktype>=SHARED_LOCK );
//  res = unlockReadLock(id);
//  TRACE2("unreadlock = %d\n", res);
    res = getLock( id, EXCLUSIVE_LOCK );
    if( res ){
      newLocktype = EXCLUSIVE_LOCK;
    }else{
      TRACE2("error-code = %d\n", GetLastError());
    }
  }

  /* If we are holding a PENDING lock that ought to be released, then
  ** release it now.
  */
  if( gotPendingLock && locktype==SHARED_LOCK ){
    unsetLock( id, PENDING_LOCK );
  }

  /* Update the state of the lock has held in the file descriptor then
  ** return the appropriate result code.
  */
  if( res ){
    rc = SQLITE_OK;
  }else{
    TRACE4("LOCK FAILED %d trying for %d but got %d\n", id->h,
           locktype, newLocktype);
    rc = SQLITE_BUSY;
  }
  id->locktype = newLocktype;
  return rc;
#endif
}

/*
** This routine checks if there is a RESERVED lock held on the specified
** file by this or any other process. If such a lock is held, return
** non-zero, otherwise zero.
*/
int sqlite3OsCheckReservedLock( OsFile *id )
{
  int rc;
  assert( id->isOpen );
  if( id->locktype>=RESERVED_LOCK ){
    rc = 1;
    TRACE3("TEST WR-LOCK %d %d (local)\n", id->h, rc);
  }else{
#ifdef SQLITE_WCE_OMIT_FILELOCK
	rc = 0;
#else
    /* Only an atomic read, no need to lock_file() */
    rc = ( id->lockdata->lock & (1<<RESERVED_LOCK) ) != 0;
    TRACE3( "TEST WR-LOCK %d %d (remote)\n", id->h, rc );
#endif
  }
  return rc;
}

/*
** Lower the locking level on file descriptor id to locktype.  locktype
** must be either NO_LOCK or SHARED_LOCK.
**
** If the locking level of the file descriptor is already at or below
** the requested locking level, this routine is a no-op.
**
** It is not possible for this routine to fail if the second argument
** is NO_LOCK.  If the second argument is SHARED_LOCK then this routine
** might return SQLITE_IOERR;
*/
int sqlite3OsUnlock( OsFile *id, int locktype )
{
#ifdef SQLITE_WCE_OMIT_FILELOCK
  return SQLITE_OK;
#else
  int type;
  int rc = SQLITE_OK;
  assert( id->isOpen );
  assert( locktype<=SHARED_LOCK );
  TRACE5("UNLOCK %d to %d was %d(%d)\n", id->h, locktype,
          id->locktype, id->sharedLockByte);
  type = id->locktype;
  if( type>=EXCLUSIVE_LOCK ){
	unsetLock( id, EXCLUSIVE_LOCK );
  }
  if( type>=RESERVED_LOCK ){
	unsetLock( id, RESERVED_LOCK );
  }
  if( locktype==NO_LOCK && type>=SHARED_LOCK ){
    unsetLock( id, SHARED_LOCK );
  }
  if( type>=PENDING_LOCK ){
    unsetLock( id, PENDING_LOCK );
  }
  id->locktype = locktype;
  return rc;
#endif
}


#ifndef SQLITE_OMIT_PAGER_PRAGMAS
/*
** Check that a given pathname is a directory and is writable 
**
*/
int sqlite3OsIsDirWritable(char *zBuf){
  int fileAttr;
  if(! zBuf ) return 0;
  fileAttr = GetFileAttributesA(zBuf);
  if( fileAttr == 0xffffffff ) return 0;
  if( (fileAttr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY ){
    return 0;
  }
  return 1;
}
#endif /* SQLITE_OMIT_PAGER_PRAGMAS */


#endif /* _WIN32_WCE */

}

Changes to SQLite.NET.sln.

1
2
3
4



5
6
7
8
9
10
11
12
13
14
15
16
17


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67








68
69
70
71
72

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite", "System.Data.SQLite\System.Data.SQLite.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}"



EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
	ProjectSection(ProjectDependencies) = postProject
		{10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80}
	EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = postProject
		readme.htm = readme.htm
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop", "SQLite.Interop\SQLite.Interop.vcproj", "{10B51CE8-A838-44DE-BD82-B658F0296F80}"
EndProject


Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
		Debug|Win32 = Debug|Win32
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Any CPU.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Any CPU.Build.0 = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Mixed Platforms.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Mixed Platforms.Build.0 = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.ActiveCfg = Compact|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.Build.0 = Compact|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Any CPU.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Any CPU.Build.0 = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Mixed Platforms.Build.0 = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.Build.0 = Release|Win32








	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal




>
>
>













>
>


<
<
|

|
<
<



|
|
|

|
|
|

|
<
<
<
<

|
|
|
<
<
|
|
|
|
<
<
<
<
|
|
|
|
|
<
<
<
<


>
>
>
>
>
>
>
>





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24


25
26
27


28
29
30
31
32
33
34
35
36
37
38
39




40
41
42
43


44
45
46
47




48
49
50
51
52




53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite", "System.Data.SQLite\System.Data.SQLite.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}"
	ProjectSection(ProjectDependencies) = postProject
		{10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
	ProjectSection(ProjectDependencies) = postProject
		{10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80}
	EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = postProject
		readme.htm = readme.htm
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop", "SQLite.Interop\SQLite.Interop.vcproj", "{10B51CE8-A838-44DE-BD82-B658F0296F80}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testce", "testce\testce.csproj", "{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution


		Debug|Compact Framework = Debug|Compact Framework
		Debug|Win32 = Debug|Win32
		Release|Compact Framework = Release|Compact Framework


		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework.Deploy.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework.Deploy.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Compact Framework.ActiveCfg = Debug|Any CPU




		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Compact Framework.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU


		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework.Deploy.0 = Release|Pocket PC 2003 (ARMV4)




		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.Build.0 = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Compact Framework.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Compact Framework.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Compact Framework.Deploy.0 = Release|Pocket PC 2003 (ARMV4)




		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.Build.0 = Release|Win32
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Win32.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Changes to System.Data.SQLite/AssemblyInfo.cs.

24
25
26
27
28
29
30
31
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.10.*")]







|
24
25
26
27
28
29
30
31
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.11.*")]

Changes to System.Data.SQLite/System.Data.SQLite.csproj.

2
3
4
5
6
7
8

9
10
11







12
13
14
15

16
17
18
19
20
21
22
23
24



25
26
27
28
29
30
31
32
33
34
35
36
37

38
39
40

41


42


43


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66


67
68
69
70
71



72
73

74
75
76







77







78
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50215</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139951-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>

    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>SQLite.CompactFramework</AssemblyName>
    <WarningLevel>4</WarningLevel>







    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>System.Data.SQLite.snk</AssemblyOriginatorKeyFile>
    <StartupObject>
    </StartupObject>

  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>.\bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DocumentationFile>bin\Debug\System.Data.SQLite.XML</DocumentationFile>



  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>
    </DefineConstants>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>false</DebugSymbols>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <NoStdLib>false</NoStdLib>
    <DocumentationFile>bin\Release\System.Data.SQLite.XML</DocumentationFile>
    <FileAlignment>512</FileAlignment>

    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
  </PropertyGroup>
  <ItemGroup>

    <Reference Include="System" />


    <Reference Include="System.Data" />


    <Reference Include="System.XML" />


  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <None Include="System.Data.SQLite.snk" />
    <Compile Include="SQLite3.cs" />
    <Compile Include="SQLite3_UTF16.cs" />
    <Compile Include="SQLiteBase.cs" />
    <Compile Include="SQLiteCommand.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteCommandBuilder.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionStringBuilder.cs">
    </Compile>
    <Compile Include="SQLiteConvert.cs" />
    <Compile Include="SQLiteFactory.cs" />
    <Compile Include="SQLiteFunction.cs" />
    <Compile Include="SQLiteFunctionAttribute.cs" />
    <Compile Include="SQLiteStatement.cs" />
    <Compile Include="SQLiteConnection.cs">
      <SubType>Component</SubType>
    </Compile>


    <Compile Include="SQLiteDataAdapter.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteDataReader.cs" />
    <Compile Include="SQLiteException.cs" />



    <Compile Include="SQLiteParameter.cs" />
    <Compile Include="SQLiteParameterCollection.cs" />

    <Compile Include="SQLiteTransaction.cs" />
    <Compile Include="UnsafeNativeMethods.cs" />
  </ItemGroup>







  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />







</Project>







>

<
|
>
>
>
>
>
>
>


<
<
>





|
|
|
|
>
>
>




|
|
|
|
|
|
|
|
|
>



>
|
>
>
|
>
>
|
>
>



<









<
<
<
<
<
<
<



>
>





>
>
>


>



>
>
>
>
>
>
>
|
>
>
>
>
>
>
>

2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71
72







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50215</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139951-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>

    <AssemblyName>System.Data.SQLite</AssemblyName>
    <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <PlatformFamilyName>PocketPC</PlatformFamilyName>
    <PlatformID>3C41C503-53EF-4c2a-8DD4-A8217CAD115E</PlatformID>
    <OSVersion>4.20</OSVersion>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <FormFactorID>
    </FormFactorID>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>System.Data.SQLite.snk</AssemblyOriginatorKeyFile>


    <DeployDirSuffix>testce</DeployDirSuffix>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\CompactFramework\</OutputPath>
    <DefineConstants>TRACE;DEBUG;PocketPC;PLATFORM_COMPACTFRAMEWORK</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <FileAlignment>512</FileAlignment>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\CompactFramework\</OutputPath>
    <DefineConstants>PocketPC;PLATFORM_COMPACTFRAMEWORK</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <FileAlignment>512</FileAlignment>
    <WarningLevel>4</WarningLevel>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <FxCopRules>
    </FxCopRules>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="System">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml">
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />

    <Compile Include="SQLite3.cs" />
    <Compile Include="SQLite3_UTF16.cs" />
    <Compile Include="SQLiteBase.cs" />
    <Compile Include="SQLiteCommand.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteCommandBuilder.cs">
      <SubType>Component</SubType>
    </Compile>







    <Compile Include="SQLiteConnection.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionStringBuilder.cs" />
    <Compile Include="SQLiteConvert.cs" />
    <Compile Include="SQLiteDataAdapter.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteDataReader.cs" />
    <Compile Include="SQLiteException.cs" />
    <Compile Include="SQLiteFactory.cs" />
    <Compile Include="SQLiteFunction.cs" />
    <Compile Include="SQLiteFunctionAttribute.cs" />
    <Compile Include="SQLiteParameter.cs" />
    <Compile Include="SQLiteParameterCollection.cs" />
    <Compile Include="SQLiteStatement.cs" />
    <Compile Include="SQLiteTransaction.cs" />
    <Compile Include="UnsafeNativeMethods.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="System.Data.SQLite.snk" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

Added bin/CompactFramework/SQLite.Interop.dll.

cannot compute difference between binary files

Added bin/CompactFramework/System.Data.SQLite.dll.

cannot compute difference between binary files

Added bin/CompactFramework/testce.exe.

cannot compute difference between binary files

Deleted bin/SQLite.Interop.dll.

cannot compute difference between binary files

Changes to bin/System.Data.SQLite.dll.

cannot compute difference between binary files

Changes to bin/test.exe.

cannot compute difference between binary files

Changes to readme.htm.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15

16
17
18
19
20
21
22
23

24


25
26
27

28
29
30

31
32

33

34

35

36
37
38
39

40
41
42
43
44

45
46
47
48

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65





66












67
68
69
70
71
72
73
74
75
76
77
78

79
80


81


82

83

84

85
86



87
88
89
90
91
92









93
94

95
96
97
98
99
100

101
102
103

104
105
106

107

108


109
110
111
112
113
114
115

116

117
118

119

120
121

122

123

124
125
126
127
128

129

130
131
132
133

134
135
136
137
138
139
140
141

142
143
144
145

146
147

148
149

150
151

152
153
154
155

156
157
158
159
160
161
162
163

164
165


166

167

168
169

170
171
172
173
174
175

176
177

178
179


180
181

182
183

184
185
186
187
188
189

190
191

192
193
194
195
196

197

198


199
200
201
202
203
204

205
206
207

208
209
210

211
212

213
214

215
216
217
218
219
220
221
222

223
224
225

226
227

228
229
230
231
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title></title>
	</head>
	<body>
    ADO.NET 2.0 SQLite Data Provider<br />
    Version 1.0.11 - Aug 1, 2005<br />
    Interop using SQLite 3.22<br />
    Written by Robert Simpson (<a href="mailto:robert@blackcastlesoft.com">robert@blackcastlesoft.com</a>)<br />
    Released to the public domain, use at your own risk!<br />
    <br />
    This provider was written and tested using the Visual Studio 2005 Beta 2 release.<br />

    <br />
    The latest version can be downloaded <a href="http://sourceforge.net/projects/sqlite-dotnet2">here</a>

    <br />
    <br />

    <b></b>
    <h2>
      <b>Features:</b><br />
    </h2>
    <ul>

      <li>DbProviderFactory support, just add the XML below at the machine.config and/or app.config level. </li>


      <li>Full support for ATTACH'ed databases.&nbsp; Exposed as <i>Catalogs</i> in the
        schema.&nbsp; When cloning a connection, all attached databases are automatically
        re-attached to the new connection.</li>

      <li>DbConnection.GetSchema(...) support includes the <i>MetaDataCollections</i>, <i>
        DataSourceInformation</i>, <i>Columns</i>, <i>Tables</i>, <i>Views</i>, <i>Catalogs</i>
        and <i>Indexes</i> keywords.</li>

      <li>Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace
        and detailed schema information even for complex queries.</li>

      <li>Named and unnamed parameters.</li>

      <li>Full UTF-8 and UTF-16 support.</li>

      <li>Multiple simultaneous DataReaders (one DataReader per Command however).</li>

      <li>Full support for user-defined scalar and aggregate functions, encapsulated into
        an
        easy-to-use base class in which only a couple of overrides are necessary to implement
        new SQL functions.</li>

      <li>Full support for user-defined collating sequences, every bit as simple to implement
        as user-defined functions and uses the same base class.</li></ul>
    <strong></strong>
    <h2>
      <strong>Compiling:</strong></h2>

    In order to use the SQLiteFactory and have the SQLite data provider enumerated in
    the DbProviderFactories methods, you must add the following segment into either
    your application's app.config or the system's machine.config located in the %SystemRoot%\Microsoft.Net\Framework\v2.xxxx\Config
    folder:<br />

    <br />
    <pre>
&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite" support="3F" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;
</pre>
    <br />
    <h3>
      Compiling for the Compact Framework</h3>
    <p>
      I've fully planned to support the Compact Framework in this SQLite wrapper, and
      will be getting on with it shortly.&nbsp; It requires a few tweaks to the SQLite
      source distribution, but nothing insurmountable.</p>





    <h2>












      <b>Development Notes Regarding the SQLite 3 Source Code</b></h2>
      <p></p>
    <p>
      Steps for merging the sqlite3 core codebase:</p>
    <p>
      <strong>This section is obsolete, but remains for historical purposes.&nbsp; The 1.0.11+
        versions of the ADO.NET 2.0 SQLite provider make significant changes to the core
        sqlite3 codebase in order to support C++ /clr compiling.&nbsp; Specifically, all
        the implicit casts throughout the core codebase must be modified.&nbsp; There are
        several hundred of these casts and they must be fixed up every time a new sqlite
        version is released.</strong></p>
    <ol>

      <li>Download the latest sqlite3 source from <a href="http://www.sqlite.org/download.html">
        http://www.sqlite.org/download.html</a></li>


      <li>Extract the source code to the <b>SQLite.Interop\src</b> directory of this project</li>


      <li>Open the <b>src\select.c</b> file.</li>

      <li>Add <b>#include "../interop.h" </b>to the top of the file where the other include's

        are.</li>

      <li>Scroll down the <b>select.c</b> file to around line <b>748</b>.&nbsp; Change the name of the function <b>static void generateColumnNames </b>to
    <b>static void _generateColumnNames</b> (<i>note the underscore in front of the name</i>).</li>



      <li>Compile it.</li>
    </ol>
      <b>
      </b>
    <h2>
    <b>Version History</b></h2>









    <b>1.11 - August 1, 2005</b><br />
    <ul>

      <li><strong>For everything except the Compact Framework, System.Data.SQLite.DLL is
        now the <em>only</em> DLL required to use this provider!</strong>&nbsp; The assembly
        is now a multi-module assembly, containing both the native SQLite3 codebase and
        the C# classes built on top of it.&nbsp; The Compact Framework version (when completed)
        will not be able to support this feature, so backwards compatibility with the Compact
        Framework has been preserved for the future.</li>

      <li>Fixed a bug in SQLiteCommand.ExecuteScalar() that caused it to stop executing
        commands once it obtained the first column of the first row-returning resultset.&nbsp;
        Any remaining statements after the row-returning statement was ignored.</li>

    </ul>
    <b>1.10 - June 10, 2005</b><br />
    <ul>

      <li>Fixed a bug in the SQLite3.cs Prepare() function that created a statement even when the SQLite engine returned a NULL pointer.

          Typically this occurs when multiple statements are processed and there are trailing comments at the end of the statement.</li>


      <li>Fixed a bug in SQLiteStatement.cs that retrieved parameter names for a parameterized
        query.&nbsp; SQLite's parameters are 1-based, and the function was starting at 0.&nbsp;
        This was fine when all parameters were unnamed, but for named parameters it caused
        the parameters to be out of whack.</li>
    </ul>
    <b>1.09a - May 25, 2005</b><br />
    <ul>

      <li>Fixed a broken helpfile and corrected some obsolete help remarks in SQLiteFunction.cs</li><li>Added a version resource to the SQLite.Interop.DLL.&nbsp;</li></ul>

    <b>1.09 - May 24, 2005</b><br />
    <ul>

      <li>Code merge with the latest 3.21 version of SQLite. </li>

      <li>Removed obsolete methods and properties for Whidbey Beta 2</li></ul>
    <b>1.08 Refresh - Mar 24, 2005<br /></b>

    <ul>

      <li>Code merge with the latest 3.20 version of SQLite.</li>

      <li>Recompiled the help file to fix a build error in it.</li>
    </ul>
    <b>1.08 - Mar 11, 2005<br />
    </b>
    <ul>

      <li>Added additional #if statements to support the old beta 1 edition of VS2005.</li>

      <li>Code merged the SQLite 3.14 source.</li>
    </ul>
    <b>1.07 - Mar 5, 2005</b><br />
      <ul>

        <li>Made more optimizations to frequently-called functions, resulting in significant
          performance gains in all tests. </li>
        <li>
      Recompiled the binaries using the latest VS2005 February CTP, resulting in yet more
      significant speed gains.&nbsp; The 100k insert test used to take 3.5 seconds and
      the insertwithidentity took almost 8 seconds.&nbsp; With the above two changes,
      those tests are now executing in 1.9 and 4.9 seconds respectively.</LI></UL><p>
        <b>

        1.06 - Mar 1, 2005<br />
        </b>
      </p>
    <ul>

      <li>Speed-ups to SQLiteDataReader.&nbsp; It was interop'ing unnecessarily every time it tried to
        fetch a field due to a logic error.</li>

      <li>Changed/Added some code to SQLiteConvert's internal DbType, Type and TypeAffinity
        functions.</li>

      <li>Fixed the SQLiteDataReader to obey the flags set in the optional CommandBehavior
        flag from SQLiteCommand.ExecuteReader().</li>

		<li>Changed the default page size to 1024 to reflect the defaults of 
		SQLite.&nbsp; Ignores the &quot;Page Size&quot; connection string option for 
		memory databases, as tests revealed that changing it resulted in memory 
		corruption errors.</li>

      <li>Performance enhancements to the SQLiteCommand and SQLiteStatement classes which
        reduced the 100,000 row insert execution time as well as the various Function execution
        times significantly.</li>
    </ul>
    <b>
      <br />
        1.05 - Feb 25, 2005</b>
    <ul>

      <li>Fixed the SQLite3 C# class step/reset functions to accomodate schema changes
        that invalidate a prepared statement.&nbsp; Statements are recompiled transparently.</li>


      <li>Moved all native DLL declarations to an UnsafeNativeMethods class.</li>

      <li>Split several classes into their own modules for readability.</li>

      <li>Renamed many internal variables, reviewed access to variables marked as internal
        and altered their protection levels accordingly.</li>

      <li>Due to the presence of the altered sqlite3 codebase and so many added interop
        functions, I decided to rename the sqlite3 C project and the DLL to SQLite.Interop.DLL.&nbsp;
        This is the same core sqlite3 codebase but designed specifically for this
        ADO.NET provider.&nbsp; This eliminates any possibility of someone dropping another
        build of sqlite3.dll into the system and rendering the provider inoperable.&nbsp;
        In the future if the folks at sqlite.org finally introduce a method of retrieving

        column usage for an arbitrary prepared statement, I'll retool this library to be
        a lightweight function call wrapper around the core binary distribution.</li>

      <li>Added [SuppressUnmanagedCodeSecurity] attribute to the UnsafeNativeMethods class
        which brings VS2005 November CTP execution speeds inline with the December CTP.</li>


		<li>Added a <b>bin</b> directory to the project root where pre-compiled 
		binaries can be found.</li>

		<li>Added a <b>doc</b> directory where preliminary documentation on the 
		class library can be found.</li>

		<li>Documented a lot more of the classes internally.</li>
    </ul>
      <b>
        <br />
        1.04 - Feb 24, 2005</b>
    <ul>

      <li>Removed the SQLiteContext class and revamped the way UserFunctions work to simplify
        the imlementation.</li>

      <li>Fixed a counting bug in the TestCases class, specifically in the function tests
        where I wasn't resetting the counter and it was consequently reporting intrinsic
        and raw select calls as being much much faster than they actually were.&nbsp; The
        numbers are now much closer to what I expected for performance, with .NET user-functions
        still being the slowest, but only by a small margin.</li>

      <li>Small performance tweaks to SQLiteDataReader.</li>

      <li>Added PageSize to the SQLiteConnectionStringBuilder and subsequently to the SQLiteConnection</li>


      <li>Added a PRAGMA encoding=XXX execution statement to the SQLiteConnection after
        opening a connection.</li>
    </ul>
      <b>
        1.03 - Feb 23, 2005</b>
    <ul>

      <li>Fixed up SQLiteCommandBuilder to correct implementation errors, which resulted
        in an enormous performance boost in the InsertMany test.&nbsp;&nbsp; 10,000 row
        insert that executed in 1500ms now executes in 500ms.</li>

      <li>Fixed several errors in the SQLite3_UTF16 class.&nbsp; ToString() was working
        incorrectly and the Open() method failed to register user defined functions and
        collations.</li>

      <li>Fixed a bug in SQLiteCommand.ClearCommands() whereby only the first statement
        was being properly cleaned up.</li>

      <li>Fixed a bug in SQLiteDataReader whereby calling NextResult() would not properly
        reset the previously-executed command in the sequence.</li>

      <li>Added an InsertManyWithIdentityFetch test, which appends a select clause to populate
        the ID of the last inserted row into the InsertCommand, demonstrating ADO.NET's
        ability to auto-fetch identity columns on insert.</li>
    </ul>
    <p>
      <b>
        1.02 - Feb 21, 2005</b></p>
    <ul>

      <li>Tweaks to the xxx_interop functions that return char *'s, so they also return
        the length.&nbsp; Saves an interop call to get the UTF-8 string length during conversion
        to a .NET string.</li>

      <li>Reworked the whole interop.c thing into interop.h and reduced the code required
        to merge the main sqlite3 codebase.</li>

      <li>Added support for user-defined collations.</li>
    </ul>
	</body>
</html>


|
|
|
|
|
|
|
|
|
|
|
>
|
|
>
|
|
<


|


>
|
>
>
|
|
|
>
|
|
|
>
|
|
>
|
>
|
>
|
>
|
<
|
|
>
|
|


<
>
|
|
|
<
>
|









|



|
|
|
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
|
|



|
|
|
|
|
|

>
|
|
>
>
|
>
>
|
>
|
>
|
>
|
|
>
>
>
|

<
|

|
>
>
>
>
>
>
>
>
>
|

>
|
|
|
|
|
|
>
|
|
|
>

|

>
|
>
|
>
>
|
|
|
|

|

>
|
>
|

>
|
>
|
|
>

>
|
>
|

|


>
|
>
|

|
|
>
|
|
|
|
|
|
|
<
>
|
|
|

>
|
|
>
|
|
>
|
|
>
|
|
|
<
>
|
|
|


|
|

>
|
|
>
>
|
>
|
>
|
|
>
|
|
|
|
|
|
>
|
|
>
|
|
>
>
|
|
>
|
|
>
|

|
|
|

>
|
|
>
|
|
|
|
|
>
|
>
|
>
>
|


<
|

>
|
|
|
>
|
|
|
>
|
|
>
|
|
>
|
|
|


<
|

>
|
|
|
>
|
|
>
|

|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

47
48
49
50
51
52
53

54
55
56
57

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203

204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308

309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
  </head>
  <body>
    ADO.NET 2.0 SQLite Data Provider<br>
    Version 1.0.12 - Aug 2, 2005<br>
    Interop using SQLite 3.22<br>
    Written by Robert Simpson (<a href="mailto:robert@blackcastlesoft.com">robert@blackcastlesoft.com</a>)<br>
    Released to the public domain, use at your own risk!<br>
    <br>
    This provider was written and tested using the Visual Studio 2005 Beta 2 
    release.<br>
    <br>
    The latest version can be downloaded <a href="http://sourceforge.net/projects/sqlite-dotnet2">
      here</a>
    <br>
    <br>

    <b></b>
    <h2>
      <b>Features:</b><br>
    </h2>
    <ul>
      <li>
      DbProviderFactory support, just add the XML below at the machine.config and/or 
      app.config level.
      <li>
        Full support for ATTACH'ed databases.&nbsp; Exposed as <i>Catalogs</i>
      in the schema.&nbsp; When cloning a connection, all attached databases are 
      automatically re-attached to the new connection.
      <li>
        DbConnection.GetSchema(...) support includes the <i>MetaDataCollections</i>, <i>DataSourceInformation</i>,
        <i>Columns</i>, <i>Tables</i>, <i>Views</i>, <i>Catalogs</i> and <i>Indexes</i>
      keywords.
      <li>
      Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace 
      and detailed schema information even for complex queries.
      <li>
      Named and unnamed parameters.
      <li>
      Full UTF-8 and UTF-16 support.
      <li>
      Multiple simultaneous DataReaders (one DataReader per Command however).
      <li>
      Full support for user-defined scalar and aggregate functions, encapsulated into 

      an easy-to-use base class in which only a couple of overrides are necessary to 
      implement new SQL functions.
      <li>
        Full support for user-defined collating sequences, every bit as simple to 
        implement as user-defined functions and uses the same base class.</li></ul>
    <strong></strong>
    <h2>

      <strong>DbFactory Support (Non-Compact Framework)</strong></h2>
    In order to use the SQLiteFactory and have the SQLite data provider enumerated 
    in the DbProviderFactories methods, you must add the following segment into 
    either your application's app.config or the system's machine.config located in 

    the %SystemRoot%\Microsoft.Net\Framework\v2.xxxx\Config folder:<br>
    <br>
    <pre>
&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite" support="3F" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;
</pre>
    <br>
    <h3>
      Compiling for the Compact Framework</h3>
    <p>
      Just change the target platform from Win32 to Compact Framework and 
      recompile.&nbsp; <STRONG>The Compact Framework has no support for enumerating 
        attributes in an assembly, therefore all user-defined collating sequences and 
        functions must be explicitly registered.</STRONG>&nbsp; See the <STRONG>testce</STRONG>
      sample application for an example of how to explicitly register user-defined 
      collating sequences and functions.</p>
    <P>Many thanks to the fine folks at <A href="http://sourceforge.net/projects/sqlite-wince">
        http://sourceforge.net/projects/sqlite-wince</A> for the Windows CE code!</P>
    <h2>
      <b><A name="redist"></A>Distributing The SQLite Engine and ADO.NET Assembly</b></h2>
    <P>For Win32 platforms, only the <STRONG>System.Data.SQLite.DLL</STRONG> file in 
      the <STRONG>bin</STRONG> folder should be distributed with your 
      application(s).&nbsp; This DLL contains both the managed wrapper and the native 
      SQLite3 codebase.</P>
    <P>For Compact Framework platforms, your application should reference the <STRONG>System.Data.SQLite.DLL</STRONG>
      file in the <STRONG>bin\CompactFramework</STRONG> folder.&nbsp; The <STRONG>System.Data.SQLite.DLL</STRONG>
      and <STRONG>SQLite.Interop.DLL</STRONG> files from the <STRONG>bin\CompactFramework</STRONG>
      folder must be distributed with your application(s).&nbsp; They contain the 
      managed wrapper and the native SQLite3 codebase respectively.&nbsp; The Compact 
      Framework does not currently support managed C++, thus the reason for two 
      files.</P>
    <H2><B>Development Notes Regarding the SQLite 3 Source Code</B></H2>
    <p></p>
    <p>
      Steps for merging the sqlite3 core codebase:</p>
    <p>
      <strong>This section is obsolete, but remains for historical purposes.&nbsp; The 
        1.0.11+ versions of the ADO.NET 2.0 SQLite provider make significant changes to 
        the core sqlite3 codebase in order to support C++ /clr compiling.&nbsp; 
        Specifically, all the implicit casts throughout the core codebase must be 
        modified.&nbsp; There are several hundred of these casts and they must be fixed 
        up every time a new sqlite version is released.</strong></p>
    <ol>
      <li>
        <FONT color="silver">Download the latest sqlite3 source from </FONT><a href="http://www.sqlite.org/download.html">
          <FONT color="silver">http://www.sqlite.org/download.html</FONT></a><FONT color="silver">
        </FONT>
      <li>
        <FONT color="silver">Extract the source code to the <b>SQLite.Interop\src</b> directory 
          of this project </FONT>
      <li>
        <FONT color="silver">Open the <b>src\select.c</b> file. </FONT>
      <li>
        <FONT color="silver">Add <b>#include "../interop.h" </b>to the top of the file 
          where the other include's are. </FONT>
      <li>
        <FONT color="silver">Scroll down the <b>select.c</b> file to around line <b>748</b>.&nbsp; 
          Change the name of the function <b>static void generateColumnNames </b>to <b>static 
            void _generateColumnNames</b> (<i>note the underscore in front of the name</i>).
        </FONT>
      <li>
        <FONT color="silver">Compile it. </FONT>
      </li>
    </ol>

    <b></b>
    <h2>
      <b>Version History</b></h2>
    <b>1.0.12 - August 2, 2005</b><br>
    <ul>
      <li>
        Full support for the Compact Framework.&nbsp; Each build (Debug/Release) now 
        has a&nbsp;platform, either Win32 or Compact Framework.&nbsp; The correct 
        projects are built accordingly.&nbsp; See the&nbsp;<a href="#redist">Distributing 
          SQLite</a> section for information on what files need to be distributed for 
        each platform.&nbsp;</li>
    </ul>
    <b>1.0.11 - August 1, 2005</b><br>
    <ul>
      <li>
        <strong>For everything except the Compact Framework, System.Data.SQLite.DLL is 
          now the <em>only</em> DLL required to use this provider!</strong>&nbsp; The 
      assembly is now a multi-module assembly, containing both the native SQLite3 
      codebase and the C# classes built on top of it.&nbsp; The Compact Framework 
      version (when completed) will not be able to support this feature, so backwards 
      compatibility with the Compact Framework has been preserved for the future.
      <li>
        Fixed a bug in SQLiteCommand.ExecuteScalar() that caused it to stop executing 
        commands once it obtained the first column of the first row-returning 
        resultset.&nbsp; Any remaining statements after the row-returning statement was 
        ignored.</li>
    </ul>
    <b>1.0.10 - June 10, 2005</b><br>
    <ul>
      <li>
      Fixed a bug in the SQLite3.cs Prepare() function that created a statement even 
      when the SQLite engine returned a NULL pointer. Typically this occurs when 
      multiple statements are processed and there are trailing comments at the end of 
      the statement.
      <li>
        Fixed a bug in SQLiteStatement.cs that retrieved parameter names for a 
        parameterized query.&nbsp; SQLite's parameters are 1-based, and the function 
        was starting at 0.&nbsp; This was fine when all parameters were unnamed, but 
        for named parameters it caused the parameters to be out of whack.</li>
    </ul>
    <b>1.0.09a - May 25, 2005</b><br>
    <ul>
      <li>
      Fixed a broken helpfile and corrected some obsolete help remarks in 
      SQLiteFunction.cs<li>Added a version resource to the SQLite.Interop.DLL.&nbsp;</li></ul>
    <b>1.0.09 - May 24, 2005</b><br>
    <ul>
      <li>
      Code merge with the latest 3.21 version of SQLite.
      <li>
        Removed obsolete methods and properties for Whidbey Beta 2</li></ul>
    <b>1.0.08 Refresh - Mar 24, 2005<br>
    </b>
    <ul>
      <li>
      Code merge with the latest 3.20 version of SQLite.
      <li>
        Recompiled the help file to fix a build error in it.</li>
    </ul>
    <b>1.0.08 - Mar 11, 2005<br>
    </b>
    <ul>
      <li>
      Added additional #if statements to support the old beta 1 edition of VS2005.
      <li>
        Code merged the SQLite 3.14 source.</li>
    </ul>
    <b>1.0.07 - Mar 5, 2005</b><br>
    <ul>
      <li>
      Made more optimizations to frequently-called functions, resulting in 
      significant performance gains in all tests.
      <li>
        Recompiled the binaries using the latest VS2005 February CTP, resulting in yet 
        more significant speed gains.&nbsp; The 100k insert test used to take 3.5 
        seconds and the insertwithidentity took almost 8 seconds.&nbsp; With the above 
        two changes, those tests are now executing in 1.9 and 4.9 seconds respectively.</li></ul>

    <p>
      <b>1.0.06 - Mar 1, 2005<br>
      </b>
    </p>
    <ul>
      <li>
      Speed-ups to SQLiteDataReader.&nbsp; It was interop'ing unnecessarily every 
      time it tried to fetch a field due to a logic error.
      <li>
      Changed/Added some code to SQLiteConvert's internal DbType, Type and 
      TypeAffinity functions.
      <li>
      Fixed the SQLiteDataReader to obey the flags set in the optional 
      CommandBehavior flag from SQLiteCommand.ExecuteReader().
      <li>
      Changed the default page size to 1024 to reflect the defaults of SQLite.&nbsp; 
      Ignores the "Page Size" connection string option for memory databases, as tests 
      revealed that changing it resulted in memory corruption errors.

      <li>
        Performance enhancements to the SQLiteCommand and SQLiteStatement classes which 
        reduced the 100,000 row insert execution time as well as the various Function 
        execution times significantly.</li>
    </ul>
    <b>
      <br>
      1.0.05 - Feb 25, 2005</b>
    <ul>
      <li>
      Fixed the SQLite3 C# class step/reset functions to accomodate schema changes 
      that invalidate a prepared statement.&nbsp; Statements are recompiled 
      transparently.
      <li>
      Moved all native DLL declarations to an UnsafeNativeMethods class.
      <li>
      Split several classes into their own modules for readability.
      <li>
      Renamed many internal variables, reviewed access to variables marked as 
      internal and altered their protection levels accordingly.
      <li>
      Due to the presence of the altered sqlite3 codebase and so many added interop 
      functions, I decided to rename the sqlite3 C project and the DLL to 
      SQLite.Interop.DLL.&nbsp; This is the same core sqlite3 codebase but designed 
      specifically for this ADO.NET provider.&nbsp; This eliminates any possibility 
      of someone dropping another build of sqlite3.dll into the system and rendering 
      the provider inoperable.&nbsp; In the future if the folks at sqlite.org finally 
      introduce a method of retrieving column usage for an arbitrary prepared 
      statement, I'll retool this library to be a lightweight function call wrapper 
      around the core binary distribution.
      <li>
      Added [SuppressUnmanagedCodeSecurity] attribute to the UnsafeNativeMethods 
      class which brings VS2005 November CTP execution speeds inline with the 
      December CTP.
      <li>
        Added a <b>bin</b>
      directory to the project root where pre-compiled binaries can be found.
      <li>
        Added a <b>doc</b>
      directory where preliminary documentation on the class library can be found.
      <li>
        Documented a lot more of the classes internally.</li>
    </ul>
    <b>
      <br>
      1.0.04 - Feb 24, 2005</b>
    <ul>
      <li>
      Removed the SQLiteContext class and revamped the way UserFunctions work to 
      simplify the imlementation.
      <li>
      Fixed a counting bug in the TestCases class, specifically in the function tests 
      where I wasn't resetting the counter and it was consequently reporting 
      intrinsic and raw select calls as being much much faster than they actually 
      were.&nbsp; The numbers are now much closer to what I expected for performance, 
      with .NET user-functions still being the slowest, but only by a small margin.
      <li>
      Small performance tweaks to SQLiteDataReader.
      <li>
      Added PageSize to the SQLiteConnectionStringBuilder and subsequently to the 
      SQLiteConnection
      <li>
        Added a PRAGMA encoding=XXX execution statement to the SQLiteConnection after 
        opening a connection.</li>
    </ul>

    <b>1.0.03 - Feb 23, 2005</b>
    <ul>
      <li>
      Fixed up SQLiteCommandBuilder to correct implementation errors, which resulted 
      in an enormous performance boost in the InsertMany test.&nbsp;&nbsp; 10,000 row 
      insert that executed in 1500ms now executes in 500ms.
      <li>
      Fixed several errors in the SQLite3_UTF16 class.&nbsp; ToString() was working 
      incorrectly and the Open() method failed to register user defined functions and 
      collations.
      <li>
      Fixed a bug in SQLiteCommand.ClearCommands() whereby only the first statement 
      was being properly cleaned up.
      <li>
      Fixed a bug in SQLiteDataReader whereby calling NextResult() would not properly 
      reset the previously-executed command in the sequence.
      <li>
        Added an InsertManyWithIdentityFetch test, which appends a select clause to 
        populate the ID of the last inserted row into the InsertCommand, demonstrating 
        ADO.NET's ability to auto-fetch identity columns on insert.</li>
    </ul>
    <p>

      <b>1.0.02 - Feb 21, 2005</b></p>
    <ul>
      <li>
      Tweaks to the xxx_interop functions that return char *'s, so they also return 
      the length.&nbsp; Saves an interop call to get the UTF-8 string length during 
      conversion to a .NET string.
      <li>
      Reworked the whole interop.c thing into interop.h and reduced the code required 
      to merge the main sqlite3 codebase.
      <li>
        Added support for user-defined collations.</li>
    </ul>
  </body>
</html>

Changes to test/test.csproj.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
..
59
60
61
62
63
64
65







66
67
68
69
70
    <ApplicationVersion>1.0.0.*</ApplicationVersion>
    <BootstrapperEnabled>true</BootstrapperEnabled>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>.\bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>
    </DefineConstants>
    <PlatformTarget>x86</PlatformTarget>
    <FileAlignment>512</FileAlignment>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Data.SQLite, Version=1.0.11.21762, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
................................................................................
  <ItemGroup>
    <BootstrapperFile Include="Microsoft.Net.Framework.2.0">
      <InProject>False</InProject>
      <ProductName>.NET Framework 2.0</ProductName>
      <Install>true</Install>
    </BootstrapperFile>
  </ItemGroup>







  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>







|

|







|







 







>
>
>
>
>
>
>





23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
..
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
    <ApplicationVersion>1.0.0.*</ApplicationVersion>
    <BootstrapperEnabled>true</BootstrapperEnabled>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>
    </DefineConstants>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <FileAlignment>512</FileAlignment>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Data.SQLite, Version=1.0.11.21762, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
................................................................................
  <ItemGroup>
    <BootstrapperFile Include="Microsoft.Net.Framework.2.0">
      <InProject>False</InProject>
      <ProductName>.NET Framework 2.0</ProductName>
      <Install>true</Install>
    </BootstrapperFile>
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
      <InProject>False</InProject>
      <ProductName>.NET Framework 2.0 Beta</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>

Added testce/AssemblyInfo.cs.



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cetest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cetest")]
[assembly: AssemblyCopyright("Copyright   2005")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM componenets.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("308969a2-e089-42db-afe3-bf564d8d62c3")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.0.0")]

Added testce/Form1.Designer.cs.

































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
namespace test
{
	partial class Form1
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
		private System.Windows.Forms.MainMenu mainMenu1;

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}

		#region Windows Form Designer generated code

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
      this.mainMenu1 = new System.Windows.Forms.MainMenu();
      this.textBox1 = new System.Windows.Forms.TextBox();
      this.SuspendLayout();
      // 
      // textBox1
      // 
      this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.textBox1.Location = new System.Drawing.Point(0, 0);
      this.textBox1.Multiline = true;
      this.textBox1.Name = "textBox1";
      this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
      this.textBox1.Size = new System.Drawing.Size(240, 268);
      this.textBox1.TabIndex = 0;
      this.textBox1.WordWrap = false;
      // 
      // Form1
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
      this.ClientSize = new System.Drawing.Size(240, 268);
      this.Controls.Add(this.textBox1);
      this.Menu = this.mainMenu1;
      this.Name = "Form1";
      this.Text = "Form1";
      this.ResumeLayout(false);

		}

		#endregion

		private System.Windows.Forms.TextBox textBox1;
	}
}

Added testce/Form1.cs.

























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace test
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		public void WriteLine(string str)
		{
			textBox1.Text += str + "\r\n";
		}

    public void Write(string str)
    {
      textBox1.Text += str;
    }
	}
}

Added testce/Form1.resx.























































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>17, 17</value>
  </metadata>
  <metadata name="$this.Skin" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>True</value>
  </metadata>
</root>

Added testce/Program.cs.































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Data;
using System.Text;
using System.Data.Common;
using System.Data.SQLite;

namespace test
{
  class Program
  {
    [MTAThread]
    static void Main()
    {
      DbConnection cnn;

      //fact = DbProviderFactories.GetFactory("System.Data.SqlClient");
      //using (cnn = fact.CreateConnection())
      //{
      //  cnn.ConnectionString = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=dlink;Data Source=(LOCAL)";
      //  cnn.Open();
      //  TestCases.Run(fact, cnn);
      //}
//      cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Temp\\db.mdb;Persist Security Info=False";
//      cnn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DirectLink;Data Source=MASTER";
//      cnn.Open();

//      TestCases.Run(fact, cnn);

      SQLiteFunction.RegisterFunction(typeof(TestFunc));
      SQLiteFunction.RegisterFunction(typeof(MyCount));
      SQLiteFunction.RegisterFunction(typeof(MySequence));

      using (cnn = new SQLiteConnection())
      {
        TestCases tests = new TestCases();

        cnn.ConnectionString = "Data Source=test.db3";
        cnn.Open();
        tests.Run(cnn);

        System.Windows.Forms.Application.Run(tests.frm);
      }

      System.IO.File.Delete("test.db3");
    }
  }
}

Added testce/TestCases.cs.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
using System;
using System.Data.Common;
using System.Data;
using System.Data.SQLite;

namespace test
{

  /// <summary>
  /// Scalar user-defined function.  In this example, the same class is declared twice with 
  /// different function names to demonstrate how to use alias names for user-defined functions.
  /// </summary>
  [SQLiteFunction(Name = "Foo", Arguments = 2, FuncType = FunctionType.Scalar)]
  [SQLiteFunction(Name = "TestFunc", Arguments = 2, FuncType = FunctionType.Scalar)]
  class TestFunc : SQLiteFunction
  {
    public override object Invoke(object[] args)
    {
      if (args[0].GetType() != typeof(int)) return args[0];

      int Param1 = Convert.ToInt32(args[0]); // First parameter
      int Param2 = Convert.ToInt32(args[1]); // Second parameter

      return Param1 + Param2;
    }
  }

  /// <summary>
  /// Aggregate user-defined function.  Arguments = -1 means any number of arguments is acceptable
  /// </summary>
  [SQLiteFunction(Name = "MyCount", Arguments = -1, FuncType = FunctionType.Aggregate)]
  class MyCount : SQLiteFunction
  {
    public override void Step(object[] args, int nStep, ref object contextData)
    {
      if (contextData == null)
      {
        contextData = 1;
      }
      else
        contextData = (int)contextData + 1;
    }

    public override object Final(object contextData)
    {
      return contextData;
    }
  }

  /// <summary>
  /// User-defined collating sequence.
  /// </summary>
  [SQLiteFunction(Name = "MYSEQUENCE", FuncType = FunctionType.Collation)]
  class MySequence : SQLiteFunction
  {
    public override int Compare(string param1, string param2)
    {
      // Make sure the string "Field3" is sorted out of order
      if (param1 == "Field3") return 1;
      if (param2 == "Field3") return -1;
      return String.Compare(param1, param2, true);
    }
  }

  internal class TestCases
  {
    internal Form1 frm;

    internal void Run(DbConnection cnn)
    {
      frm = new Form1();

      frm.Show();

      frm.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());
      try { CreateTable(cnn); frm.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { frm.WriteLine("FAIL - CreateTable"); }

      try { InsertTable(cnn); frm.WriteLine("SUCCESS - InsertTable"); }
      catch (Exception) { frm.WriteLine("FAIL - InsertTable"); }

      try { VerifyInsert(cnn); frm.WriteLine("SUCCESS - VerifyInsert"); }
      catch (Exception) { frm.WriteLine("FAIL - VerifyInsert"); }

      try { CoersionTest(cnn); frm.WriteLine("FAIL - CoersionTest"); }
      catch (Exception) { frm.WriteLine("SUCCESS - CoersionTest"); }

      try { ParameterizedInsert(cnn); frm.WriteLine("SUCCESS - ParameterizedInsert"); }
      catch (Exception) { frm.WriteLine("FAIL - ParameterizedInsert"); }

      try { BinaryInsert(cnn); frm.WriteLine("SUCCESS - BinaryInsert"); }
      catch (Exception) { frm.WriteLine("FAIL - BinaryInsert"); }

      try { VerifyBinaryData(cnn); frm.WriteLine("SUCCESS - VerifyBinaryData"); }
      catch (Exception) { frm.WriteLine("FAIL - VerifyBinaryData"); }

      try { ParameterizedInsertMissingParams(cnn); frm.WriteLine("FAIL - ParameterizedInsertMissingParams"); }
      catch (Exception) { frm.WriteLine("SUCCESS - ParameterizedInsertMissingParams"); }

      try { InsertMany(cnn, false); frm.WriteLine("SUCCESS - InsertMany"); }
      catch (Exception) { frm.WriteLine("FAIL - InsertMany"); }

      try { InsertMany(cnn, true); frm.WriteLine("SUCCESS - InsertManyWithIdentityFetch"); }
      catch (Exception) { frm.WriteLine("FAIL - InsertManyWithIdentityFetch"); }

      try { IterationTest(cnn); frm.WriteLine("SUCCESS - Iteration Test"); }
      catch (Exception) { frm.WriteLine("FAIL - Iteration Test"); }

      try { UserFunction(cnn); frm.WriteLine("SUCCESS - UserFunction"); }
      catch (Exception) { frm.WriteLine("FAIL - UserFunction"); }

      try { UserAggregate(cnn); frm.WriteLine("SUCCESS - UserAggregate"); }
      catch (Exception) { frm.WriteLine("FAIL - UserAggregate"); }

      try { UserCollation(cnn); frm.WriteLine("SUCCESS - UserCollation"); }
      catch (Exception) { frm.WriteLine("FAIL - UserCollation"); }

      try { DropTable(cnn); frm.WriteLine("SUCCESS - DropTable"); }
      catch (Exception) { frm.WriteLine("FAIL - DropTable"); }

      frm.WriteLine("\r\nTests Finished.");
    }

    internal void CreateTable(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "CREATE TABLE TestCase (ID integer primary key autoincrement, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)";
        //cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)";
        cmd.ExecuteNonQuery();
      }
    }

    internal void DropTable(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "DROP TABLE TestCase";
        cmd.ExecuteNonQuery();
      }
    }

    internal void InsertTable(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(1, 3.14159, 'Field3', 'Field4', '2005-01-01 13:49:00')";
        cmd.ExecuteNonQuery();
      }
    }

    internal void VerifyInsert(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field1, Field2, Field3, Field4, Field5 FROM TestCase";
        cmd.Prepare();
        using (DbDataReader rd = cmd.ExecuteReader())
        {
          if (rd.Read())
          {
            long Field1 = rd.GetInt64(0);
            double Field2 = rd.GetDouble(1);
            string Field3 = rd.GetString(2);
            string Field4 = rd.GetString(3).TrimEnd();
            DateTime Field5 = rd.GetDateTime(4);

            if (Field1 != 1) throw new ArgumentOutOfRangeException("Non-Match on Field1");
            if (Field2 != 3.14159) throw new ArgumentOutOfRangeException("Non-Match on Field2");
            if (Field3 != "Field3") throw new ArgumentOutOfRangeException("Non-Match on Field3");
            if (Field4 != "Field4") throw new ArgumentOutOfRangeException("Non-Match on Field4");
            if (Field5.CompareTo(DateTime.Parse("2005-01-01 13:49:00")) != 0) throw new ArgumentOutOfRangeException("Non-Match on Field5");
          }
          else throw new ArgumentOutOfRangeException("No data in table");
        }
      }
    }

    internal void CoersionTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field1, Field2, Field3, Field4, Field5, 'A', 1, 1 + 1, 3.14159 FROM TestCase";
        using (DbDataReader rd = cmd.ExecuteReader())
        {
          if (rd.Read())
          {
            object Field1 = rd.GetInt32(0);
            object Field2 = rd.GetDouble(1);
            object Field3 = rd.GetString(2);
            object Field4 = rd.GetString(3).TrimEnd();
            object Field5 = rd.GetDateTime(4);

            // The next statement should cause an exception
            Field1 = rd.GetString(0);
            Field2 = rd.GetString(1);
            Field3 = rd.GetString(2);
            Field4 = rd.GetString(3);
            Field5 = rd.GetString(4);

            Field1 = rd.GetInt32(0);
            Field2 = rd.GetInt32(1);
            Field3 = rd.GetInt32(2);
            Field4 = rd.GetInt32(3);
            Field5 = rd.GetInt32(4);

            Field1 = rd.GetDecimal(0);
            Field2 = rd.GetDecimal(1);
            Field3 = rd.GetDecimal(2);
            Field4 = rd.GetDecimal(3);
            Field5 = rd.GetDecimal(4);
          }
          else throw new ArgumentOutOfRangeException("No data in table");
        }
      }
    }

    internal void ParameterizedInsert(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(?,?,?,?,?)";
        DbParameter Field1 = cmd.CreateParameter();
        DbParameter Field2 = cmd.CreateParameter();
        DbParameter Field3 = cmd.CreateParameter();
        DbParameter Field4 = cmd.CreateParameter();
        DbParameter Field5 = cmd.CreateParameter();

        Field1.Value = 2;
        Field2.Value = 3.14159;
        Field3.Value = "Param Field3";
        Field4.Value = "Field4 Par";
        Field5.Value = DateTime.Now;

        cmd.Parameters.Add(Field1);
        cmd.Parameters.Add(Field2);
        cmd.Parameters.Add(Field3);
        cmd.Parameters.Add(Field4);
        cmd.Parameters.Add(Field5);

        cmd.ExecuteNonQuery();
      }
    }

    internal void BinaryInsert(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "INSERT INTO TestCase(Field6) VALUES(?)";
        DbParameter Field6 = cmd.CreateParameter();

        byte[] b = new byte[4000];
        b[0] = 1;
        b[100] = 2;
        b[1000] = 3;
        b[2000] = 4;
        b[3000] = 5;

        Field6.Value = b;

        cmd.Parameters.Add(Field6);

        cmd.ExecuteNonQuery();
      }
    }

    internal void VerifyBinaryData(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL";
        byte[] b = new byte[4000];

        using (DbDataReader rd = cmd.ExecuteReader())
        {
          if (rd.Read() == false) throw new ArgumentOutOfRangeException();

          rd.GetBytes(0, 0, b, 0, 4000);

          if (b[0] != 1) throw new ArgumentException();
          if (b[100] != 2) throw new ArgumentException();
          if (b[1000] != 3) throw new ArgumentException();
          if (b[2000] != 4) throw new ArgumentException();
          if (b[3000] != 5) throw new ArgumentException();
        }
      }
    }

    internal void ParameterizedInsertMissingParams(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, Field3, Field4, Field5) VALUES(?,?,?,?,?)";
        DbParameter Field1 = cmd.CreateParameter();
        DbParameter Field2 = cmd.CreateParameter();
        DbParameter Field3 = cmd.CreateParameter();
        DbParameter Field4 = cmd.CreateParameter();
        DbParameter Field5 = cmd.CreateParameter();

        Field1.DbType = System.Data.DbType.Int32;

        Field1.Value = 2;
        Field2.Value = 3.14159;
        Field3.Value = "Field3 Param";
        Field4.Value = "Field4 Par";
        Field5.Value = DateTime.Now;

        cmd.Parameters.Add(Field1);
        cmd.Parameters.Add(Field2);
        cmd.Parameters.Add(Field3);
        cmd.Parameters.Add(Field4);

        // Assertion here, not enough parameters
        cmd.ExecuteNonQuery();
      }
    }

    // Utilizes the SQLiteCommandBuilder, which in turn utilizes SQLiteDataReader's GetSchemaTable() functionality
    internal void InsertMany(DbConnection cnn, bool bWithIdentity)
    {
      int nmax = 1000;

      using (DbTransaction dbTrans = cnn.BeginTransaction())
      {
        using (DbDataAdapter adp = new SQLiteDataAdapter())
        {
          using (DbCommand cmd = cnn.CreateCommand())
          {
            cmd.Transaction = dbTrans;
            cmd.CommandText = "SELECT * FROM TestCase WHERE 1=2";
            adp.SelectCommand = cmd;

            using (DbCommandBuilder bld = new SQLiteCommandBuilder())
            {
              bld.DataAdapter = adp;
              adp.InsertCommand = bld.GetInsertCommand();

              if (bWithIdentity)
              {
                adp.InsertCommand.CommandText += ";SELECT [ID] FROM TestCase WHERE RowID = last_insert_rowid()";
                adp.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;
              }

              using (DataTable tbl = new DataTable())
              {
                adp.Fill(tbl);
                for (int n = 0; n < nmax; n++)
                {
                  DataRow row = tbl.NewRow();
                  row[1] = n + nmax;
                  tbl.Rows.Add(row);
                }

                frm.Write(String.Format("          InsertMany{0} ({1} rows) Begins ... ", (bWithIdentity == true) ? "WithIdentityFetch":"                 ", nmax));
                long dtStart = DateTime.Now.Ticks;
                adp.Update(tbl);
                long dtEnd = DateTime.Now.Ticks;
                dtEnd -= dtStart;
                frm.Write(String.Format("Ends in {0} ms ... ", (dtEnd / 10000)));

                dtStart = DateTime.Now.Ticks;
                dbTrans.Commit();
                dtEnd = DateTime.Now.Ticks;
                dtEnd -= dtStart;
                frm.WriteLine(String.Format("Commits in {0} ms", (dtEnd / 10000)));
              }
            }
          }
        }
      }
    }

    // Causes the user-defined function to be called
    internal void UserFunction(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        int nTimes;
        long dtStart;

        nTimes = 0;
        cmd.CommandText = "SELECT Foo('ee','foo')";
        dtStart = DateTime.Now.Ticks;
        while (DateTime.Now.Ticks - dtStart < 10000000)
        {
          cmd.ExecuteNonQuery();
          nTimes++;
        }
        frm.WriteLine(String.Format("          User (text)  command executed {0} times in 1 second.", nTimes));

        nTimes = 0;
        cmd.CommandText = "SELECT Foo(10,11)";
        dtStart = DateTime.Now.Ticks;
        while (DateTime.Now.Ticks - dtStart < 10000000)
        {
          cmd.ExecuteNonQuery();
          nTimes++;
        }
        frm.WriteLine(String.Format("          UserFunction command executed {0} times in 1 second.", nTimes));

        nTimes = 0;
        cmd.CommandText = "SELECT ABS(1)";
        dtStart = DateTime.Now.Ticks;
        while (DateTime.Now.Ticks - dtStart < 10000000)
        {
          cmd.ExecuteNonQuery();
          nTimes++;
        }
        frm.WriteLine(String.Format("          Intrinsic    command executed {0} times in 1 second.", nTimes));

        nTimes = 0;
        cmd.CommandText = "SELECT lower('FOO')";
        dtStart = DateTime.Now.Ticks;
        while (DateTime.Now.Ticks - dtStart < 10000000)
        {
          cmd.ExecuteNonQuery();
          nTimes++;
        }
        frm.WriteLine(String.Format("          Intrin (txt) command executed {0} times in 1 second.", nTimes));

        nTimes = 0;
        cmd.CommandText = "SELECT 1";
        dtStart = DateTime.Now.Ticks;
        while (DateTime.Now.Ticks - dtStart < 10000000)
        {
          cmd.ExecuteNonQuery();
          nTimes++;
        }
        frm.WriteLine(String.Format("          Raw Value    command executed {0} times in 1 second.", nTimes));
      }
    }

    internal void IterationTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        long dtStart;
        long dtEnd;
        int nCount;
        long n;

        cmd.CommandText = "SELECT Foo(ID, ID) FROM TestCase";
        cmd.Prepare();
        dtStart = DateTime.Now.Ticks;
        nCount = 0;
        using (DbDataReader rd = cmd.ExecuteReader())
        {
          while (rd.Read())
          {
            n = rd.GetInt64(0);
            nCount++;
          }
          dtEnd = DateTime.Now.Ticks;
        }
        frm.WriteLine(String.Format("          User Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart) / 10000));

        cmd.CommandText = "SELECT ID FROM TestCase";
        cmd.Prepare();
        dtStart = DateTime.Now.Ticks;
        nCount = 0;
        using (DbDataReader rd = cmd.ExecuteReader())
        {
          while (rd.Read())
          {
            n = rd.GetInt64(0);
            nCount++;
          }
          dtEnd = DateTime.Now.Ticks;
        }
        frm.WriteLine(String.Format("          Raw iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart) / 10000));

        cmd.CommandText = "SELECT ABS(ID) FROM TestCase";
        cmd.Prepare();
        dtStart = DateTime.Now.Ticks;
        nCount = 0;
        using (DbDataReader rd = cmd.ExecuteReader())
        {
          while (rd.Read())
          {
            n = rd.GetInt64(0);
            nCount++;
          }
          dtEnd = DateTime.Now.Ticks;
        }
        frm.WriteLine(String.Format("          Intrinsic Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart) / 10000));

      }
    }

    // Causes the user-defined aggregate to be iterated through
    internal void UserAggregate(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        long dtStart;
        int n = 0;
        int nCount;

        cmd.CommandText = "SELECT MyCount(*) FROM TestCase";

        nCount = 0;
        dtStart = DateTime.Now.Ticks;
        while (DateTime.Now.Ticks - dtStart < 10000000)
        {
          n = Convert.ToInt32(cmd.ExecuteScalar());
          nCount++;
        }
        if (n != 2003) throw new ArgumentOutOfRangeException("Unexpected count");
        frm.WriteLine(String.Format("          UserAggregate executed {0} times in 1 second.", nCount));
      }
    }

    // Causes the user-defined collation sequence to be iterated through
    internal void UserCollation(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        // Using a default collating sequence in descending order, "Param Field3" will appear at the top
        // and "Field3" will be next, followed by a NULL.  Our user-defined collating sequence will 
        // deliberately place them out of order so Field3 is first.
        cmd.CommandText = "SELECT Field3 FROM TestCase ORDER BY Field3 COLLATE MYSEQUENCE DESC";
        string s = (string)cmd.ExecuteScalar();
        if (s != "Field3") throw new ArgumentOutOfRangeException("MySequence didn't sort properly");
      }
    }
  }
}

Added testce/testce.csproj.







































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50215</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>testce</AssemblyName>
    <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <PlatformFamilyName>PocketPC</PlatformFamilyName>
    <PlatformID>3C41C503-53EF-4c2a-8DD4-A8217CAD115E</PlatformID>
    <OSVersion>4.20</OSVersion>
    <DeployDirSuffix>testce</DeployDirSuffix>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <FormFactorID>
    </FormFactorID>
    <StartupObject>
    </StartupObject>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\CompactFramework\</OutputPath>
    <DefineConstants>TRACE;DEBUG;PocketPC</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <FileAlignment>512</FileAlignment>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\CompactFramework\</OutputPath>
    <DefineConstants>PocketPC</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <FileAlignment>512</FileAlignment>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="System">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Drawing">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Windows.Forms">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml">
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="TestCases.cs">
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>