diff --git a/Appveyor.yml b/Appveyor.yml deleted file mode 100644 index e7ff4a705..000000000 --- a/Appveyor.yml +++ /dev/null @@ -1,3 +0,0 @@ -build: - project: - SQLite.Net.OSS.sln \ No newline at end of file diff --git a/README.mdown b/README.mdown index 97a113cfb..dcd7a82b4 100644 --- a/README.mdown +++ b/README.mdown @@ -1,3 +1,7 @@ +[![Build status](https://ci.appveyor.com/api/projects/status/ujwbkk2bp3ipnoxg?svg=true)](https://ci.appveyor.com/project/oysteinkrog/sqlite-net-pcl) + +This project is no longer actively maintained! + # Fork This is a fork of the original sqlite-net library (https://github.com/praeclarum/sqlite-net), which aims to improve the code quality by using modern technologies such as PCL (portable class library). @@ -15,15 +19,13 @@ This project uses semantic versioning. # API Changes As part of the cleanup there are now some API changes. - For the most part I hope these are self-explanatory, but here is a non-exhaustive list of changes. ## SQLiteConnection You now have to pass in an implementation of ISQlitePlatform in the SQLiteConnectionWithLock and SQLiteConnection constructors. +The correct platform implementation is automatically added to the project. -I provide ready-made implementations of this class, please use one of these [nugets](https://www.nuget.org/profiles/oystein.krog/). - -At the moment these platforms have nugets available: +At the moment these platforms are supported: - Win32 (bundles sqlite binaries for windows, works on both x86 and x64 automatically) (very well tested) - XamarinIOS and XamarinIOS.Unified - XamarinAndroid @@ -32,7 +34,7 @@ At the moment these platforms have nugets available: - Generic (net4 project without any sqlite3 binaries, requires sqlite installed in the OS) (contributed by James Ottaway) Note: -To use the WP8/WinRT platform you must install the "SQLite for Windows Phone"/"SQLite for Windows" VSIX extension. +To use the WP8.1/WinRT platform you must install the "SQLite for Windows Phone"/"SQLite for Windows" VSIX extension. Then, in the project, add a reference to the extension (in the Extensions section of the Add Reference dialog) If you have problems with signed apps take a look here: https://github.com/oysteinkrog/SQLite.Net-PCL/issues/25 @@ -46,6 +48,12 @@ new SQLiteAsyncConnection(()=>_sqliteConnectionWithLock); Please be aware that the Task.Run pattern used in SQLiteAsyncConnection can be considered an anti-pattern (libraries should not provide async methods unless they are truly async). This class is maintained for backwards compatability and for use-cases where async-isolation is handy. +## DateTime serialization + +DateTime serialization is changed, in order to be consistent. +When using the storeDateTimeAsTicks option, the DateTime is now serialized as Utc, and the returned DateTime is also in Utc. +You can get the local time by using dateTime.ToLocalTime() + # SQLite.Net SQLite.Net is an open source, minimal library to allow .NET and Mono applications to store data in [http://www.sqlite.org SQLite 3 databases]. It is written in C# and is meant to be simply compiled in with your projects. It was first designed to work with [MonoTouch](http://xamarin.com) on the iPhone, but has grown up to work on all the platforms (Mono for Android, .NET, Silverlight, WP7, WinRT, Azure, etc.). diff --git a/SQLite.Net.OSS.sln b/SQLite.Net.OSS.sln index e68524ebc..13cd513b0 100644 --- a/SQLite.Net.OSS.sln +++ b/SQLite.Net.OSS.sln @@ -356,102 +356,6 @@ Global {3AB34E91-8E1A-442F-8E66-2494B371A890}.Release|Mixed Platforms.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Release|x64.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Release|x86.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|ARM.Build.0 = Release|ARM - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|Mixed Platforms.Build.0 = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Ad-Hoc|x86.Build.0 = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|Any CPU.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|Any CPU.Build.0 = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|ARM.ActiveCfg = Release|ARM - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|ARM.Build.0 = Release|ARM - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|iPhone.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|Mixed Platforms.ActiveCfg = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|Mixed Platforms.Build.0 = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|x64.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|x86.ActiveCfg = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.AppStore|x86.Build.0 = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|ARM.ActiveCfg = Debug|ARM - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|ARM.Build.0 = Debug|ARM - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|x64.ActiveCfg = Debug|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|x86.ActiveCfg = Debug|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|x86.Build.0 = Debug|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|Any CPU.Build.0 = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|ARM.ActiveCfg = Release|ARM - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|ARM.Build.0 = Release|ARM - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|iPhone.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|Mixed Platforms.Build.0 = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|x64.ActiveCfg = Release|Any CPU - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|x86.ActiveCfg = Release|x86 - {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|x86.Build.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|Any CPU.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|ARM.ActiveCfg = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|ARM.Build.0 = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|ARM.Deploy.0 = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|iPhone.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|Mixed Platforms.Build.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|Mixed Platforms.Deploy.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|x64.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|x86.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|x86.Build.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Ad-Hoc|x86.Deploy.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|Any CPU.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|ARM.ActiveCfg = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|ARM.Build.0 = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|ARM.Deploy.0 = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|iPhone.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|iPhoneSimulator.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|Mixed Platforms.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|Mixed Platforms.Build.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|Mixed Platforms.Deploy.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|x64.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|x86.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|x86.Build.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|x86.Deploy.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|Any CPU.ActiveCfg = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|ARM.ActiveCfg = Debug|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|ARM.Build.0 = Debug|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|ARM.Deploy.0 = Debug|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|iPhone.ActiveCfg = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|iPhoneSimulator.ActiveCfg = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|Mixed Platforms.Deploy.0 = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|x64.ActiveCfg = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|x86.ActiveCfg = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|x86.Build.0 = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|x86.Deploy.0 = Debug|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|Any CPU.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|ARM.ActiveCfg = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|ARM.Build.0 = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|ARM.Deploy.0 = Release|ARM - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|iPhone.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|iPhoneSimulator.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|Mixed Platforms.Build.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|Mixed Platforms.Deploy.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|x64.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|x86.ActiveCfg = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|x86.Build.0 = Release|x86 - {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -462,7 +366,5 @@ Global {F662E15A-8753-468E-A67E-3FCF45F12B89} = {59584026-7610-4CD5-A74E-D2B0A2E1CE87} {C129735F-5D4B-40BE-9410-F43E548FFF5E} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} {9E5D6B89-B69B-486B-9F7B-406BE8690589} = {49C7015B-F41A-47A6-8200-B925902E74E9} - {38AF8105-65B6-4A14-A258-1137D9E40EF1} = {59584026-7610-4CD5-A74E-D2B0A2E1CE87} - {46DF3E43-6B65-4C3D-8911-64FCC301040F} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} EndGlobalSection EndGlobal diff --git a/SQLite.Net.sln b/SQLite.Net.sln index 0cd2be802..e483aa6a9 100644 --- a/SQLite.Net.sln +++ b/SQLite.Net.sln @@ -1,9 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.22512.0 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platforms", "Platforms", "{59584026-7610-4CD5-A74E-D2B0A2E1CE87}" EndProject @@ -23,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Net.Platform.Windows EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Net.Platform.XamarinIOS.Unified", "src\SQLite.Net.Platform.XamarinIOS.Unified\SQLite.Net.Platform.XamarinIOS.Unified.csproj", "{3173703F-8B1F-4772-9AE3-44913F413FB1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Net.Platform.OSX", "src\SQLite.Net.Platform.OSX\SQLite.Net.Platform.OSX.csproj", "{03799AD1-9FCF-48CB-8E6E-B233DF583B11}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0C4021EF-617B-4620-ADD3-A702B4F9FA86}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Net.Tests.Win32", "tests\SQLite.Net.Tests.Win32\SQLite.Net.Tests.Win32.csproj", "{BFF4B373-2844-40AD-8994-2BA5AC42AEE0}" @@ -39,6 +39,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Net.Tests.WindowsPho EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Net.Tests.XamarinIOS.Unified", "tests\SQLite.Net.Tests.XamarinIOS.Unified\SQLite.Net.Tests.XamarinIOS.Unified.csproj", "{0A947CD1-3C6F-415A-A122-233BAE3005FD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Net.Tests.OSX", "tests\SQLite.Net.Tests.OSX\SQLite.Net.Tests.OSX.csproj", "{8EA10208-DC51-48A1-A0FE-726FEE55DE79}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{49C7015B-F41A-47A6-8200-B925902E74E9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stocks", "examples\Stocks\Stocks.csproj", "{9E5D6B89-B69B-486B-9F7B-406BE8690589}" @@ -94,6 +96,7 @@ Global {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Ad-Hoc|x64.Build.0 = Release|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.AppStore|Any CPU.ActiveCfg = Release|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.AppStore|Any CPU.Build.0 = Release|Any CPU @@ -112,7 +115,9 @@ Global {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Debug|x64.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Debug|x64.Build.0 = Debug|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Debug|x86.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Debug|x86.Build.0 = Debug|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Release|Any CPU.ActiveCfg = Release|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Release|Any CPU.Build.0 = Release|Any CPU {03799AD1-9FCF-48CB-8E6E-B233DF583B10}.Release|ARM.ActiveCfg = Release|Any CPU @@ -203,6 +208,7 @@ Global {741521F8-F9D8-40F4-A5D4-AED4E26841ED}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {741521F8-F9D8-40F4-A5D4-AED4E26841ED}.Debug|Mixed Platforms.Build.0 = Debug|x86 {741521F8-F9D8-40F4-A5D4-AED4E26841ED}.Debug|x64.ActiveCfg = Debug|Any CPU + {741521F8-F9D8-40F4-A5D4-AED4E26841ED}.Debug|x64.Build.0 = Debug|Any CPU {741521F8-F9D8-40F4-A5D4-AED4E26841ED}.Debug|x86.ActiveCfg = Debug|x86 {741521F8-F9D8-40F4-A5D4-AED4E26841ED}.Debug|x86.Build.0 = Debug|x86 {741521F8-F9D8-40F4-A5D4-AED4E26841ED}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -220,7 +226,9 @@ Global {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU @@ -230,6 +238,7 @@ Global {6377929D-6253-450D-BF4B-3E8ECE2564F7}.AppStore|ARM.ActiveCfg = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.AppStore|iPhone.ActiveCfg = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {6377929D-6253-450D-BF4B-3E8ECE2564F7}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.AppStore|x64.ActiveCfg = Release|Any CPU @@ -238,12 +247,14 @@ Global {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|ARM.ActiveCfg = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|iPhone.Build.0 = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|x64.ActiveCfg = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|x86.ActiveCfg = Debug|Any CPU + {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Debug|x86.Build.0 = Debug|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Release|Any CPU.Build.0 = Release|Any CPU {6377929D-6253-450D-BF4B-3E8ECE2564F7}.Release|ARM.ActiveCfg = Release|Any CPU @@ -282,6 +293,7 @@ Global {219700F0-5444-4250-87D6-0551B39CA402}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {219700F0-5444-4250-87D6-0551B39CA402}.Debug|x64.ActiveCfg = Debug|Any CPU {219700F0-5444-4250-87D6-0551B39CA402}.Debug|x86.ActiveCfg = Debug|Any CPU + {219700F0-5444-4250-87D6-0551B39CA402}.Debug|x86.Build.0 = Debug|Any CPU {219700F0-5444-4250-87D6-0551B39CA402}.Release|Any CPU.ActiveCfg = Release|Any CPU {219700F0-5444-4250-87D6-0551B39CA402}.Release|Any CPU.Build.0 = Release|Any CPU {219700F0-5444-4250-87D6-0551B39CA402}.Release|ARM.ActiveCfg = Release|Any CPU @@ -294,11 +306,8 @@ Global {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|ARM.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU @@ -312,7 +321,6 @@ Global {F662E15A-8753-468E-A67E-3FCF45F12B89}.AppStore|iPhone.ActiveCfg = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.AppStore|iPhone.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F662E15A-8753-468E-A67E-3FCF45F12B89}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.AppStore|x64.ActiveCfg = Release|Any CPU @@ -324,9 +332,7 @@ Global {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|ARM.ActiveCfg = Debug|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|ARM.Build.0 = Debug|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|iPhone.Build.0 = Debug|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -336,9 +342,7 @@ Global {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|Any CPU.ActiveCfg = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|Any CPU.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|ARM.ActiveCfg = Release|Any CPU - {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|ARM.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|iPhone.ActiveCfg = Release|Any CPU - {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|iPhone.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {F662E15A-8753-468E-A67E-3FCF45F12B89}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU @@ -378,6 +382,7 @@ Global {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|Mixed Platforms.Build.0 = Debug|x86 {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|x64.ActiveCfg = Debug|Any CPU + {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|x64.Build.0 = Debug|Any CPU {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|x86.ActiveCfg = Debug|x86 {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Debug|x86.Build.0 = Debug|x86 {38AF8105-65B6-4A14-A258-1137D9E40EF1}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -394,7 +399,6 @@ Global {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|ARM.Build.0 = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU @@ -402,7 +406,6 @@ Global {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU - {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|x64.Build.0 = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Ad-Hoc|x86.Build.0 = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.AppStore|Any CPU.ActiveCfg = Release|Any CPU @@ -430,7 +433,6 @@ Global {3173703F-8B1F-4772-9AE3-44913F413FB1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Debug|x64.ActiveCfg = Debug|Any CPU - {3173703F-8B1F-4772-9AE3-44913F413FB1}.Debug|x64.Build.0 = Debug|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Debug|x86.ActiveCfg = Debug|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Debug|x86.Build.0 = Debug|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -444,6 +446,54 @@ Global {3173703F-8B1F-4772-9AE3-44913F413FB1}.Release|Mixed Platforms.Build.0 = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Release|x64.ActiveCfg = Release|Any CPU {3173703F-8B1F-4772-9AE3-44913F413FB1}.Release|x86.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|x64.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Ad-Hoc|x86.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|Any CPU.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|ARM.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|ARM.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|iPhone.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|iPhone.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|x64.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|x64.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|x86.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.AppStore|x86.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|Any CPU.Build.0 = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|ARM.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|ARM.Build.0 = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|x64.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|x64.Build.0 = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|x86.ActiveCfg = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Debug|x86.Build.0 = Debug|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|Any CPU.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|Any CPU.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|ARM.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|iPhone.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|x64.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|x64.Build.0 = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|x86.ActiveCfg = Release|Any CPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11}.Release|x86.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU @@ -452,30 +502,40 @@ Global {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|x64.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Ad-Hoc|x86.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|Any CPU.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|Any CPU.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|ARM.ActiveCfg = Release|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|ARM.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|iPhone.ActiveCfg = Release|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|iPhone.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|x64.ActiveCfg = Release|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|x64.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|x86.ActiveCfg = Release|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.AppStore|x86.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|Any CPU.Build.0 = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|ARM.ActiveCfg = Debug|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|ARM.Build.0 = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|iPhone.ActiveCfg = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|x64.ActiveCfg = Debug|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|x64.Build.0 = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|x86.ActiveCfg = Debug|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Debug|x86.Build.0 = Debug|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|Any CPU.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|Any CPU.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|ARM.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|iPhone.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|Mixed Platforms.Build.0 = Release|Any CPU {BFF4B373-2844-40AD-8994-2BA5AC42AEE0}.Release|x64.ActiveCfg = Release|Any CPU @@ -524,6 +584,7 @@ Global {4B386F57-D313-4842-AE9B-F54EDBF1EBD5}.Debug|Mixed Platforms.Deploy.0 = Debug|iPhone {4B386F57-D313-4842-AE9B-F54EDBF1EBD5}.Debug|x64.ActiveCfg = Debug|iPhone {4B386F57-D313-4842-AE9B-F54EDBF1EBD5}.Debug|x86.ActiveCfg = Debug|iPhone + {4B386F57-D313-4842-AE9B-F54EDBF1EBD5}.Debug|x86.Build.0 = Debug|iPhone {4B386F57-D313-4842-AE9B-F54EDBF1EBD5}.Release|Any CPU.ActiveCfg = Release|iPhone {4B386F57-D313-4842-AE9B-F54EDBF1EBD5}.Release|Any CPU.Build.0 = Release|iPhone {4B386F57-D313-4842-AE9B-F54EDBF1EBD5}.Release|ARM.ActiveCfg = Release|iPhone @@ -639,6 +700,7 @@ Global {2C3224FB-4513-4A16-B67F-3C4F1BDC7765}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU {2C3224FB-4513-4A16-B67F-3C4F1BDC7765}.Debug|x64.ActiveCfg = Debug|Any CPU {2C3224FB-4513-4A16-B67F-3C4F1BDC7765}.Debug|x86.ActiveCfg = Debug|Any CPU + {2C3224FB-4513-4A16-B67F-3C4F1BDC7765}.Debug|x86.Build.0 = Debug|Any CPU {2C3224FB-4513-4A16-B67F-3C4F1BDC7765}.Release|Any CPU.ActiveCfg = Release|Any CPU {2C3224FB-4513-4A16-B67F-3C4F1BDC7765}.Release|Any CPU.Build.0 = Release|Any CPU {2C3224FB-4513-4A16-B67F-3C4F1BDC7765}.Release|Any CPU.Deploy.0 = Release|Any CPU @@ -653,11 +715,8 @@ Global {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU - {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|ARM.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU - {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU @@ -671,7 +730,6 @@ Global {C129735F-5D4B-40BE-9410-F43E548FFF5E}.AppStore|iPhone.ActiveCfg = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.AppStore|iPhone.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU - {C129735F-5D4B-40BE-9410-F43E548FFF5E}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.AppStore|x64.ActiveCfg = Release|Any CPU @@ -683,9 +741,7 @@ Global {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|ARM.ActiveCfg = Debug|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|ARM.Build.0 = Debug|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|iPhone.Build.0 = Debug|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -695,9 +751,7 @@ Global {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|Any CPU.ActiveCfg = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|Any CPU.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|ARM.ActiveCfg = Release|Any CPU - {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|ARM.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|iPhone.ActiveCfg = Release|Any CPU - {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|iPhone.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {C129735F-5D4B-40BE-9410-F43E548FFF5E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU @@ -733,6 +787,7 @@ Global {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|x86.Build.0 = Release|x86 {46DF3E43-6B65-4C3D-8911-64FCC301040F}.AppStore|x86.Deploy.0 = Release|x86 {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|Any CPU.ActiveCfg = Debug|x86 + {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|Any CPU.Build.0 = Debug|x86 {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|ARM.ActiveCfg = Debug|ARM {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|ARM.Build.0 = Debug|ARM {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|ARM.Deploy.0 = Debug|ARM @@ -746,6 +801,7 @@ Global {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|x86.Build.0 = Debug|x86 {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Debug|x86.Deploy.0 = Debug|x86 {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|Any CPU.ActiveCfg = Release|x86 + {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|Any CPU.Build.0 = Release|x86 {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|ARM.ActiveCfg = Release|ARM {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|ARM.Build.0 = Release|ARM {46DF3E43-6B65-4C3D-8911-64FCC301040F}.Release|ARM.Deploy.0 = Release|ARM @@ -761,7 +817,6 @@ Global {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Ad-Hoc|Any CPU.Build.0 = Ad-Hoc|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Ad-Hoc|ARM.ActiveCfg = Ad-Hoc|iPhone - {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Ad-Hoc|ARM.Build.0 = Ad-Hoc|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhone @@ -797,7 +852,6 @@ Global {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Debug|Mixed Platforms.ActiveCfg = Debug|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Debug|Mixed Platforms.Build.0 = Debug|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Debug|x64.ActiveCfg = Debug|iPhone - {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Debug|x64.Build.0 = Debug|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Debug|x86.ActiveCfg = Debug|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Debug|x86.Build.0 = Debug|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Release|Any CPU.ActiveCfg = Release|iPhone @@ -811,6 +865,54 @@ Global {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Release|Mixed Platforms.Build.0 = Release|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Release|x64.ActiveCfg = Release|iPhone {0A947CD1-3C6F-415A-A122-233BAE3005FD}.Release|x86.ActiveCfg = Release|iPhone + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|x64.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Ad-Hoc|x86.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|Any CPU.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|ARM.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|ARM.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|iPhone.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|iPhone.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|x64.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|x64.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|x86.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.AppStore|x86.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|ARM.ActiveCfg = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|ARM.Build.0 = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|x64.ActiveCfg = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|x64.Build.0 = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|x86.ActiveCfg = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Debug|x86.Build.0 = Debug|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|Any CPU.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|ARM.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|iPhone.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|x64.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|x64.Build.0 = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|x86.ActiveCfg = Release|Any CPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79}.Release|x86.Build.0 = Release|Any CPU {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU @@ -838,6 +940,7 @@ Global {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Debug|x64.ActiveCfg = Debug|Any CPU {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Debug|x86.ActiveCfg = Debug|Any CPU + {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Debug|x86.Build.0 = Debug|Any CPU {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Release|Any CPU.Build.0 = Release|Any CPU {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Release|ARM.ActiveCfg = Release|Any CPU @@ -851,16 +954,20 @@ Global {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|x64.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|Any CPU.ActiveCfg = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|Any CPU.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|ARM.ActiveCfg = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|iPhone.ActiveCfg = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.AppStore|x64.ActiveCfg = Release|Any CPU @@ -869,12 +976,15 @@ Global {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|Any CPU.Build.0 = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|ARM.ActiveCfg = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|iPhone.Build.0 = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|x64.ActiveCfg = Debug|Any CPU + {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|x64.Build.0 = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|x86.ActiveCfg = Debug|Any CPU + {4971D437-0694-4297-A8CC-146CE08C3BD9}.Debug|x86.Build.0 = Debug|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Release|Any CPU.ActiveCfg = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Release|Any CPU.Build.0 = Release|Any CPU {4971D437-0694-4297-A8CC-146CE08C3BD9}.Release|ARM.ActiveCfg = Release|Any CPU @@ -893,16 +1003,20 @@ Global {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|ARM.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU + {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|Mixed Platforms.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|Mixed Platforms.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|x64.ActiveCfg = Release|Any CPU + {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|x64.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|Any CPU.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|Any CPU.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|ARM.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|iPhone.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|Mixed Platforms.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|Mixed Platforms.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.AppStore|x64.ActiveCfg = Release|Any CPU @@ -911,12 +1025,15 @@ Global {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|Any CPU.Build.0 = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|ARM.ActiveCfg = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|iPhone.Build.0 = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|x64.ActiveCfg = Debug|Any CPU + {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|x64.Build.0 = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|x86.ActiveCfg = Debug|Any CPU + {3AB34E91-8E1A-442F-8E66-2494B371A890}.Debug|x86.Build.0 = Debug|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Release|Any CPU.ActiveCfg = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Release|Any CPU.Build.0 = Release|Any CPU {3AB34E91-8E1A-442F-8E66-2494B371A890}.Release|ARM.ActiveCfg = Release|Any CPU @@ -944,6 +1061,7 @@ Global {F662E15A-8753-468E-A67E-3FCF45F12B89} = {59584026-7610-4CD5-A74E-D2B0A2E1CE87} {38AF8105-65B6-4A14-A258-1137D9E40EF1} = {59584026-7610-4CD5-A74E-D2B0A2E1CE87} {3173703F-8B1F-4772-9AE3-44913F413FB1} = {59584026-7610-4CD5-A74E-D2B0A2E1CE87} + {03799AD1-9FCF-48CB-8E6E-B233DF583B11} = {59584026-7610-4CD5-A74E-D2B0A2E1CE87} {BFF4B373-2844-40AD-8994-2BA5AC42AEE0} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} {4B386F57-D313-4842-AE9B-F54EDBF1EBD5} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} {5BB50827-ECC8-4BCD-9AFD-DCCA71F6D753} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} @@ -951,6 +1069,7 @@ Global {C129735F-5D4B-40BE-9410-F43E548FFF5E} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} {46DF3E43-6B65-4C3D-8911-64FCC301040F} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} {0A947CD1-3C6F-415A-A122-233BAE3005FD} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} + {8EA10208-DC51-48A1-A0FE-726FEE55DE79} = {0C4021EF-617B-4620-ADD3-A702B4F9FA86} {9E5D6B89-B69B-486B-9F7B-406BE8690589} = {49C7015B-F41A-47A6-8200-B925902E74E9} EndGlobalSection EndGlobal diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..9a38b206c --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,6 @@ +build: + project: SQLite.Net.OSS.sln + +test: + assemblies: + - '**\SQLite.Net.Tests.Win32.dll' diff --git a/nuget/SQLite.Net.Async.nuspec b/nuget/SQLite.Net.Async.nuspec index f75d3b980..79bdc696d 100644 --- a/nuget/SQLite.Net.Async.nuspec +++ b/nuget/SQLite.Net.Async.nuspec @@ -2,7 +2,7 @@ SQLite.Net.Async-PCL - 3.0.4-beta + 3.1.1 SQLite.Net.Async PCL Øystein Krog,Frank Krueger,Tim Heuer Øystein Krog @@ -17,8 +17,7 @@ https://github.com/oysteinkrog/SQLite.Net-PCL/commits sqlite pcl sql database ios android windows metro winrt xamarin monotouch monodroid win32 windowsphone wp wp8 wp8.1 - - + diff --git a/nuget/SQLite.Net.Core.nuspec b/nuget/SQLite.Net.Core.nuspec new file mode 100644 index 000000000..2a3cf5746 --- /dev/null +++ b/nuget/SQLite.Net.Core.nuspec @@ -0,0 +1,25 @@ + + + + SQLite.Net.Core-PCL + 3.1.1 + SQLite.Net PCL + Øystein Krog,Frank Krueger,Tim Heuer + Øystein Krog + https://raw.github.com/oysteinkrog/SQLite.Net-PCL/master/LICENSE.txt + https://github.com/oysteinkrog/SQLite.Net-PCL + false + SQLite.Net PCL is an open source, minimal library to allow .NET and Mono applications to store data in SQLite databases. + This is a fork of the original sqlite-net project, which aims to cleanup/improve the code and deliver the package as PCL assemblies with some additional platform-specific implementations. + This package is compatible with the following .net platforms: Xamarin.iOS (Classic), Xamarin.iOS (Unified), Xamarin.Android, Windows Phone 8.1, Windows Phone 8.0, Windows 8.1, Windows 8.0, Win32, Generic, PCL(net4+sl4+wp7+win8+monotouch+MonoAndroid) + A .NET client library to access SQLite embedded database files in a LINQ manner. + https://github.com/oysteinkrog/SQLite.Net-PCL/commits + sqlite pcl sql database ios android windows metro winrt xamarin monotouch monodroid win32 windowsphone wp wp8 wp8.1 + + + + + + + + diff --git a/nuget/SQLite.Net.nuspec b/nuget/SQLite.Net.nuspec index 312cda454..7ff18a5f8 100644 --- a/nuget/SQLite.Net.nuspec +++ b/nuget/SQLite.Net.nuspec @@ -1,8 +1,8 @@ - + SQLite.Net-PCL - 3.0.4-beta + 3.1.1 SQLite.Net PCL Øystein Krog,Frank Krueger,Tim Heuer Øystein Krog @@ -16,47 +16,43 @@ https://github.com/oysteinkrog/SQLite.Net-PCL/commits sqlite pcl sql database ios android windows metro winrt xamarin monotouch monodroid win32 windowsphone wp wp8 wp8.1 - + + + + + + - - - - - - - - - - + diff --git a/nuget/build.bat b/nuget/build.bat index e29d09e75..aac7ae932 100644 --- a/nuget/build.bat +++ b/nuget/build.bat @@ -1,3 +1,4 @@ @mkdir output +..\.nuget\nuget pack SQLite.Net.Core.nuspec -o output ..\.nuget\nuget pack SQLite.Net.nuspec -o output ..\.nuget\nuget pack SQLite.Net.Async.nuspec -o output diff --git a/nuget/prepare.bat b/nuget/prepare.bat index 0c880cef6..72e96e09a 100644 --- a/nuget/prepare.bat +++ b/nuget/prepare.bat @@ -1,5 +1,6 @@ mkdir SQLite.Net copy /y ..\src\SQLite.Net\bin\Release\SQLite.Net.dll SQLite.Net +type nul >SQLite.Net\_._ mkdir SQLite.Net.Async copy /y ..\src\SQLite.Net.Async\bin\Release\SQLite.Net.Async.dll SQLite.Net.Async diff --git a/nuget/upload.bat b/nuget/upload.bat index 84f74de6a..a182a7001 100644 --- a/nuget/upload.bat +++ b/nuget/upload.bat @@ -1,2 +1,3 @@ -..\.nuget\nuget push output\SQLite.Net-PCL.3.0.4-beta.nupkg -..\.nuget\nuget push output\SQLite.Net.Async-PCL.3.0.4-beta.nupkg +..\.nuget\nuget push output\SQLite.Net.Core-PCL.3.1.1.nupkg +..\.nuget\nuget push output\SQLite.Net-PCL.3.1.1.nupkg +..\.nuget\nuget push output\SQLite.Net.Async-PCL.3.1.1.nupkg diff --git a/src/GlobalAssemblyInfo.cs b/src/GlobalAssemblyInfo.cs index f820e4209..2f341e3ee 100644 --- a/src/GlobalAssemblyInfo.cs +++ b/src/GlobalAssemblyInfo.cs @@ -11,5 +11,5 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2.0")] -[assembly: AssemblyFileVersion("3.0.2.0")] +[assembly: AssemblyVersion("3.1.1.0")] +[assembly: AssemblyFileVersion("3.1.1.0")] diff --git a/src/SQLite.Net.Async/SQLite.Net.Async.csproj b/src/SQLite.Net.Async/SQLite.Net.Async.csproj index 5b1970385..64cac4b07 100644 --- a/src/SQLite.Net.Async/SQLite.Net.Async.csproj +++ b/src/SQLite.Net.Async/SQLite.Net.Async.csproj @@ -30,6 +30,7 @@ TRACE;DEBUG;JETBRAINS_ANNOTATIONS prompt 4 + true pdbonly @@ -40,9 +41,6 @@ 4 - - ..\..\packages\JetBrains.Annotations.8.0.5.0\lib\portable-net4+sl5+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\JetBrains.Annotations.PCL328.dll - @@ -61,9 +59,6 @@ SQLite.Net - - - - + \ No newline at end of file diff --git a/src/SQLite.Net.Async/SQLiteAsyncConnection.cs b/src/SQLite.Net.Async/SQLiteAsyncConnection.cs index 4ca26301e..af9a705f0 100755 --- a/src/SQLite.Net.Async/SQLiteAsyncConnection.cs +++ b/src/SQLite.Net.Async/SQLiteAsyncConnection.cs @@ -141,13 +141,19 @@ public Task CreateTablesAsync([NotNull] params Type[] types) [PublicAPI] public Task DropTableAsync(CancellationToken cancellationToken = default (CancellationToken)) where T : class + { + return DropTableAsync(typeof (T), cancellationToken); + } + + [PublicAPI] + public Task DropTableAsync(Type t, CancellationToken cancellationToken = default (CancellationToken)) { return Task.Factory.StartNew(() => { var conn = GetConnection(); using (conn.Lock()) { - return conn.DropTable(); + return conn.DropTable(t); } }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default); } @@ -185,6 +191,32 @@ public Task CreateTablesAsync([NotNull] params Type[] types) } }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default); } + + [PublicAPI] + public Task InsertOrIgnoreAsync (object item) + { + return Task.Factory.StartNew (() => { + SQLiteConnectionWithLock conn = GetConnection (); + using (conn.Lock ()) { + return conn.InsertOrIgnore (item); + } + }); + } + + [PublicAPI] + public Task InsertOrIgnoreAllAsync (IEnumerable objects, CancellationToken cancellationToken = default (CancellationToken)) + { + if (objects == null) { + throw new ArgumentNullException ("objects"); + } + + return Task.Factory.StartNew (() => { + SQLiteConnectionWithLock conn = GetConnection (); + using (conn.Lock ()) { + return conn.InsertOrIgnoreAll (objects); + } + }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default); + } [PublicAPI] public Task InsertOrReplaceAsync([NotNull] object item, CancellationToken cancellationToken = default (CancellationToken)) @@ -222,13 +254,19 @@ public Task CreateTablesAsync([NotNull] params Type[] types) [PublicAPI] public Task DeleteAllAsync(CancellationToken cancellationToken = default (CancellationToken)) + { + return DeleteAllAsync(typeof(T), cancellationToken); + } + + [PublicAPI] + public Task DeleteAllAsync(Type t, CancellationToken cancellationToken = default (CancellationToken)) { return Task.Factory.StartNew(() => { var conn = GetConnection(); using (conn.Lock()) { - return conn.DeleteAll(); + return conn.DeleteAll(t); } }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default); } @@ -509,6 +547,36 @@ public Task ExecuteScalarAsync(CancellationToken cancellationToken, [NotNu }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default); } + [PublicAPI] + public Task ExecuteNonQueryAsync([NotNull] string sql, [NotNull] params object[] args) + { + return ExecuteNonQueryAsync(CancellationToken.None, sql, args); + } + + [PublicAPI] + public Task ExecuteNonQueryAsync(CancellationToken cancellationToken, [NotNull] string sql, [NotNull] params object[] args) + { + if (sql == null) + { + throw new ArgumentNullException("sql"); + } + if (args == null) + { + throw new ArgumentNullException("args"); + } + return Task.Factory.StartNew(() => + { + cancellationToken.ThrowIfCancellationRequested(); + var conn = GetConnection(); + using (conn.Lock()) + { + cancellationToken.ThrowIfCancellationRequested(); + var command = conn.CreateCommand(sql, args); + command.ExecuteNonQuery(); + } + }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default); + } + [PublicAPI] public Task> QueryAsync([NotNull] string sql, [NotNull] params object[] args) where T : class @@ -539,5 +607,16 @@ public Task> QueryAsync(CancellationToken cancellationToken, [NotNull } }, cancellationToken, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default); } + + [PublicAPI] + public Task GetMappingAsync () + { + return Task.Factory.StartNew (() => { + SQLiteConnectionWithLock conn = GetConnection (); + using (conn.Lock ()) { + return conn.GetMapping (typeof(T)); + } + }, CancellationToken.None, _taskCreationOptions, _taskScheduler ?? TaskScheduler.Default); + } } } \ No newline at end of file diff --git a/src/SQLite.Net.Async/packages.config b/src/SQLite.Net.Async/packages.config deleted file mode 100644 index 5ba4ac872..000000000 --- a/src/SQLite.Net.Async/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/SQLite.Net.Platform.Generic/SQLiteApiGeneric.cs b/src/SQLite.Net.Platform.Generic/SQLiteApiGeneric.cs index 7d1423f02..8921dccba 100644 --- a/src/SQLite.Net.Platform.Generic/SQLiteApiGeneric.cs +++ b/src/SQLite.Net.Platform.Generic/SQLiteApiGeneric.cs @@ -25,6 +25,11 @@ public int LibVersionNumber() return SQLiteApiGenericInternal.sqlite3_libversion_number(); } + public string SourceID() + { + return Marshal.PtrToStringAnsi(SQLiteApiGenericInternal.sqlite3_sourceid()); + } + public Result EnableLoadExtension(IDbHandle db, int onoff) { var internalDbHandle = (DbHandle) db; @@ -66,7 +71,7 @@ public IDbStatement Prepare2(IDbHandle db, string query) { var internalDbHandle = (DbHandle) db; IntPtr stmt; - Result r = SQLiteApiGenericInternal.sqlite3_prepare_v2(internalDbHandle.DbPtr, query, query.Length, out stmt, IntPtr.Zero); + Result r = SQLiteApiGenericInternal.sqlite3_prepare16_v2(internalDbHandle.DbPtr, query, -1, out stmt, IntPtr.Zero); if (r != Result.OK) { throw SQLiteException.New(r, Errmsg16(internalDbHandle)); diff --git a/src/SQLite.Net.Platform.Generic/SQLiteApiGenericInternal.cs b/src/SQLite.Net.Platform.Generic/SQLiteApiGenericInternal.cs index ac74e1307..29fb72e72 100644 --- a/src/SQLite.Net.Platform.Generic/SQLiteApiGenericInternal.cs +++ b/src/SQLite.Net.Platform.Generic/SQLiteApiGenericInternal.cs @@ -126,9 +126,9 @@ public static extern int sqlite3_bind_text16(IntPtr stmt, [DllImport("sqlite3", EntryPoint = "sqlite3_open_v2", CallingConvention = CallingConvention.Cdecl)] public static extern Result sqlite3_open_v2(byte[] filename, out IntPtr db, int flags, IntPtr zvfs); - [DllImport("sqlite3", EntryPoint = "sqlite3_prepare_v2", CallingConvention = CallingConvention.Cdecl)] - public static extern Result sqlite3_prepare_v2(IntPtr db, - [MarshalAs(UnmanagedType.LPStr)] string sql, + [DllImport("sqlite3", EntryPoint = "sqlite3_prepare16_v2", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_prepare16_v2(IntPtr db, + [MarshalAs(UnmanagedType.LPWStr)] string sql, int numBytes, out IntPtr stmt, IntPtr pzTail); @@ -155,6 +155,9 @@ public static extern Result sqlite3_prepare_v2(IntPtr db, [DllImport("sqlite3", EntryPoint = "sqlite3_libversion_number", CallingConvention = CallingConvention.Cdecl)] public static extern int sqlite3_libversion_number(); + [DllImport("sqlite3", EntryPoint = "sqlite3_sourceid", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_sourceid(); + #region Backup [DllImport("sqlite3", EntryPoint = "sqlite3_backup_init", CallingConvention = CallingConvention.Cdecl)] diff --git a/src/SQLite.Net.Platform.OSX/Properties/AssemblyInfo.cs b/src/SQLite.Net.Platform.OSX/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..29f8686dd --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/Properties/AssemblyInfo.cs @@ -0,0 +1,25 @@ +using System.Reflection; +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("SQLite.Net.Platform.OSX")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Øystein Krog")] +[assembly: AssemblyProduct("SQLite.Net.Platform.OSX")] +[assembly: AssemblyCopyright("Copyright © Øystein Krog")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. 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("4f906778-2564-403a-81d7-1b8ba8c2cee6")] diff --git a/src/SQLite.Net.Platform.OSX/ReflectionServiceOSX.cs b/src/SQLite.Net.Platform.OSX/ReflectionServiceOSX.cs new file mode 100644 index 000000000..eb61c7c21 --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/ReflectionServiceOSX.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; +using SQLite.Net.Interop; + +namespace SQLite.Net.Platform.OSX +{ + public class ReflectionServiceOSX : IReflectionService + { + public IEnumerable GetPublicInstanceProperties(Type mappedType) + { + return mappedType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty); + } + + public object GetMemberValue(object obj, Expression expr, MemberInfo member) + { + if (member.MemberType == MemberTypes.Property) + { + var m = (PropertyInfo) member; + return m.GetValue(obj, null); + } + if (member.MemberType == MemberTypes.Field) + { + var m = (FieldInfo) member; + return m.GetValue(obj); + } + throw new NotSupportedException("MemberExpr: " + member.MemberType); + } + } +} diff --git a/src/SQLite.Net.Platform.OSX/SQLite.Net.Platform.OSX.csproj b/src/SQLite.Net.Platform.OSX/SQLite.Net.Platform.OSX.csproj new file mode 100644 index 000000000..741864c0d --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/SQLite.Net.Platform.OSX.csproj @@ -0,0 +1,84 @@ + + + + + Debug + AnyCPU + {03799AD1-9FCF-48CB-8E6E-B233DF583B11} + Library + Properties + SQLite.Net.Platform.OSX + SQLite.Net.Platform.OSX + v4.5 + 512 + + ..\..\ + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + {4971D437-0694-4297-A8CC-146CE08C3BD9} + SQLite.Net + + + diff --git a/src/SQLite.Net.Platform.OSX/SQLite.Net.Platform.OSX.dll.config b/src/SQLite.Net.Platform.OSX/SQLite.Net.Platform.OSX.dll.config new file mode 100644 index 000000000..20c858e75 --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/SQLite.Net.Platform.OSX.dll.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/SQLite.Net.Platform.OSX/SQLiteApiOSX.cs b/src/SQLite.Net.Platform.OSX/SQLiteApiOSX.cs new file mode 100644 index 000000000..a5b045b60 --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/SQLiteApiOSX.cs @@ -0,0 +1,302 @@ +using System; +using System.Runtime.InteropServices; +using SQLite.Net.Interop; + +namespace SQLite.Net.Platform.OSX +{ + public class SQLiteApiOSX : ISQLiteApiExt + { + public Result Open(byte[] filename, out IDbHandle db, int flags, IntPtr zvfs) + { + IntPtr dbPtr; + Result r = SQLiteApiOSXInternal.sqlite3_open_v2(filename, out dbPtr, flags, zvfs); + db = new DbHandle(dbPtr); + return r; + } + + public ExtendedResult ExtendedErrCode(IDbHandle db) + { + var internalDbHandle = (DbHandle) db; + return SQLiteApiOSXInternal.sqlite3_extended_errcode(internalDbHandle.DbPtr); + } + + public int LibVersionNumber() + { + return SQLiteApiOSXInternal.sqlite3_libversion_number(); + } + + public string SourceID() + { + return Marshal.PtrToStringAuto(SQLiteApiOSXInternal.sqlite3_sourceid()); + } + + public Result EnableLoadExtension(IDbHandle db, int onoff) + { + var internalDbHandle = (DbHandle) db; + return SQLiteApiOSXInternal.sqlite3_enable_load_extension(internalDbHandle.DbPtr, onoff); + } + + public Result Close(IDbHandle db) + { + var internalDbHandle = (DbHandle) db; + return SQLiteApiOSXInternal.sqlite3_close(internalDbHandle.DbPtr); + } + + public Result Initialize() + { + return SQLiteApiOSXInternal.sqlite3_initialize(); + } + public Result Shutdown() + { + return SQLiteApiOSXInternal.sqlite3_shutdown(); + } + + public Result Config(ConfigOption option) + { + return SQLiteApiOSXInternal.sqlite3_config(option); + } + + + public Result BusyTimeout(IDbHandle db, int milliseconds) + { + var internalDbHandle = (DbHandle) db; + return SQLiteApiOSXInternal.sqlite3_busy_timeout(internalDbHandle.DbPtr, milliseconds); + } + + public int Changes(IDbHandle db) + { + var internalDbHandle = (DbHandle) db; + return SQLiteApiOSXInternal.sqlite3_changes(internalDbHandle.DbPtr); + } + + public IDbStatement Prepare2(IDbHandle db, string query) + { + var internalDbHandle = (DbHandle) db; + IntPtr stmt; + Result r = SQLiteApiOSXInternal.sqlite3_prepare16_v2(internalDbHandle.DbPtr, query, -1, out stmt, IntPtr.Zero); + if (r != Result.OK) + { + throw SQLiteException.New(r, Errmsg16(internalDbHandle)); + } + return new DbStatement(stmt); + } + + public Result Step(IDbStatement stmt) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_step(internalStmt.StmtPtr); + } + + public Result Reset(IDbStatement stmt) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_reset(internalStmt.StmtPtr); + } + + public Result Finalize(IDbStatement stmt) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_finalize(internalStmt.StmtPtr); + } + + public long LastInsertRowid(IDbHandle db) + { + var internalDbHandle = (DbHandle) db; + return SQLiteApiOSXInternal.sqlite3_last_insert_rowid(internalDbHandle.DbPtr); + } + + public string Errmsg16(IDbHandle db) + { + var internalDbHandle = (DbHandle) db; + return Marshal.PtrToStringUni(SQLiteApiOSXInternal.sqlite3_errmsg16(internalDbHandle.DbPtr)); + } + + public int BindParameterIndex(IDbStatement stmt, string name) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_bind_parameter_index(internalStmt.StmtPtr, name); + } + + public int BindNull(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_bind_null(internalStmt.StmtPtr, index); + } + + public int BindInt(IDbStatement stmt, int index, int val) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_bind_int(internalStmt.StmtPtr, index, val); + } + + public int BindInt64(IDbStatement stmt, int index, long val) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_bind_int64(internalStmt.StmtPtr, index, val); + } + + public int BindDouble(IDbStatement stmt, int index, double val) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_bind_double(internalStmt.StmtPtr, index, val); + } + + public int BindText16(IDbStatement stmt, int index, string val, int n, IntPtr free) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_bind_text16(internalStmt.StmtPtr, index, val, n, free); + } + + public int BindBlob(IDbStatement stmt, int index, byte[] val, int n, IntPtr free) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_bind_blob(internalStmt.StmtPtr, index, val, n, free); + } + + public int ColumnCount(IDbStatement stmt) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_column_count(internalStmt.StmtPtr); + } + + public string ColumnName16(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.ColumnName16(internalStmt.StmtPtr, index); + } + + public ColType ColumnType(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_column_type(internalStmt.StmtPtr, index); + } + + public int ColumnInt(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_column_int(internalStmt.StmtPtr, index); + } + + public long ColumnInt64(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_column_int64(internalStmt.StmtPtr, index); + } + + public double ColumnDouble(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_column_double(internalStmt.StmtPtr, index); + } + + public string ColumnText16(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return Marshal.PtrToStringUni(SQLiteApiOSXInternal.sqlite3_column_text16(internalStmt.StmtPtr, index)); + } + + public byte[] ColumnBlob(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.ColumnBlob(internalStmt.StmtPtr, index); + } + + public int ColumnBytes(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.sqlite3_column_bytes(internalStmt.StmtPtr, index); + } + + public byte[] ColumnByteArray(IDbStatement stmt, int index) + { + var internalStmt = (DbStatement) stmt; + return SQLiteApiOSXInternal.ColumnByteArray(internalStmt.StmtPtr, index); + } + + #region Backup + + public IDbBackupHandle BackupInit(IDbHandle destHandle, string destName, IDbHandle srcHandle, string srcName) { + var internalDestDb = (DbHandle)destHandle; + var internalSrcDb = (DbHandle)srcHandle; + + IntPtr p = SQLiteApiOSXInternal.sqlite3_backup_init(internalDestDb.DbPtr, + destName, + internalSrcDb.DbPtr, + srcName); + + if(p == IntPtr.Zero) { + return null; + } else { + return new DbBackupHandle(p); + } + } + + public Result BackupStep(IDbBackupHandle handle, int pageCount) { + var internalBackup = (DbBackupHandle)handle; + return SQLiteApiOSXInternal.sqlite3_backup_step(internalBackup.DbBackupPtr, pageCount); + } + + public Result BackupFinish(IDbBackupHandle handle) { + var internalBackup = (DbBackupHandle)handle; + return SQLiteApiOSXInternal.sqlite3_backup_finish(internalBackup.DbBackupPtr); + } + + public int BackupRemaining(IDbBackupHandle handle) { + var internalBackup = (DbBackupHandle)handle; + return SQLiteApiOSXInternal.sqlite3_backup_remaining(internalBackup.DbBackupPtr); + } + + public int BackupPagecount(IDbBackupHandle handle) { + var internalBackup = (DbBackupHandle)handle; + return SQLiteApiOSXInternal.sqlite3_backup_pagecount(internalBackup.DbBackupPtr); + } + + public int Sleep(int millis) { + return SQLiteApiOSXInternal.sqlite3_sleep(millis); + } + + private struct DbBackupHandle : IDbBackupHandle { + public DbBackupHandle(IntPtr dbBackupPtr) : this() { + DbBackupPtr = dbBackupPtr; + } + + internal IntPtr DbBackupPtr { get; set; } + + public bool Equals(IDbBackupHandle other) { + return other is DbBackupHandle && DbBackupPtr == ((DbBackupHandle)other).DbBackupPtr; + } + } + + #endregion + + private struct DbHandle : IDbHandle + { + public DbHandle(IntPtr dbPtr) : this() + { + DbPtr = dbPtr; + } + + internal IntPtr DbPtr { get; set; } + + public bool Equals(IDbHandle other) + { + return other is DbHandle && DbPtr == ((DbHandle) other).DbPtr; + } + } + + private struct DbStatement : IDbStatement + { + public DbStatement(IntPtr stmtPtr) : this() + { + StmtPtr = stmtPtr; + } + + internal IntPtr StmtPtr { get; set; } + + public bool Equals(IDbStatement other) + { + return other is DbStatement && StmtPtr == ((DbStatement) other).StmtPtr; + } + } + } +} diff --git a/src/SQLite.Net.Platform.OSX/SQLitePlatformOSX.cs b/src/SQLite.Net.Platform.OSX/SQLitePlatformOSX.cs new file mode 100644 index 000000000..ebcad2d34 --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/SQLitePlatformOSX.cs @@ -0,0 +1,20 @@ +using SQLite.Net.Interop; + +namespace SQLite.Net.Platform.OSX +{ + public class SQLitePlatformOSX : ISQLitePlatform + { + public SQLitePlatformOSX() + { + SQLiteApi = new SQLiteApiOSX(); + StopwatchFactory = new StopwatchFactoryOSX(); + ReflectionService = new ReflectionServiceOSX(); + VolatileService = new VolatileServiceOSX(); + } + + public ISQLiteApi SQLiteApi { get; private set; } + public IStopwatchFactory StopwatchFactory { get; private set; } + public IReflectionService ReflectionService { get; private set; } + public IVolatileService VolatileService { get; private set; } + } +} diff --git a/src/SQLite.Net.Platform.OSX/SQliteApiOSXInternal.cs b/src/SQLite.Net.Platform.OSX/SQliteApiOSXInternal.cs new file mode 100644 index 000000000..a628d06bc --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/SQliteApiOSXInternal.cs @@ -0,0 +1,205 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; +using SQLite.Net.Interop; +using System.Reflection; + +namespace SQLite.Net.Platform.OSX +{ + internal static class SQLiteApiOSXInternal + { + static SQLiteApiOSXInternal() + { + } + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_open", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_open([MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr db); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_open_v2", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_open([MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr db, + int flags, + IntPtr zvfs); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_open16", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_open16([MarshalAs(UnmanagedType.LPWStr)] string filename, out IntPtr db); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_enable_load_extension", + CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_enable_load_extension(IntPtr db, int onoff); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_close", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_close(IntPtr db); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_initialize", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_initialize(); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_shutdown", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_shutdown(); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_config(ConfigOption option); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_win32_set_directory", + CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] + public static extern int sqlite3_win32_set_directory(uint directoryType, string directoryPath); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_busy_timeout", + CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_busy_timeout(IntPtr db, int milliseconds); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_changes", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_changes(IntPtr db); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_prepare16_v2", CallingConvention = CallingConvention.Cdecl) + ] + public static extern Result sqlite3_prepare16_v2(IntPtr db, [MarshalAs(UnmanagedType.LPWStr)] string sql, + int numBytes, + out IntPtr stmt, IntPtr pzTail); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_step", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_step(IntPtr stmt); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_reset", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_reset(IntPtr stmt); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_finalize", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_finalize(IntPtr stmt); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_last_insert_rowid", + CallingConvention = CallingConvention.Cdecl)] + public static extern long sqlite3_last_insert_rowid(IntPtr db); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_errmsg16", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_errmsg16(IntPtr db); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_bind_parameter_index", + CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_bind_parameter_index(IntPtr stmt, [MarshalAs(UnmanagedType.LPStr)] string name); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_bind_null", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_bind_null(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_bind_int", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_bind_int(IntPtr stmt, int index, int val); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_bind_int64", CallingConvention = CallingConvention.Cdecl) + ] + public static extern int sqlite3_bind_int64(IntPtr stmt, int index, long val); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_bind_double", CallingConvention = CallingConvention.Cdecl + )] + public static extern int sqlite3_bind_double(IntPtr stmt, int index, double val); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_bind_text16", CallingConvention = CallingConvention.Cdecl, + CharSet = CharSet.Unicode)] + public static extern int sqlite3_bind_text16(IntPtr stmt, int index, + [MarshalAs(UnmanagedType.LPWStr)] string val, + int n, + IntPtr free); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_bind_blob", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_bind_blob(IntPtr stmt, int index, byte[] val, int n, IntPtr free); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_count", + CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_column_count(IntPtr stmt); + + // [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_name", CallingConvention = CallingConvention.Cdecl)] + // private extern IntPtr ColumnNameInternal(IntPtr stmt, int index); + + // [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_name", CallingConvention = CallingConvention.Cdecl)] + // public string ColumnName(IntPtr stmt, int index) + // { + // return ColumnNameInternal(stmt, index); + // } + + public static string ColumnName16(IntPtr stmt, int index) + { + return Marshal.PtrToStringUni(sqlite3_column_name16(stmt, index)); + } + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_type", CallingConvention = CallingConvention.Cdecl + )] + public static extern ColType sqlite3_column_type(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_int", CallingConvention = CallingConvention.Cdecl) + ] + public static extern int sqlite3_column_int(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_int64", + CallingConvention = CallingConvention.Cdecl)] + public static extern long sqlite3_column_int64(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_double", + CallingConvention = CallingConvention.Cdecl)] + public static extern double sqlite3_column_double(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_text16", + CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_column_text16(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_blob", CallingConvention = CallingConvention.Cdecl + )] + public static extern byte[] ColumnBlob(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_blob", CallingConvention = CallingConvention.Cdecl + )] + public static extern IntPtr sqlite3_column_blob(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_bytes", + CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_column_bytes(IntPtr stmt, int index); + + public static byte[] ColumnByteArray(IntPtr stmt, int index) + { + int length = sqlite3_column_bytes(stmt, index); + var result = new byte[length]; + if (length > 0) + { + Marshal.Copy(sqlite3_column_blob(stmt, index), result, 0, length); + } + return result; + } + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_open_v2", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_open_v2(byte[] filename, out IntPtr db, int flags, IntPtr zvfs); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_column_name16", + CallingConvention = CallingConvention.Cdecl)] + private static extern IntPtr sqlite3_column_name16(IntPtr stmt, int index); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_extended_errcode", CallingConvention = CallingConvention.Cdecl)] + public static extern ExtendedResult sqlite3_extended_errcode(IntPtr db); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_libversion_number", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_libversion_number(); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_sourceid", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_sourceid(); + + #region Backup + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_backup_init", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_backup_init(IntPtr destDB, + [MarshalAs(UnmanagedType.LPStr)] string destName, + IntPtr srcDB, + [MarshalAs(UnmanagedType.LPStr)] string srcName); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_backup_step", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_backup_step(IntPtr backup, int pageCount); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_backup_finish", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_backup_finish(IntPtr backup); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_backup_remaining", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_backup_remaining(IntPtr backup); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_backup_pagecount", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_backup_pagecount(IntPtr backup); + + [DllImport("libsqlite3_for_net", EntryPoint = "sqlite3_sleep", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_sleep(int millis); + + #endregion + } +} diff --git a/src/SQLite.Net.Platform.OSX/StopwatchFactoryOSX.cs b/src/SQLite.Net.Platform.OSX/StopwatchFactoryOSX.cs new file mode 100644 index 000000000..2266a9a7c --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/StopwatchFactoryOSX.cs @@ -0,0 +1,43 @@ +using System.Diagnostics; +using SQLite.Net.Interop; + +namespace SQLite.Net.Platform.OSX +{ + public class StopwatchFactoryOSX : IStopwatchFactory + { + public IStopwatch Create() + { + return new StopwatchOSX(); + } + + private class StopwatchOSX : IStopwatch + { + private readonly Stopwatch _stopWatch; + + public StopwatchOSX() + { + _stopWatch = new Stopwatch(); + } + + public void Stop() + { + _stopWatch.Stop(); + } + + public void Reset() + { + _stopWatch.Reset(); + } + + public void Start() + { + _stopWatch.Start(); + } + + public long ElapsedMilliseconds + { + get { return _stopWatch.ElapsedMilliseconds; } + } + } + } +} diff --git a/src/SQLite.Net.Platform.OSX/VolatileServiceOSX.cs b/src/SQLite.Net.Platform.OSX/VolatileServiceOSX.cs new file mode 100644 index 000000000..7c39e7c44 --- /dev/null +++ b/src/SQLite.Net.Platform.OSX/VolatileServiceOSX.cs @@ -0,0 +1,13 @@ +using System.Threading; +using SQLite.Net.Interop; + +namespace SQLite.Net.Platform.OSX +{ + public class VolatileServiceOSX : IVolatileService + { + public void Write(ref int transactionDepth, int depth) + { + Thread.VolatileWrite(ref transactionDepth, depth); + } + } +} diff --git a/src/SQLite.Net.Platform.OSX/i386/libsqlite3_for_net.dylib b/src/SQLite.Net.Platform.OSX/i386/libsqlite3_for_net.dylib new file mode 100755 index 000000000..53875e705 Binary files /dev/null and b/src/SQLite.Net.Platform.OSX/i386/libsqlite3_for_net.dylib differ diff --git a/src/SQLite.Net.Platform.OSX/x86_64/libsqlite3_for_net.dylib b/src/SQLite.Net.Platform.OSX/x86_64/libsqlite3_for_net.dylib new file mode 100755 index 000000000..866703295 Binary files /dev/null and b/src/SQLite.Net.Platform.OSX/x86_64/libsqlite3_for_net.dylib differ diff --git a/src/SQLite.Net.Platform.Win32/SQLite.Net.Platform.Win32.csproj b/src/SQLite.Net.Platform.Win32/SQLite.Net.Platform.Win32.csproj index 925838472..4a6136523 100644 --- a/src/SQLite.Net.Platform.Win32/SQLite.Net.Platform.Win32.csproj +++ b/src/SQLite.Net.Platform.Win32/SQLite.Net.Platform.Win32.csproj @@ -52,6 +52,7 @@ + diff --git a/src/SQLite.Net.Platform.Win32/SQLiteApiWin32.cs b/src/SQLite.Net.Platform.Win32/SQLiteApiWin32.cs index 1cb84f71e..3592f8dec 100644 --- a/src/SQLite.Net.Platform.Win32/SQLiteApiWin32.cs +++ b/src/SQLite.Net.Platform.Win32/SQLiteApiWin32.cs @@ -6,6 +6,12 @@ namespace SQLite.Net.Platform.Win32 { public class SQLiteApiWin32 : ISQLiteApiExt { + public SQLiteApiWin32(string nativeInteropSearchPath = null) + { + if (nativeInteropSearchPath != null) + SQLiteApiWin32InternalConfiguration.NativeInteropSearchPath = nativeInteropSearchPath; + } + public Result Open(byte[] filename, out IDbHandle db, int flags, IntPtr zvfs) { IntPtr dbPtr; @@ -24,6 +30,11 @@ public int LibVersionNumber() { return SQLiteApiWin32Internal.sqlite3_libversion_number(); } + + public string SourceID() + { + return Marshal.PtrToStringAnsi(SQLiteApiWin32Internal.sqlite3_sourceid()); + } public Result EnableLoadExtension(IDbHandle db, int onoff) { @@ -68,7 +79,7 @@ public IDbStatement Prepare2(IDbHandle db, string query) { var internalDbHandle = (DbHandle) db; IntPtr stmt; - Result r = SQLiteApiWin32Internal.sqlite3_prepare_v2(internalDbHandle.DbPtr, query, query.Length, out stmt, IntPtr.Zero); + Result r = SQLiteApiWin32Internal.sqlite3_prepare16_v2(internalDbHandle.DbPtr, query, -1, out stmt, IntPtr.Zero); if (r != Result.OK) { throw SQLiteException.New(r, Errmsg16(internalDbHandle)); diff --git a/src/SQLite.Net.Platform.Win32/SQLiteApiWin32InternalConfiguration.cs b/src/SQLite.Net.Platform.Win32/SQLiteApiWin32InternalConfiguration.cs new file mode 100644 index 000000000..71154b759 --- /dev/null +++ b/src/SQLite.Net.Platform.Win32/SQLiteApiWin32InternalConfiguration.cs @@ -0,0 +1,7 @@ +namespace SQLite.Net.Platform.Win32 +{ + internal static class SQLiteApiWin32InternalConfiguration + { + public static string NativeInteropSearchPath { get; set; } + } +} \ No newline at end of file diff --git a/src/SQLite.Net.Platform.Win32/SQLitePlatformWin32.cs b/src/SQLite.Net.Platform.Win32/SQLitePlatformWin32.cs index f1de83dbb..072f70dc2 100644 --- a/src/SQLite.Net.Platform.Win32/SQLitePlatformWin32.cs +++ b/src/SQLite.Net.Platform.Win32/SQLitePlatformWin32.cs @@ -4,9 +4,9 @@ namespace SQLite.Net.Platform.Win32 { public class SQLitePlatformWin32 : ISQLitePlatform { - public SQLitePlatformWin32() + public SQLitePlatformWin32(string nativeInteropSearchPath = null) { - SQLiteApi = new SQLiteApiWin32(); + SQLiteApi = new SQLiteApiWin32(nativeInteropSearchPath); StopwatchFactory = new StopwatchFactoryWin32(); ReflectionService = new ReflectionServiceWin32(); VolatileService = new VolatileServiceWin32(); diff --git a/src/SQLite.Net.Platform.Win32/SQliteApiWin32Internal.cs b/src/SQLite.Net.Platform.Win32/SQliteApiWin32Internal.cs index f8366e893..92c787f25 100644 --- a/src/SQLite.Net.Platform.Win32/SQliteApiWin32Internal.cs +++ b/src/SQLite.Net.Platform.Win32/SQliteApiWin32Internal.cs @@ -10,19 +10,42 @@ internal static class SQLiteApiWin32Internal { static SQLiteApiWin32Internal() { - // load native library int ptrSize = IntPtr.Size; - string relativePath = ptrSize == 8 ? @"x64\SQLite.Interop.dll" : @"x86\SQLite.Interop.dll"; - string assemblyCurrentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - string assemblyInteropPath = Path.Combine(assemblyCurrentPath, relativePath); + var architectureDirectory = (ptrSize == 8 ? "x64" : "x86"); + var interopFilename = "SQLite.Interop.dll"; - // try relative to assembly first, if that does not exist try relative to working dir - string interopPath = File.Exists(assemblyInteropPath) ? assemblyInteropPath : relativePath; + string interopPath = null; + if (!string.IsNullOrWhiteSpace(SQLiteApiWin32InternalConfiguration.NativeInteropSearchPath)) + { + // a NativeInteropSearchPath is given, so we try to find the file name there + var fileInSearchPath = Path.Combine(SQLiteApiWin32InternalConfiguration.NativeInteropSearchPath, interopFilename); + if (File.Exists(fileInSearchPath)) + { + interopPath = fileInSearchPath; + } + else + { + var fileInSearchPathWithArchitecture = Path.Combine(SQLiteApiWin32InternalConfiguration.NativeInteropSearchPath, architectureDirectory, interopFilename); + if (File.Exists(fileInSearchPathWithArchitecture)) + interopPath = fileInSearchPathWithArchitecture; + } + } + + if (interopPath == null) + { + // no NativeInteropSearchPath given (or nothing found using this path) so load native library from assembly execution direcotry + string assemblyCurrentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string relativePath = architectureDirectory + "\\" + interopFilename; + string assemblyInteropPath = Path.Combine(assemblyCurrentPath, architectureDirectory, interopFilename); + + // try relative to assembly first, if that does not exist try relative to working dir + interopPath = File.Exists(assemblyInteropPath) ? assemblyInteropPath : relativePath; + } IntPtr ret = LoadLibrary(interopPath); if (ret == IntPtr.Zero) { - throw new Exception("Failed to load native sqlite library"); + throw new Exception("Failed to load native sqlite library from " + interopPath); } } @@ -67,9 +90,9 @@ public static extern Result sqlite3_open([MarshalAs(UnmanagedType.LPStr)] string [DllImport("SQLite.Interop.dll", EntryPoint = "sqlite3_changes", CallingConvention = CallingConvention.Cdecl)] public static extern int sqlite3_changes(IntPtr db); - [DllImport("SQLite.Interop.dll", EntryPoint = "sqlite3_prepare_v2", CallingConvention = CallingConvention.Cdecl) + [DllImport("SQLite.Interop.dll", EntryPoint = "sqlite3_prepare16_v2", CallingConvention = CallingConvention.Cdecl) ] - public static extern Result sqlite3_prepare_v2(IntPtr db, [MarshalAs(UnmanagedType.LPStr)] string sql, + public static extern Result sqlite3_prepare16_v2(IntPtr db, [MarshalAs(UnmanagedType.LPWStr)] string sql, int numBytes, out IntPtr stmt, IntPtr pzTail); @@ -191,6 +214,9 @@ public static byte[] ColumnByteArray(IntPtr stmt, int index) [DllImport("SQLite.Interop.dll", EntryPoint = "sqlite3_libversion_number", CallingConvention = CallingConvention.Cdecl)] public static extern int sqlite3_libversion_number(); + [DllImport("SQLite.Interop.dll", EntryPoint = "sqlite3_sourceid", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_sourceid(); + #region Backup [DllImport("SQLite.Interop.dll", EntryPoint = "sqlite3_backup_init", CallingConvention = CallingConvention.Cdecl)] diff --git a/src/SQLite.Net.Platform.WinRT/SQLiteApiWinRT.cs b/src/SQLite.Net.Platform.WinRT/SQLiteApiWinRT.cs index 6c4920a7a..d8fadde12 100644 --- a/src/SQLite.Net.Platform.WinRT/SQLiteApiWinRT.cs +++ b/src/SQLite.Net.Platform.WinRT/SQLiteApiWinRT.cs @@ -9,69 +9,170 @@ namespace SQLite.Net.Platform.WinRT { public class SQLiteApiWinRT : ISQLiteApiExt { - public SQLiteApiWinRT() + private readonly bool _useWinSqlite; + + /// + /// Creates a SQLite API object for use from WinRT. + /// + /// Optional: Temporary folder path. Defaults to + /// Optional: Whether to use WinSQLite instead of SQLite. WinSQLite is built-in to Windows 10.0.10586.0 and above. Using it can reduce app size and potentially increase SQLite load time. + public SQLiteApiWinRT(string tempFolderPath = null, bool useWinSqlite = false) { - SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path); + _useWinSqlite = useWinSqlite; + + if (_useWinSqlite) + { + WinSQLite3.SetDirectory(/*temp directory type*/2, tempFolderPath ?? Windows.Storage.ApplicationData.Current.TemporaryFolder.Path); + } + else + { + SQLite3.SetDirectory(/*temp directory type*/2, tempFolderPath ?? Windows.Storage.ApplicationData.Current.TemporaryFolder.Path); + } } public int BindBlob(IDbStatement stmt, int index, byte[] val, int n, IntPtr free) { var dbStatement = (DbStatement)stmt; - return SQLite3.BindBlob(dbStatement.InternalStmt, index, val, n, free); + + if (_useWinSqlite) + { + return WinSQLite3.BindBlob(dbStatement.InternalStmt, index, val, n, free); + } + else + { + return SQLite3.BindBlob(dbStatement.InternalStmt, index, val, n, free); + } } public int BindDouble(IDbStatement stmt, int index, double val) { var dbStatement = (DbStatement)stmt; - return SQLite3.BindDouble(dbStatement.InternalStmt, index, val); + + + if (_useWinSqlite) + { + return WinSQLite3.BindDouble(dbStatement.InternalStmt, index, val); + } + else + { + return SQLite3.BindDouble(dbStatement.InternalStmt, index, val); + } } public int BindInt(IDbStatement stmt, int index, int val) { var dbStatement = (DbStatement)stmt; - return SQLite3.BindInt(dbStatement.InternalStmt, index, val); + + if (_useWinSqlite) + { + return WinSQLite3.BindInt(dbStatement.InternalStmt, index, val); + } + else + { + return SQLite3.BindInt(dbStatement.InternalStmt, index, val); + } } public int BindInt64(IDbStatement stmt, int index, long val) { var dbStatement = (DbStatement)stmt; - return SQLite3.BindInt64(dbStatement.InternalStmt, index, val); + + + if (_useWinSqlite) + { + return WinSQLite3.BindInt64(dbStatement.InternalStmt, index, val); + } + else + { + return SQLite3.BindInt64(dbStatement.InternalStmt, index, val); + } } public int BindNull(IDbStatement stmt, int index) { var dbStatement = (DbStatement)stmt; - return SQLite3.BindNull(dbStatement.InternalStmt, index); + + + if (_useWinSqlite) + { + return WinSQLite3.BindNull(dbStatement.InternalStmt, index); + } + else + { + return SQLite3.BindNull(dbStatement.InternalStmt, index); + } } public int BindParameterIndex(IDbStatement stmt, string name) { var dbStatement = (DbStatement)stmt; - return SQLite3.BindParameterIndex(dbStatement.InternalStmt, name); + + + if (_useWinSqlite) + { + return WinSQLite3.BindParameterIndex(dbStatement.InternalStmt, name); + } + else + { + return SQLite3.BindParameterIndex(dbStatement.InternalStmt, name); + } } public int BindText16(IDbStatement stmt, int index, string val, int n, IntPtr free) { var dbStatement = (DbStatement)stmt; - return SQLite3.BindText(dbStatement.InternalStmt, index, val, n, free); + + + if (_useWinSqlite) + { + return WinSQLite3.BindText(dbStatement.InternalStmt, index, val, n, free); + } + else + { + return SQLite3.BindText(dbStatement.InternalStmt, index, val, n, free); + } } public Result BusyTimeout(IDbHandle db, int milliseconds) { var dbHandle = (DbHandle)db; - return (Result)SQLite3.BusyTimeout(dbHandle.InternalDbHandle, milliseconds); + + if (_useWinSqlite) + { + return (Result)WinSQLite3.BusyTimeout(dbHandle.InternalDbHandle, milliseconds); + } + else + { + return (Result)SQLite3.BusyTimeout(dbHandle.InternalDbHandle, milliseconds); + } } public int Changes(IDbHandle db) { var dbHandle = (DbHandle)db; - return SQLite3.Changes(dbHandle.InternalDbHandle); + + if (_useWinSqlite) + { + return WinSQLite3.Changes(dbHandle.InternalDbHandle); + } + else + { + return SQLite3.Changes(dbHandle.InternalDbHandle); + } } public Result Close(IDbHandle db) { var dbHandle = (DbHandle)db; - return (Result)SQLite3.Close(dbHandle.InternalDbHandle); + + if (_useWinSqlite) + { + return (Result)WinSQLite3.Close(dbHandle.InternalDbHandle); + } + else + { + return (Result)SQLite3.Close(dbHandle.InternalDbHandle); + } } public Result Initialize() @@ -85,7 +186,14 @@ public Result Shutdown() public Result Config(ConfigOption option) { - return (Result)SQLite3.Config(option); + if (_useWinSqlite) + { + return (Result)WinSQLite3.Config(option); + } + else + { + return (Result)SQLite3.Config(option); + } } @@ -95,7 +203,17 @@ public byte[] ColumnBlob(IDbStatement stmt, int index) int length = ColumnBytes(stmt, index); byte[] result = new byte[length]; if (length > 0) - Marshal.Copy(SQLite3.ColumnBlob(dbStatement.InternalStmt, index), result, 0, length); + { + + if (_useWinSqlite) + { + Marshal.Copy(WinSQLite3.ColumnBlob(dbStatement.InternalStmt, index), result, 0, length); + } + else + { + Marshal.Copy(SQLite3.ColumnBlob(dbStatement.InternalStmt, index), result, 0, length); + } + } return result; } @@ -107,54 +225,138 @@ public byte[] ColumnByteArray(IDbStatement stmt, int index) public int ColumnBytes(IDbStatement stmt, int index) { var dbStatement = (DbStatement)stmt; - return SQLite3.ColumnBytes(dbStatement.InternalStmt, index); + + if (_useWinSqlite) + { + return WinSQLite3.ColumnBytes(dbStatement.InternalStmt, index); + } + else + { + return SQLite3.ColumnBytes(dbStatement.InternalStmt, index); + } } public int ColumnCount(IDbStatement stmt) { var dbStatement = (DbStatement)stmt; - return SQLite3.ColumnCount(dbStatement.InternalStmt); + + if (_useWinSqlite) + { + return WinSQLite3.ColumnCount(dbStatement.InternalStmt); + } + else + { + return SQLite3.ColumnCount(dbStatement.InternalStmt); + } } public double ColumnDouble(IDbStatement stmt, int index) { var dbStatement = (DbStatement)stmt; - return SQLite3.ColumnDouble(dbStatement.InternalStmt, index); + + if (_useWinSqlite) + { + return WinSQLite3.ColumnDouble(dbStatement.InternalStmt, index); + } + else + { + return SQLite3.ColumnDouble(dbStatement.InternalStmt, index); + } } public int ColumnInt(IDbStatement stmt, int index) { var dbStatement = (DbStatement)stmt; - return SQLite3.ColumnInt(dbStatement.InternalStmt, index); + + if (_useWinSqlite) + { + return WinSQLite3.ColumnInt(dbStatement.InternalStmt, index); + } + else + { + return SQLite3.ColumnInt(dbStatement.InternalStmt, index); + } } public long ColumnInt64(IDbStatement stmt, int index) { var dbStatement = (DbStatement)stmt; - return SQLite3.ColumnInt64(dbStatement.InternalStmt, index); + + if (_useWinSqlite) + { + return WinSQLite3.ColumnInt64(dbStatement.InternalStmt, index); + } + else + { + return SQLite3.ColumnInt64(dbStatement.InternalStmt, index); + } } public string ColumnName16(IDbStatement stmt, int index) { var dbStatement = (DbStatement)stmt; - return SQLite3.ColumnName16(dbStatement.InternalStmt, index); + + if (_useWinSqlite) + { + return WinSQLite3.ColumnName16(dbStatement.InternalStmt, index); + } + else + { + return SQLite3.ColumnName16(dbStatement.InternalStmt, index); + } } public string ColumnText16(IDbStatement stmt, int index) { var dbStatement = (DbStatement)stmt; - return Marshal.PtrToStringUni(SQLite3.ColumnText16(dbStatement.InternalStmt, index)); + + if (_useWinSqlite) + { + return Marshal.PtrToStringUni(WinSQLite3.ColumnText16(dbStatement.InternalStmt, index)); + } + else + { + return Marshal.PtrToStringUni(SQLite3.ColumnText16(dbStatement.InternalStmt, index)); + } } public ColType ColumnType(IDbStatement stmt, int index) { var dbStatement = (DbStatement)stmt; - return (ColType)SQLite3.ColumnType(dbStatement.InternalStmt, index); + + if (_useWinSqlite) + { + return (ColType)WinSQLite3.ColumnType(dbStatement.InternalStmt, index); + } + else + { + return (ColType)SQLite3.ColumnType(dbStatement.InternalStmt, index); + } } public int LibVersionNumber() { - return SQLite3.sqlite3_libversion_number(); + if (_useWinSqlite) + { + return WinSQLite3.sqlite3_libversion_number(); + } + else + { + return SQLite3.sqlite3_libversion_number(); + } + } + + public string SourceID() + { + + if (_useWinSqlite) + { + return Marshal.PtrToStringAnsi(WinSQLite3.sqlite3_sourceid()); + } + else + { + return Marshal.PtrToStringAnsi(SQLite3.sqlite3_sourceid()); + } } public Result EnableLoadExtension(IDbHandle db, int onoff) @@ -165,26 +367,60 @@ public Result EnableLoadExtension(IDbHandle db, int onoff) public string Errmsg16(IDbHandle db) { var dbHandle = (DbHandle)db; - return SQLite3.GetErrmsg(dbHandle.InternalDbHandle); + + if (_useWinSqlite) + { + return WinSQLite3.GetErrmsg(dbHandle.InternalDbHandle); + } + else + { + return SQLite3.GetErrmsg(dbHandle.InternalDbHandle); + } } public Result Finalize(IDbStatement stmt) { var dbStatement = (DbStatement)stmt; Sqlite3Statement internalStmt = dbStatement.InternalStmt; - return (Result)SQLite3.Finalize(internalStmt); + + if (_useWinSqlite) + { + return (Result)WinSQLite3.Finalize(internalStmt); + } + else + { + return (Result)SQLite3.Finalize(internalStmt); + } } public long LastInsertRowid(IDbHandle db) { var dbHandle = (DbHandle)db; - return SQLite3.LastInsertRowid(dbHandle.InternalDbHandle); + + if (_useWinSqlite) + { + return WinSQLite3.LastInsertRowid(dbHandle.InternalDbHandle); + } + else + { + return SQLite3.LastInsertRowid(dbHandle.InternalDbHandle); + } } public Result Open(byte[] filename, out IDbHandle db, int flags, IntPtr zvfs) { Sqlite3DatabaseHandle internalDbHandle; - var ret = (Result)SQLite3.Open(filename, out internalDbHandle, flags, zvfs); + Result ret; + + if (_useWinSqlite) + { + ret = (Result)WinSQLite3.Open(filename, out internalDbHandle, flags, zvfs); + } + else + { + ret = (Result)SQLite3.Open(filename, out internalDbHandle, flags, zvfs); + } + db = new DbHandle(internalDbHandle); return ret; } @@ -192,31 +428,68 @@ public Result Open(byte[] filename, out IDbHandle db, int flags, IntPtr zvfs) public ExtendedResult ExtendedErrCode(IDbHandle db) { var dbHandle = (DbHandle)db; - return SQLite3.sqlite3_extended_errcode(dbHandle.InternalDbHandle); + + if (_useWinSqlite) + { + return WinSQLite3.sqlite3_extended_errcode(dbHandle.InternalDbHandle); + } + else + { + return SQLite3.sqlite3_extended_errcode(dbHandle.InternalDbHandle); + } } public IDbStatement Prepare2(IDbHandle db, string query) { var dbHandle = (DbHandle)db; var stmt = default(Sqlite3Statement); - var r = SQLite3.Prepare2(dbHandle.InternalDbHandle, query, query.Length, out stmt, IntPtr.Zero); - if (r != Result.OK) + + if (_useWinSqlite) + { + var r = WinSQLite3.Prepare2(dbHandle.InternalDbHandle, query, query.Length, out stmt, IntPtr.Zero); + if (r != Result.OK) + { + throw SQLiteException.New(r, WinSQLite3.GetErrmsg(dbHandle.InternalDbHandle)); + } + } + else { - throw SQLiteException.New(r, SQLite3.GetErrmsg(dbHandle.InternalDbHandle)); + var r = SQLite3.Prepare2(dbHandle.InternalDbHandle, query, query.Length, out stmt, IntPtr.Zero); + if (r != Result.OK) + { + throw SQLiteException.New(r, SQLite3.GetErrmsg(dbHandle.InternalDbHandle)); + } } + return new DbStatement(stmt); } public Result Reset(IDbStatement stmt) { var dbStatement = (DbStatement)stmt; - return (Result)SQLite3.Reset(dbStatement.InternalStmt); + + if (_useWinSqlite) + { + return (Result)WinSQLite3.Reset(dbStatement.InternalStmt); + } + else + { + return (Result)SQLite3.Reset(dbStatement.InternalStmt); + } } public Result Step(IDbStatement stmt) { var dbStatement = (DbStatement)stmt; - return (Result)SQLite3.Step(dbStatement.InternalStmt); + + if (_useWinSqlite) + { + return (Result)WinSQLite3.Step(dbStatement.InternalStmt); + } + else + { + return (Result)SQLite3.Step(dbStatement.InternalStmt); + } } #region Backup @@ -225,11 +498,22 @@ public IDbBackupHandle BackupInit(IDbHandle destHandle, string destName, IDbHand { var internalDestDb = (DbHandle)destHandle; var internalSrcDb = (DbHandle)srcHandle; + IntPtr p; - IntPtr p = SQLite3.sqlite3_backup_init(internalDestDb.InternalDbHandle, + if (_useWinSqlite) + { + p = WinSQLite3.sqlite3_backup_init(internalDestDb.InternalDbHandle, destName, internalSrcDb.InternalDbHandle, srcName); + } + else + { + p = SQLite3.sqlite3_backup_init(internalDestDb.InternalDbHandle, + destName, + internalSrcDb.InternalDbHandle, + srcName); + } if (p == IntPtr.Zero) { @@ -244,30 +528,70 @@ public IDbBackupHandle BackupInit(IDbHandle destHandle, string destName, IDbHand public Result BackupStep(IDbBackupHandle handle, int pageCount) { var internalBackup = (DbBackupHandle)handle; - return SQLite3.sqlite3_backup_step(internalBackup.DbBackupPtr, pageCount); + + if (_useWinSqlite) + { + return WinSQLite3.sqlite3_backup_step(internalBackup.DbBackupPtr, pageCount); + } + else + { + return SQLite3.sqlite3_backup_step(internalBackup.DbBackupPtr, pageCount); + } } public Result BackupFinish(IDbBackupHandle handle) { var internalBackup = (DbBackupHandle)handle; - return SQLite3.sqlite3_backup_finish(internalBackup.DbBackupPtr); + + if (_useWinSqlite) + { + return WinSQLite3.sqlite3_backup_finish(internalBackup.DbBackupPtr); + } + else + { + return SQLite3.sqlite3_backup_finish(internalBackup.DbBackupPtr); + } } public int BackupRemaining(IDbBackupHandle handle) { var internalBackup = (DbBackupHandle)handle; - return SQLite3.sqlite3_backup_remaining(internalBackup.DbBackupPtr); + + if (_useWinSqlite) + { + return WinSQLite3.sqlite3_backup_remaining(internalBackup.DbBackupPtr); + } + else + { + return SQLite3.sqlite3_backup_remaining(internalBackup.DbBackupPtr); + } } public int BackupPagecount(IDbBackupHandle handle) { var internalBackup = (DbBackupHandle)handle; - return SQLite3.sqlite3_backup_pagecount(internalBackup.DbBackupPtr); + + if (_useWinSqlite) + { + return WinSQLite3.sqlite3_backup_pagecount(internalBackup.DbBackupPtr); + } + else + { + return SQLite3.sqlite3_backup_pagecount(internalBackup.DbBackupPtr); + } } public int Sleep(int millis) { - return SQLite3.sqlite3_sleep(millis); + + if (_useWinSqlite) + { + return WinSQLite3.sqlite3_sleep(millis); + } + else + { + return SQLite3.sqlite3_sleep(millis); + } } private struct DbBackupHandle : IDbBackupHandle @@ -350,8 +674,8 @@ public static class SQLite3 [DllImport("sqlite3", EntryPoint = "sqlite3_changes", CallingConvention = CallingConvention.Cdecl)] public static extern int Changes(IntPtr db); - [DllImport("sqlite3", EntryPoint = "sqlite3_prepare_v2", CallingConvention = CallingConvention.Cdecl)] - public static extern Result Prepare2(IntPtr db, [MarshalAs(UnmanagedType.LPStr)] string sql, int numBytes, out IntPtr stmt, IntPtr pzTail); + [DllImport("sqlite3", EntryPoint = "sqlite3_prepare16_v2", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Prepare2(IntPtr db, [MarshalAs(UnmanagedType.LPWStr)] string sql, int numBytes, out IntPtr stmt, IntPtr pzTail); [DllImport("sqlite3", EntryPoint = "sqlite3_step", CallingConvention = CallingConvention.Cdecl)] public static extern Result Step(IntPtr stmt); @@ -451,6 +775,9 @@ public static byte[] ColumnByteArray(IntPtr stmt, int index) [DllImport("sqlite3", EntryPoint = "sqlite3_libversion_number", CallingConvention = CallingConvention.Cdecl)] public static extern int sqlite3_libversion_number(); + [DllImport("sqlite3", EntryPoint = "sqlite3_sourceid", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_sourceid(); + #region Backup [DllImport("sqlite3", EntryPoint = "sqlite3_backup_init", CallingConvention = CallingConvention.Cdecl)] @@ -476,4 +803,167 @@ public static extern IntPtr sqlite3_backup_init(IntPtr destDB, #endregion } -} \ No newline at end of file + + /// + /// WinSQLite is built-in to Windows 10.0.10586.0 and above. Using it can reduce app size and potentially increase SQLite load time. + /// For more information see: + /// + public static class WinSQLite3 + { + [DllImport("winsqlite3", EntryPoint = "sqlite3_open", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Open([MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr db); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_open_v2", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Open([MarshalAs(UnmanagedType.LPStr)] string filename, out IntPtr db, int flags, IntPtr zvfs); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_open_v2", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Open(byte[] filename, out IntPtr db, int flags, IntPtr zvfs); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_open16", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Open16([MarshalAs(UnmanagedType.LPWStr)] string filename, out IntPtr db); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_close", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Close(IntPtr db); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Config(ConfigOption option); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_win32_set_directory", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] + public static extern int SetDirectory(uint directoryType, string directoryPath); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_busy_timeout", CallingConvention = CallingConvention.Cdecl)] + public static extern Result BusyTimeout(IntPtr db, int milliseconds); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_changes", CallingConvention = CallingConvention.Cdecl)] + public static extern int Changes(IntPtr db); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_prepare16_v2", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Prepare2(IntPtr db, [MarshalAs(UnmanagedType.LPStr)] string sql, int numBytes, out IntPtr stmt, IntPtr pzTail); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_step", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Step(IntPtr stmt); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_reset", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Reset(IntPtr stmt); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_finalize", CallingConvention = CallingConvention.Cdecl)] + public static extern Result Finalize(IntPtr stmt); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_last_insert_rowid", CallingConvention = CallingConvention.Cdecl)] + public static extern long LastInsertRowid(IntPtr db); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_errmsg16", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr Errmsg(IntPtr db); + + public static string GetErrmsg(IntPtr db) + { + return Marshal.PtrToStringUni(Errmsg(db)); + } + + [DllImport("winsqlite3", EntryPoint = "sqlite3_bind_parameter_index", CallingConvention = CallingConvention.Cdecl)] + public static extern int BindParameterIndex(IntPtr stmt, [MarshalAs(UnmanagedType.LPStr)] string name); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_bind_null", CallingConvention = CallingConvention.Cdecl)] + public static extern int BindNull(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_bind_int", CallingConvention = CallingConvention.Cdecl)] + public static extern int BindInt(IntPtr stmt, int index, int val); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_bind_int64", CallingConvention = CallingConvention.Cdecl)] + public static extern int BindInt64(IntPtr stmt, int index, long val); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_bind_double", CallingConvention = CallingConvention.Cdecl)] + public static extern int BindDouble(IntPtr stmt, int index, double val); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_bind_text16", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] + public static extern int BindText(IntPtr stmt, int index, [MarshalAs(UnmanagedType.LPWStr)] string val, int n, IntPtr free); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_bind_blob", CallingConvention = CallingConvention.Cdecl)] + public static extern int BindBlob(IntPtr stmt, int index, byte[] val, int n, IntPtr free); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_count", CallingConvention = CallingConvention.Cdecl)] + public static extern int ColumnCount(IntPtr stmt); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_name", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr ColumnName(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_name16", CallingConvention = CallingConvention.Cdecl)] + private static extern IntPtr ColumnName16Internal(IntPtr stmt, int index); + public static string ColumnName16(IntPtr stmt, int index) + { + return Marshal.PtrToStringUni(ColumnName16Internal(stmt, index)); + } + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_type", CallingConvention = CallingConvention.Cdecl)] + public static extern ColType ColumnType(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_int", CallingConvention = CallingConvention.Cdecl)] + public static extern int ColumnInt(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_int64", CallingConvention = CallingConvention.Cdecl)] + public static extern long ColumnInt64(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_double", CallingConvention = CallingConvention.Cdecl)] + public static extern double ColumnDouble(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_text", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr ColumnText(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_text16", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr ColumnText16(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_blob", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr ColumnBlob(IntPtr stmt, int index); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_column_bytes", CallingConvention = CallingConvention.Cdecl)] + public static extern int ColumnBytes(IntPtr stmt, int index); + + public static string ColumnString(IntPtr stmt, int index) + { + return Marshal.PtrToStringUni(WinSQLite3.ColumnText16(stmt, index)); + } + + public static byte[] ColumnByteArray(IntPtr stmt, int index) + { + int length = ColumnBytes(stmt, index); + byte[] result = new byte[length]; + if (length > 0) + Marshal.Copy(ColumnBlob(stmt, index), result, 0, length); + return result; + } + + [DllImport("winsqlite3", EntryPoint = "sqlite3_extended_errcode", CallingConvention = CallingConvention.Cdecl)] + public static extern ExtendedResult sqlite3_extended_errcode(IntPtr db); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_libversion_number", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_libversion_number(); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_sourceid", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_sourceid(); + + #region Backup + + [DllImport("winsqlite3", EntryPoint = "sqlite3_backup_init", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr sqlite3_backup_init(IntPtr destDB, + [MarshalAs(UnmanagedType.LPStr)] string destName, + IntPtr srcDB, + [MarshalAs(UnmanagedType.LPStr)] string srcName); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_backup_step", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_backup_step(IntPtr backup, int pageCount); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_backup_finish", CallingConvention = CallingConvention.Cdecl)] + public static extern Result sqlite3_backup_finish(IntPtr backup); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_backup_remaining", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_backup_remaining(IntPtr backup); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_backup_pagecount", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_backup_pagecount(IntPtr backup); + + [DllImport("winsqlite3", EntryPoint = "sqlite3_sleep", CallingConvention = CallingConvention.Cdecl)] + public static extern int sqlite3_sleep(int millis); + + #endregion + } +} diff --git a/src/SQLite.Net.Platform.WinRT/SQLitePlatformWinRT.cs b/src/SQLite.Net.Platform.WinRT/SQLitePlatformWinRT.cs index 7872511a7..a77c508fc 100644 --- a/src/SQLite.Net.Platform.WinRT/SQLitePlatformWinRT.cs +++ b/src/SQLite.Net.Platform.WinRT/SQLitePlatformWinRT.cs @@ -5,9 +5,14 @@ namespace SQLite.Net.Platform.WinRT { public class SQLitePlatformWinRT : ISQLitePlatform { - public SQLitePlatformWinRT() + /// + /// Creates a SQLite platform object for use from WinRT. + /// + /// Optional: Temporary folder path. Defaults to + /// Optional: Whether to use WinSQLite instead of SQLite. WinSQLite is built-in to Windows 10.0.10586.0 and above. Using it can reduce app size and potentially increase SQLite load time. + public SQLitePlatformWinRT(string tempFolderPath = null, bool useWinSqlite = false) { - SQLiteApi = new SQLiteApiWinRT(); + SQLiteApi = new SQLiteApiWinRT(tempFolderPath, useWinSqlite); VolatileService = new VolatileServiceWinRT(); StopwatchFactory = new StopwatchFactoryWinRT(); ReflectionService = new ReflectionServiceWinRT(); diff --git a/src/SQLite.Net.Platform.WindowsPhone8/SQLite.Net.Platform.WindowsPhone8.csproj b/src/SQLite.Net.Platform.WindowsPhone8/SQLite.Net.Platform.WindowsPhone8.csproj index 34d4b4561..a3409ee5c 100644 --- a/src/SQLite.Net.Platform.WindowsPhone8/SQLite.Net.Platform.WindowsPhone8.csproj +++ b/src/SQLite.Net.Platform.WindowsPhone8/SQLite.Net.Platform.WindowsPhone8.csproj @@ -1,5 +1,6 @@  + Debug AnyCPU @@ -20,6 +21,7 @@ true ..\..\ true + 568df22d true @@ -100,15 +102,28 @@ {ABF3D656-3D1C-45D1-B6FD-41B088E5A533} SQLite.Net - - ..\..\packages\sqlite-net-wp8.3.8.3\lib\windowsphone8\Sqlite.winmd + + + + ..\..\packages\sqlite-net-wp8.3.8.5\lib\windowsphone8\Sqlite.winmd + True + + + - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + - + \ No newline at end of file diff --git a/src/SQLite.Net/SQLiteCommand.cs b/src/SQLite.Net/SQLiteCommand.cs index 6259f14f4..9db0d705b 100755 --- a/src/SQLite.Net/SQLiteCommand.cs +++ b/src/SQLite.Net/SQLiteCommand.cs @@ -23,6 +23,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Reflection; using JetBrains.Annotations; @@ -38,6 +39,7 @@ public class SQLiteCommand private readonly SQLiteConnection _conn; private readonly ISQLitePlatform _sqlitePlatform; + private const string DateTimeFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; internal SQLiteCommand(ISQLitePlatform platformImplementation, SQLiteConnection conn) { @@ -343,11 +345,13 @@ internal static void BindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, in { if (storeDateTimeAsTicks) { - isqLite3Api.BindInt64(stmt, index, ((DateTime) value).ToUniversalTime().Ticks); + long ticks = ((DateTime) value).ToUniversalTime().Ticks; + isqLite3Api.BindInt64(stmt, index, ticks); } else { - isqLite3Api.BindText16(stmt, index, ((DateTime) value).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"), -1, NegativePointer); + string val = ((DateTime) value).ToUniversalTime().ToString(DateTimeFormat, CultureInfo.InvariantCulture); + isqLite3Api.BindText16(stmt, index, val, -1, NegativePointer); } } else if (value is DateTimeOffset) @@ -358,12 +362,13 @@ internal static void BindParameter(ISQLiteApi isqLite3Api, IDbStatement stmt, in { if (storeDateTimeAsTicks) { - isqLite3Api.BindInt64(stmt, index, ((ISerializable) value).Serialize().ToUniversalTime().Ticks); + long ticks = ((ISerializable) value).Serialize().ToUniversalTime().Ticks; + isqLite3Api.BindInt64(stmt, index, ticks); } else { - isqLite3Api.BindText16(stmt, index, - ((ISerializable) value).Serialize().ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"), -1, NegativePointer); + string val = ((ISerializable) value).Serialize().ToUniversalTime().ToString(DateTimeFormat, CultureInfo.InvariantCulture); + isqLite3Api.BindText16(stmt, index, val, -1, NegativePointer); } } else if (value.GetType().GetTypeInfo().IsEnum) @@ -468,7 +473,7 @@ private object ReadCol(IDbStatement stmt, int index, ColType type, Type clrType) { return new DateTime(_sqlitePlatform.SQLiteApi.ColumnInt64(stmt, index), DateTimeKind.Utc); } - return DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index)); + return DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index), CultureInfo.InvariantCulture); } if (clrType == typeof (DateTimeOffset)) { @@ -479,11 +484,11 @@ private object ReadCol(IDbStatement stmt, int index, ColType type, Type clrType) DateTime value; if (_conn.StoreDateTimeAsTicks) { - value = new DateTime(_sqlitePlatform.SQLiteApi.ColumnInt64(stmt, index)); + value = new DateTime(_sqlitePlatform.SQLiteApi.ColumnInt64(stmt, index), DateTimeKind.Utc); } else { - value = DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index)); + value = DateTime.Parse(_sqlitePlatform.SQLiteApi.ColumnText16(stmt, index), CultureInfo.InvariantCulture); } return Activator.CreateInstance(clrType, value); } diff --git a/src/SQLite.Net/SQLiteConnection.cs b/src/SQLite.Net/SQLiteConnection.cs index 8aad37d1a..e167fec96 100644 --- a/src/SQLite.Net/SQLiteConnection.cs +++ b/src/SQLite.Net/SQLiteConnection.cs @@ -52,6 +52,7 @@ public class SQLiteConnection : IDisposable #pragma warning restore 649 private readonly Random _rand = new Random(); private readonly IDictionary _tableMappings; + private readonly object _tableMappingsLocks; private TimeSpan _busyTimeout; private long _elapsedMilliseconds; private IDictionary _insertCommandCache; @@ -99,14 +100,9 @@ static SQLiteConnection() /// A contract resovler for resolving interfaces to concreate types during object creation /// [PublicAPI] - public SQLiteConnection( - ISQLitePlatform sqlitePlatform, - string databasePath, - bool storeDateTimeAsTicks = true, - IBlobSerializer serializer = null, - IDictionary tableMappings = null, - IDictionary extraTypeMappings = null, - IContractResolver resolver = null) + public SQLiteConnection([JetBrains.Annotations.NotNull] ISQLitePlatform sqlitePlatform, [JetBrains.Annotations.NotNull] string databasePath, + bool storeDateTimeAsTicks = true, [CanBeNull] IBlobSerializer serializer = null, [CanBeNull] IDictionary tableMappings = null, + [CanBeNull] IDictionary extraTypeMappings = null, [CanBeNull] IContractResolver resolver = null) : this(sqlitePlatform, databasePath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create, storeDateTimeAsTicks, serializer, tableMappings, extraTypeMappings, resolver) { @@ -157,6 +153,7 @@ public SQLiteConnection([JetBrains.Annotations.NotNull] ISQLitePlatform sqlitePl Resolver = resolver ?? ContractResolver.Current; _tableMappings = tableMappings ?? new Dictionary(); + _tableMappingsLocks = new object(); if (string.IsNullOrEmpty(databasePath)) { @@ -189,6 +186,18 @@ public SQLiteConnection([JetBrains.Annotations.NotNull] ISQLitePlatform sqlitePl BusyTimeout = TimeSpan.FromSeconds(0.1); } + private IColumnInformationProvider _columnInformationProvider; + [CanBeNull, PublicAPI] + public IColumnInformationProvider ColumnInformationProvider + { + get { return _columnInformationProvider; } + set + { + _columnInformationProvider = value; + Orm.ColumnInformationProvider = _columnInformationProvider ?? new DefaultColumnInformationProvider (); + } + } + [CanBeNull, PublicAPI] public IBlobSerializer Serializer { get; private set; } @@ -240,7 +249,13 @@ public TimeSpan BusyTimeout [JetBrains.Annotations.NotNull] public IEnumerable TableMappings { - get { return _tableMappings.Values; } + get + { + lock (_tableMappingsLocks) + { + return _tableMappings.Values.ToList(); + } + } } /// @@ -298,16 +313,19 @@ private static byte[] GetNullTerminatedUtf8(string s) [PublicAPI] public TableMapping GetMapping(Type type, CreateFlags createFlags = CreateFlags.None) { - TableMapping map; - return _tableMappings.TryGetValue(type.FullName, out map) ? map : CreateAndSetMapping(type, createFlags, _tableMappings); + lock (_tableMappingsLocks) + { + TableMapping map; + return _tableMappings.TryGetValue(type.FullName, out map) ? map : CreateAndSetMapping(type, createFlags, _tableMappings); + } } private TableMapping CreateAndSetMapping(Type type, CreateFlags createFlags, IDictionary mapTable) { var props = Platform.ReflectionService.GetPublicInstanceProperties(type); - var map = new TableMapping(type, props, createFlags); + var map = new TableMapping(type, props, createFlags, _columnInformationProvider); mapTable[type.FullName] = map; - return map; + return map; } /// @@ -329,7 +347,16 @@ public TableMapping GetMapping() [PublicAPI] public int DropTable() { - var map = GetMapping(typeof (T)); + return DropTable(typeof (T)); + } + + /// + /// Executes a "drop table" on the database. This is non-recoverable. + /// + [PublicAPI] + public int DropTable(Type t) + { + var map = GetMapping(t); var query = string.Format("drop table if exists \"{0}\"", map.TableName); @@ -529,6 +556,19 @@ public List GetTableInfo(string tableName) return Query(query); } + [PublicAPI] + public void MigrateTable() + { + MigrateTable(typeof(T)); + } + + [PublicAPI] + public void MigrateTable(Type t) + { + var map = GetMapping(t); + MigrateTable(map); + } + private void MigrateTable(TableMapping map) { var existingCols = GetTableInfo(map.TableName); @@ -1250,6 +1290,27 @@ public int InsertAll(IEnumerable objects, Type objType, bool runInTransaction = return c; } + [PublicAPI] + public int InsertOrIgnoreAll (IEnumerable objects) + { + return InsertAll (objects, "OR IGNORE"); + } + + [PublicAPI] + public int InsertOrIgnore (object obj) + { + if (obj == null) { + return 0; + } + return Insert (obj, "OR IGNORE", obj.GetType ()); + } + + [PublicAPI] + public int InsertOrIgnore (object obj, Type objType) + { + return Insert (obj, "OR IGNORE", objType); + } + /// /// Inserts the given object and retrieves its /// auto incremented primary key if it has one. @@ -1679,7 +1740,21 @@ public int Delete(object primaryKey) [PublicAPI] public int DeleteAll() { - var map = GetMapping(typeof (T)); + return DeleteAll(typeof (T)); + } + + /// + /// Deletes all the objects from the specified table. + /// WARNING WARNING: Let me repeat. It deletes ALL the objects from the + /// specified table. Do you really want to do that? + /// + /// + /// The number of objects deleted. + /// + [PublicAPI] + public int DeleteAll(Type t) + { + var map = GetMapping(t); var query = string.Format("delete from \"{0}\"", map.TableName); return Execute(query); } diff --git a/src/SQLite.Net/SQLiteConnectionPool.cs b/src/SQLite.Net/SQLiteConnectionPool.cs index 19f5542a3..ebbbfc2fa 100644 --- a/src/SQLite.Net/SQLiteConnectionPool.cs +++ b/src/SQLite.Net/SQLiteConnectionPool.cs @@ -21,12 +21,14 @@ // THE SOFTWARE. // +using System; using System.Collections.Generic; using JetBrains.Annotations; using SQLite.Net.Interop; namespace SQLite.Net { + [Obsolete] public class SQLiteConnectionPool { private readonly Dictionary _entries = new Dictionary(); diff --git a/src/SQLite.Net/SQLiteConnectionString.cs b/src/SQLite.Net/SQLiteConnectionString.cs index 3e122ebf2..ba6e095d6 100644 --- a/src/SQLite.Net/SQLiteConnectionString.cs +++ b/src/SQLite.Net/SQLiteConnectionString.cs @@ -22,6 +22,7 @@ // using JetBrains.Annotations; +using SQLite.Net.Interop; namespace SQLite.Net { @@ -33,7 +34,8 @@ public class SQLiteConnectionString [PublicAPI] public SQLiteConnectionString(string databasePath, bool storeDateTimeAsTicks, IBlobSerializer serializer = null, - IContractResolver resolver = null) + IContractResolver resolver = null, + SQLiteOpenFlags? openFlags = null) { ConnectionString = databasePath; StoreDateTimeAsTicks = storeDateTimeAsTicks; @@ -41,6 +43,7 @@ public SQLiteConnectionString(string databasePath, bool storeDateTimeAsTicks, DatabasePath = databasePath; Serializer = serializer; Resolver = resolver ?? ContractResolver.Current; + OpenFlags = openFlags ?? SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create; } [PublicAPI] @@ -57,5 +60,8 @@ public SQLiteConnectionString(string databasePath, bool storeDateTimeAsTicks, [PublicAPI] public IContractResolver Resolver { get; private set; } + + [PublicAPI] + public SQLiteOpenFlags OpenFlags {get; private set; } } } \ No newline at end of file diff --git a/src/SQLite.Net/SQLiteConnectionWithLock.cs b/src/SQLite.Net/SQLiteConnectionWithLock.cs index bcfc3d2e2..d4e01df2d 100644 --- a/src/SQLite.Net/SQLiteConnectionWithLock.cs +++ b/src/SQLite.Net/SQLiteConnectionWithLock.cs @@ -21,6 +21,7 @@ // THE SOFTWARE. using System; +using System.Collections.Generic; using System.Threading; using JetBrains.Annotations; using SQLite.Net.Interop; @@ -32,8 +33,12 @@ public class SQLiteConnectionWithLock : SQLiteConnection private readonly object _lockPoint = new object(); [PublicAPI] - public SQLiteConnectionWithLock(ISQLitePlatform sqlitePlatform, SQLiteConnectionString connectionString) - : base(sqlitePlatform, connectionString.DatabasePath, connectionString.StoreDateTimeAsTicks, connectionString.Serializer, null, null, connectionString.Resolver) { } + public SQLiteConnectionWithLock([NotNull] ISQLitePlatform sqlitePlatform, + [NotNull] SQLiteConnectionString connectionString, + IDictionary tableMappings = null, + IDictionary extraTypeMappings = null) + : base(sqlitePlatform, connectionString.DatabasePath, connectionString.OpenFlags, connectionString.StoreDateTimeAsTicks, connectionString.Serializer, tableMappings, extraTypeMappings, connectionString.Resolver) { } + [PublicAPI] public IDisposable Lock() @@ -45,7 +50,7 @@ private class LockWrapper : IDisposable { private readonly object _lockPoint; - public LockWrapper(object lockPoint) + public LockWrapper([NotNull] object lockPoint) { _lockPoint = lockPoint; Monitor.Enter(_lockPoint); diff --git a/src/SQLite.Net/TableMapping.cs b/src/SQLite.Net/TableMapping.cs index c14a5081b..86b49a035 100644 --- a/src/SQLite.Net/TableMapping.cs +++ b/src/SQLite.Net/TableMapping.cs @@ -36,8 +36,13 @@ public class TableMapping private Column[] _insertColumns; [PublicAPI] - public TableMapping(Type type, IEnumerable properties, CreateFlags createFlags = CreateFlags.None) + public TableMapping(Type type, IEnumerable properties, CreateFlags createFlags = CreateFlags.None, IColumnInformationProvider infoProvider = null) { + if (infoProvider == null) + { + infoProvider = new DefaultColumnInformationProvider (); + } + MappedType = type; var tableAttr = type.GetTypeInfo().GetCustomAttributes().FirstOrDefault(); @@ -49,7 +54,7 @@ public TableMapping(Type type, IEnumerable properties, CreateFlags var cols = new List(); foreach (var p in props) { - var ignore = p.IsDefined(typeof (IgnoreAttribute), true); + var ignore = infoProvider.IsIgnored (p); if (p.CanWrite && !ignore) { @@ -134,13 +139,15 @@ public class Column private readonly PropertyInfo _prop; [PublicAPI] - public Column(PropertyInfo prop, CreateFlags createFlags = CreateFlags.None) + public Column(PropertyInfo prop, CreateFlags createFlags = CreateFlags.None, IColumnInformationProvider infoProvider = null) { - var colAttr = - prop.GetCustomAttributes(true).FirstOrDefault(); + if (infoProvider == null) + { + infoProvider = new DefaultColumnInformationProvider(); + } _prop = prop; - Name = colAttr == null ? prop.Name : colAttr.Name; + Name = infoProvider.GetColumnName(prop); //If this type is Nullable then Nullable.GetUnderlyingType returns the T, otherwise it returns null, so get the actual type instead ColumnType = Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType; Collation = Orm.Collation(prop); diff --git a/src/SQLite.Net/TableQuery.cs b/src/SQLite.Net/TableQuery.cs index 588881a26..96c4f989a 100644 --- a/src/SQLite.Net/TableQuery.cs +++ b/src/SQLite.Net/TableQuery.cs @@ -432,6 +432,10 @@ private CompileResult CompileExpr([NotNull] Expression expr, List queryA { sqlCall = "(upper(" + obj.CommandText + "))"; } + else if (call.Method.Name == "Replace" && args.Length == 2) + { + sqlCall = "(replace(" + obj.CommandText + ", " + args[0].CommandText + ", " + args[1].CommandText + "))"; + } else { sqlCall = call.Method.Name.ToLower() + "(" + diff --git a/src/SQLite.Net/packages.config b/src/SQLite.Net/packages.config deleted file mode 100644 index a13cbcbf9..000000000 --- a/src/SQLite.Net/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/tests/ArithmeticTest.cs b/tests/ArithmeticTest.cs index 5f9f29080..4f21d7b38 100644 --- a/tests/ArithmeticTest.cs +++ b/tests/ArithmeticTest.cs @@ -4,21 +4,6 @@ using NUnit.Framework; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -61,7 +46,7 @@ public void CanHaveAddInWhereClause() Data = i, }; - var db = new TestDb(TestPath.GetTempFileName()); + var db = new TestDb(TestPath.CreateTemporaryDatabase()); db.InsertAll(cq); TableQuery results = db.Table().Where(o => o.Data + 10 >= n); @@ -79,7 +64,7 @@ public void CanHaveSubtractInWhereClause() Data = i, }; - var db = new TestDb(TestPath.GetTempFileName()); + var db = new TestDb(TestPath.CreateTemporaryDatabase()); db.InsertAll(cq); TableQuery results = db.Table().Where(o => o.Data - 10 >= 0); @@ -97,7 +82,7 @@ public void AddForStringsMeansConcatenate() Data = i.ToString(), }; - var db = new TestDb(TestPath.GetTempFileName()); + var db = new TestDb(TestPath.CreateTemporaryDatabase()); db.InsertAll(cq); TableQuery results = db.Table().Where(o => o.Data + "1" == "11"); diff --git a/tests/AsyncTests.cs b/tests/AsyncTests.cs index 38acdecfd..67a376078 100644 --- a/tests/AsyncTests.cs +++ b/tests/AsyncTests.cs @@ -5,22 +5,11 @@ using System.Threading; using System.Threading.Tasks; using NUnit.Framework; +using PCLStorage; using SQLite.Net.Async; using SQLite.Net.Attributes; +using System.Diagnostics; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif namespace SQLite.Net.Tests { @@ -42,6 +31,31 @@ public class Customer public string Email { get; set; } } + public class Customer2 + { + [PrimaryKey] + public int Id { get; set; } + + [MaxLength(64)] + public string FirstName { get; set; } + + [MaxLength(64)] + public string LastName { get; set; } + + [MaxLength(64)] + public string Email { get; set; } + } + + [Table("AGoodTableName")] + public class AFunnyTableName + { + [PrimaryKey] + public int Id { get; set; } + + [Column("AGoodColumnName")] + public string AFunnyColumnName { get; set; } + } + /// /// Defines tests that exercise async behaviour. /// @@ -51,42 +65,28 @@ public class AsyncTests [SetUp] public void SetUp() { - if (_sqliteConnectionPool != null) - { - _sqliteConnectionPool.Reset(); - } - _path = Path.Combine(Path.GetTempPath(), DatabaseName); - // delete old db file - File.Delete(_path); + var databaseFile = TestPath.CreateTemporaryDatabase(); - _connectionParameters = new SQLiteConnectionString(_path, false); - _sqliteConnectionPool = new SQLiteConnectionPool(_sqlite3Platform); + _connectionParameters = new SQLiteConnectionString(databaseFile, false); } - private const string DatabaseName = "async.db"; - - private SQLiteAsyncConnection GetConnection() - { - string path = null; - return GetConnection(ref path); - } - - private string _path; private SQLiteConnectionString _connectionParameters; private SQLitePlatformTest _sqlite3Platform; - private SQLiteConnectionPool _sqliteConnectionPool; [TestFixtureSetUp] public void TestFixtureSetUp() { _sqlite3Platform = new SQLitePlatformTest(); - _sqliteConnectionPool = new SQLiteConnectionPool(_sqlite3Platform); } - private SQLiteAsyncConnection GetConnection(ref string path) + private SQLiteAsyncConnection GetAsyncConnection() { - path = _path; - return new SQLiteAsyncConnection(() => _sqliteConnectionPool.GetConnection(_connectionParameters)); + return new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(_sqlite3Platform, _connectionParameters)); + } + + private SQLiteConnection GetSyncConnection() + { + return new SQLiteConnectionWithLock(_sqlite3Platform, _connectionParameters); } private Customer CreateCustomer() @@ -110,8 +110,7 @@ public async Task FindAsyncWithExpression() customer.Email = Guid.NewGuid().ToString(); // connect and insert... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.InsertAsync(customer); @@ -129,7 +128,7 @@ public async Task FindAsyncWithExpression() public async Task FindAsyncWithExpressionNull() { // connect and insert... - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // get it back... @@ -149,8 +148,7 @@ public async Task GetAsync() customer.Email = Guid.NewGuid().ToString(); // connect and insert... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.InsertAsync(customer); @@ -164,11 +162,24 @@ public async Task GetAsync() Assert.AreEqual(customer.Id, loaded.Id); } + [Test] public async Task StressAsync() { - string path = null; - SQLiteAsyncConnection globalConn = GetConnection(ref path); + const int defaultBusyTimeout = 100; + + SQLiteAsyncConnection globalConn = GetAsyncConnection(); + + // see http://stackoverflow.com/questions/12004426/sqlite-returns-sqlite-busy-in-wal-mode + var journalMode = await globalConn.ExecuteScalarAsync("PRAGMA journal_mode = wal"); // = wal"); + Debug.WriteLine("journal_mode: " + journalMode); + //var synchronous = await globalConn.ExecuteScalarAsync("PRAGMA synchronous"); // 2 = FULL + //Debug.WriteLine("synchronous: " + synchronous); + //var pageSize = await globalConn.ExecuteScalarAsync("PRAGMA page_size"); // 1024 default + //Debug.WriteLine("page_size: " + pageSize); + var busyTimeout = await globalConn.ExecuteScalarAsync( + string.Format("PRAGMA busy_timeout = {0}", defaultBusyTimeout)); + Debug.WriteLine("busy_timeout: " + busyTimeout); await globalConn.CreateTableAsync(); @@ -177,16 +188,30 @@ public async Task StressAsync() var tasks = new List(); for (int i = 0; i < n; i++) { - tasks.Add(Task.Factory.StartNew(async delegate + int taskId = i; + + tasks.Add(Task.Run(async () => { + string taskStep = ""; + try { - SQLiteAsyncConnection conn = GetConnection(); + taskStep = "CONNECT"; + SQLiteAsyncConnection conn = GetAsyncConnection(); + + // each connection retains the global journal_mode but somehow resets busy_timeout to 100 + busyTimeout = await globalConn.ExecuteScalarAsync( + string.Format("PRAGMA busy_timeout = {0}", defaultBusyTimeout)); +// Debug.WriteLine("busy_timeout: " + busyTimeout); + var obj = new Customer { - FirstName = i.ToString(), + FirstName = taskId.ToString(), }; + + taskStep = "INSERT"; await conn.InsertAsync(obj); + if (obj.Id == 0) { lock (errors) @@ -194,6 +219,8 @@ public async Task StressAsync() errors.Add("Bad Id"); } } + + taskStep = "SELECT"; var obj3 = await (from c in conn.Table() where c.Id == obj.Id select c).ToListAsync(); Customer obj2 = obj3.FirstOrDefault(); if (obj2 == null) @@ -203,28 +230,41 @@ public async Task StressAsync() errors.Add("Failed query"); } } + +// Debug.WriteLine("task {0} with id {1} and name {2}", taskId, obj.Id, obj.FirstName); } catch (Exception ex) { lock (errors) { - errors.Add(ex.Message); + errors.Add(string.Format("{0}: {1}", taskStep, ex.Message)); } } })); } await Task.WhenAll(tasks); + Assert.AreEqual(n, tasks.Where(t => t.IsCompleted).Count()); + + //int j = 0; + //foreach (var error in errors) + //{ + // Debug.WriteLine("{0} {1}", j++, error); + //} + + Assert.AreEqual(0, errors.Count, "Error in task runs"); + int count = await globalConn.Table().CountAsync(); + Assert.AreEqual(n, count, "Not enough items in table"); - Assert.AreEqual(0, errors.Count); - Assert.AreEqual(n, count); + // TODO: get out of wal mode - currently fails with 'database is locked' +// journalMode = await globalConn.ExecuteScalarAsync("PRAGMA journal_mode = delete"); } [Test] public async Task TestAsyncGetWithExpression() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -245,7 +285,7 @@ public async Task TestAsyncGetWithExpression() [Test] public async Task TestAsyncTableElementAtAsync() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -268,7 +308,7 @@ public async Task TestAsyncTableElementAtAsync() [Test] public async Task TestAsyncTableOrderBy() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -289,7 +329,7 @@ public async Task TestAsyncTableOrderBy() [Test] public async Task TestAsyncTableOrderByDescending() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -310,7 +350,7 @@ public async Task TestAsyncTableOrderByDescending() [Test] public async Task TestAsyncTableThenBy() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -336,7 +376,7 @@ public async Task TestAsyncTableThenBy() [Test] public async Task TestAsyncTableThenByDescending() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -363,7 +403,7 @@ public async Task TestAsyncTableThenByDescending() [Test] public async Task TestAsyncTableQueryCountAsync() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -384,7 +424,7 @@ public async Task TestAsyncTableQueryCountAsync() [Test] public async Task TestAsyncTableQuerySkip() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -408,7 +448,7 @@ public async Task TestAsyncTableQuerySkip() [Test] public async Task TestAsyncTableQueryTake() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -432,7 +472,7 @@ public async Task TestAsyncTableQueryTake() [Test] public async Task TestAsyncTableQueryToFirstAsyncFound() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // create... @@ -450,7 +490,7 @@ public async Task TestAsyncTableQueryToFirstAsyncFound() [Test] public async Task TestAsyncTableQueryToFirstAsyncMissing() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // create... @@ -465,7 +505,7 @@ public async Task TestAsyncTableQueryToFirstAsyncMissing() [Test] public async Task TestAsyncTableQueryToFirstOrDefaultAsyncFound() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // create... @@ -483,7 +523,7 @@ public async Task TestAsyncTableQueryToFirstOrDefaultAsyncFound() [Test] public async Task TestAsyncTableQueryToFirstOrDefaultAsyncMissing() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // create... @@ -501,7 +541,7 @@ public async Task TestAsyncTableQueryToFirstOrDefaultAsyncMissing() [Test] public async Task TestAsyncTableQueryToListAsync() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // create... @@ -520,7 +560,7 @@ public async Task TestAsyncTableQueryToListAsync() [Test] public async Task TestAsyncTableQueryWhereOperation() { - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // create... @@ -539,8 +579,7 @@ public async Task TestAsyncTableQueryWhereOperation() [Test] public async Task TestCreateTableAsync() { - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); // drop the customer table... await conn.ExecuteAsync("drop table if exists Customer"); @@ -549,7 +588,7 @@ public async Task TestCreateTableAsync() await conn.CreateTableAsync(); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // run it - if it's missing we'll get a failure... check.Execute("select * from Customer"); @@ -563,8 +602,7 @@ public async Task TestDeleteAsync() Customer customer = CreateCustomer(); // connect... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // run... @@ -574,7 +612,7 @@ public async Task TestDeleteAsync() await conn.DeleteAsync(customer); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // load it back - should be null... List loaded = check.Table().Where(v => v.Id == customer.Id).ToList(); @@ -585,15 +623,14 @@ public async Task TestDeleteAsync() [Test] public async Task TestDropTableAsync() { - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // drop it... await conn.DropTableAsync(); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // load it back and check - should be missing SQLiteCommand command = @@ -606,8 +643,7 @@ public async Task TestDropTableAsync() public async Task TestExecuteAsync() { // connect... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // do a manual insert... @@ -616,7 +652,7 @@ await conn.ExecuteAsync("insert into customer (firstname, lastname, email) value "foo", "bar", email); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // load it back - should be null... TableQuery result = check.Table().Where(v => v.Email == email); @@ -628,7 +664,7 @@ await conn.ExecuteAsync("insert into customer (firstname, lastname, email) value public async Task TestExecuteScalar() { // connect... - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // check... @@ -640,7 +676,7 @@ public async Task TestExecuteScalar() public async Task TestFindAsyncItemMissing() { // connect and insert... - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // now get one that doesn't exist... @@ -657,8 +693,7 @@ public async Task TestFindAsyncItemPresent() Customer customer = CreateCustomer(); // connect and insert... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.InsertAsync(customer); @@ -688,15 +723,14 @@ public async Task TestInsertAllAsync() } // connect... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // insert them all... await conn.InsertAllAsync(customers); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { for (int index = 0; index < customers.Count; index++) { @@ -714,8 +748,7 @@ public async Task TestInsertAsync() Customer customer = CreateCustomer(); // connect... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // run... @@ -725,7 +758,7 @@ public async Task TestInsertAsync() Assert.AreNotEqual(0, customer.Id); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // load it back... var loaded = check.Get(customer.Id); @@ -749,8 +782,7 @@ public async Task TestInsertOrReplaceAllAsync() } // connect... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // insert them all... @@ -778,7 +810,7 @@ public async Task TestInsertOrReplaceAllAsync() await conn.InsertOrReplaceAllAsync(customers); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { for (int index = 0; index < customers.Count; index++) { @@ -803,15 +835,14 @@ public async Task TestInsertOrReplaceAsync() customer.Email = Guid.NewGuid().ToString(); // connect... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // run... await conn.InsertOrReplaceAsync(customer); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // load it back... var loaded = check.Get(customer.Id); @@ -831,7 +862,7 @@ public async Task TestInsertOrReplaceAsync() // check again... // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // load it back... var loaded = check.Get(customer.Id); @@ -842,11 +873,115 @@ public async Task TestInsertOrReplaceAsync() } } + [Test] + public async Task TestInsertOrIgnoreAllAsync () + { + const string originalFirstName = "foo"; + const string originalLastName = "bar"; + + // create a bunch of customers... + var customers = new List (); + for (int index = 0; index < 100; index++) { + var customer = new Customer2 (); + customer.Id = index; + customer.FirstName = originalFirstName; + customer.LastName = originalLastName; + customer.Email = Guid.NewGuid ().ToString (); + customers.Add (customer); + } + + // connect... + SQLiteAsyncConnection conn = GetAsyncConnection (); + await conn.CreateTableAsync (); + + // insert them all... + await conn.InsertOrIgnoreAllAsync (customers); + + // change the existing ones... + foreach (var customer in customers) { + customer.FirstName = "baz"; + customer.LastName = "biz"; + } + + // ... and add a few more + for (int index = 100; index < 200; index++) { + var customer = new Customer2 (); + customer.Id = index; + customer.FirstName = originalFirstName; + customer.LastName = originalLastName; + customer.Email = Guid.NewGuid ().ToString (); + customers.Add (customer); + } + + // insert them all, ignoring the already existing ones + await conn.InsertOrIgnoreAllAsync (customers); + + // check... + using (var check = GetSyncConnection()) { + for (int index = 0; index < customers.Count; index++) { + // load it back and check... + var loaded = check.Get (customers [index].Id); + Assert.AreEqual (loaded.FirstName, originalFirstName); + Assert.AreEqual (loaded.LastName, originalLastName); + Assert.AreEqual (loaded.Email, customers [index].Email); + } + } + + } + + [Test] + public async Task TestInsertOrIgnoreAsync () + { + const string originalFirstName = "foo"; + const string originalLastName = "bar"; + + // create... + var customer = new Customer2 (); + customer.Id = 42; + customer.FirstName = originalFirstName; + customer.LastName = originalLastName; + customer.Email = Guid.NewGuid ().ToString (); + + // connect... + SQLiteAsyncConnection conn = GetAsyncConnection (); + await conn.CreateTableAsync (); + + // run... + await conn.InsertOrIgnoreAsync (customer); + + // check... + using (var check = GetSyncConnection()) { + // load it back... + var loaded = check.Get (customer.Id); + Assert.AreEqual (loaded.Id, customer.Id); + Assert.AreEqual (loaded.FirstName, originalFirstName); + Assert.AreEqual (loaded.LastName, originalLastName); + Assert.AreEqual (loaded.Email, customer.Email); + } + + // change ... + customer.FirstName = "baz"; + customer.LastName = "biz"; + + // insert or ignore... + await conn.InsertOrIgnoreAsync (customer); + + // check... + using (var check = GetSyncConnection()) { + // load it back... + var loaded = check.Get (customer.Id); + Assert.AreEqual (loaded.Id, customer.Id); + Assert.AreEqual (loaded.FirstName, originalFirstName); + Assert.AreEqual (loaded.LastName, originalLastName); + Assert.AreEqual (loaded.Email, customer.Email); + } + } + [Test] public async Task TestQueryAsync() { // connect... - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // insert some... @@ -874,8 +1009,7 @@ public async Task TestQueryAsync() public async Task TestRunInTransactionAsync() { // connect... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); bool transactionCompleted = false; @@ -898,7 +1032,7 @@ await conn.RunInTransactionAsync(c => // check... Assert.IsTrue(transactionCompleted); - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // load it back and check - should be deleted... List loaded = check.Table().Where(v => v.Id == customer.Id).ToList(); @@ -910,7 +1044,7 @@ await conn.RunInTransactionAsync(c => public async Task TestTableAsync() { // connect... - SQLiteAsyncConnection conn = GetConnection(); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); await conn.ExecuteAsync("delete from customer"); @@ -950,8 +1084,7 @@ public async Task TestUpdateAsync() Customer customer = CreateCustomer(); // connect... - string path = null; - SQLiteAsyncConnection conn = GetConnection(ref path); + SQLiteAsyncConnection conn = GetAsyncConnection(); await conn.CreateTableAsync(); // run... @@ -965,12 +1098,28 @@ public async Task TestUpdateAsync() await conn.UpdateAsync(customer); // check... - using (var check = new SQLiteConnection(_sqlite3Platform, path)) + using (var check = GetSyncConnection()) { // load it back - should be changed... var loaded = check.Get(customer.Id); Assert.AreEqual(newEmail, loaded.Email); } } + + [Test] + public async Task TestGetMappingAsync() + { + // connect... + SQLiteAsyncConnection conn = GetAsyncConnection(); + await conn.CreateTableAsync(); + + // get mapping... + TableMapping mapping = await conn.GetMappingAsync(); + + // check... + Assert.AreEqual("AGoodTableName", mapping.TableName); + Assert.AreEqual("Id", mapping.Columns[0].Name); + Assert.AreEqual("AGoodColumnName", mapping.Columns[1].Name); + } } -} \ No newline at end of file +} diff --git a/tests/BackupTest.cs b/tests/BackupTest.cs index c542f6a13..dc614601a 100644 --- a/tests/BackupTest.cs +++ b/tests/BackupTest.cs @@ -4,24 +4,6 @@ using NUnit.Framework; using SQLite.Net.Attributes; using System.IO; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; - -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; - -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; - -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; - -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; - -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif namespace SQLite.Net.Tests { @@ -83,7 +65,7 @@ public void CreateBackup() Text = "Keep testing, just keep testing" }; - SQLiteConnection srcDb = new BackupTestDb(TestPath.GetTempFileName()); + SQLiteConnection srcDb = new BackupTestDb(TestPath.CreateTemporaryDatabase()); int numIn1 = srcDb.Insert(obj1); Assert.AreEqual(1, numIn1); @@ -107,7 +89,7 @@ public void CreateBackup() Assert.AreEqual(obj2.Text, result2.First().Text); string destDbPath = srcDb.CreateDatabaseBackup(new SQLitePlatformTest()); - Assert.IsTrue(File.Exists(destDbPath)); +// Assert.IsTrue(File.Exists(destDbPath)); SQLiteConnection destDb = new BackupTestDb(destDbPath); result1 = destDb.Query("select * from BackupTestObj").ToList(); diff --git a/tests/BlobSerializationTest.cs b/tests/BlobSerializationTest.cs index f4929ea0e..ce0b39ef7 100644 --- a/tests/BlobSerializationTest.cs +++ b/tests/BlobSerializationTest.cs @@ -3,22 +3,9 @@ using System.Collections.Generic; using System.Linq; using SQLite.Net.Attributes; - -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - using NUnit.Framework; +using Newtonsoft.Json; +using System.Text; namespace SQLite.Net.Tests { @@ -30,7 +17,7 @@ public abstract class BlobSerializationTest public class BlobDatabase : SQLiteConnection { public BlobDatabase(IBlobSerializer serializer) : - base(new SQLitePlatformTest(), TestPath.GetTempFileName(), false, serializer) + base(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase(), false, serializer) { DropTable(); } @@ -241,15 +228,15 @@ public class SupportedTypes public Guid Guid{ get; set; } public byte[] Bytes{ get; set; } public TimeSpan Timespan { get; set; } - } + public DateTimeOffset DateTimeOffset { get; set; } + } public class UnsupportedTypes { [PrimaryKey] public Guid Id { get; set; } - - public DateTimeOffset DateTimeOffset { get; set; } + public DivideByZeroException DivideByZeroException { get; set; } } protected override IBlobSerializer Serializer @@ -319,7 +306,7 @@ public void CallsOnUnsupportedTypes() db.CreateTable(); } - Assert.That(types, Has.Member(typeof (DateTimeOffset))); + Assert.That(types, Has.Member(typeof (DivideByZeroException))); Assert.AreEqual(1, types.Count, "Too many types requested by serializer"); } @@ -332,30 +319,26 @@ public void SavesUnsupportedTypes() var serializer = new BlobSerializerDelegate( obj => { - if (obj is DateTimeOffset) + if (obj is DivideByZeroException) { - Assert.AreEqual(item.DateTimeOffset, obj); - var offset = (DateTimeOffset)obj; - var bytes = new byte[16]; - Buffer.BlockCopy(BitConverter.GetBytes(offset.Ticks), 0, bytes, 0, 8); - Buffer.BlockCopy(BitConverter.GetBytes(offset.Offset.Ticks), 0, bytes, 8, 8); - return bytes; + var e = (DivideByZeroException)obj; + var json = JsonConvert.SerializeObject(e); // subst your own serializer + return Encoding.UTF8.GetBytes(json); } throw new InvalidOperationException(string.Format("Type {0} should not be requested.", obj.GetType())); }, (d, t) => { - if (t == typeof(DateTimeOffset)) - { - var ticks = BitConverter.ToInt64(d, 0); - var offset = BitConverter.ToInt64(d, 8); - return new DateTimeOffset(ticks, TimeSpan.FromTicks(offset)); - } - - if (t == typeof(TimeSpan)) + if (t == typeof(DivideByZeroException)) { - return TimeSpan.FromTicks(BitConverter.ToInt64(d, 0)); +#if __WINRT__ || WINDOWS_PHONE + var json = Encoding.UTF8.GetString(d, 0, d.Length); +#else + var json = Encoding.UTF8.GetString(d); +#endif + var result = JsonConvert.DeserializeObject(json); + return result; } throw new InvalidOperationException(string.Format("Type {0} should not be requested.", t)); @@ -365,10 +348,11 @@ public void SavesUnsupportedTypes() using (var db = new BlobDatabase(serializer)) { db.CreateTable(); - item = new UnsupportedTypes() + item = new UnsupportedTypes() { Id = Guid.NewGuid(), - DateTimeOffset = DateTime.Now + DateTimeOffset = DateTime.Now, + DivideByZeroException = new DivideByZeroException("a message") }; db.Insert(item); @@ -376,6 +360,7 @@ public void SavesUnsupportedTypes() Assert.AreEqual(item.Id, dbItem.Id); Assert.AreEqual(item.DateTimeOffset, dbItem.DateTimeOffset); + Assert.AreEqual(item.DivideByZeroException.Message, dbItem.DivideByZeroException.Message); } } } diff --git a/tests/BooleanTest.cs b/tests/BooleanTest.cs index 1e28e133b..f7b92dbde 100644 --- a/tests/BooleanTest.cs +++ b/tests/BooleanTest.cs @@ -4,20 +4,6 @@ using SQLite.Net.Attributes; using SQLite.Net.Interop; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [TestFixture] @@ -61,7 +47,7 @@ public int CountWithFlag(Boolean flag) public void TestBoolean() { var sqlite3Platform = new SQLitePlatformTest(); - string tmpFile = TestPath.GetTempFileName(); + string tmpFile = TestPath.CreateTemporaryDatabase(); var db = new DbAcs(sqlite3Platform, tmpFile); db.buildTable(); for (int i = 0; i < 10; i++) diff --git a/tests/ByteArrayTest.cs b/tests/ByteArrayTest.cs index db8d41e02..ebb56bac3 100644 --- a/tests/ByteArrayTest.cs +++ b/tests/ByteArrayTest.cs @@ -2,20 +2,6 @@ using NUnit.Framework; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [TestFixture] @@ -92,7 +78,7 @@ public void ByteArrays() } //Null should be supported }; - var database = new SQLiteConnection(_sqlite3Platform, TestPath.GetTempFileName()); + var database = new SQLiteConnection(_sqlite3Platform, TestPath.CreateTemporaryDatabase()); database.CreateTable(); //Insert all of the ByteArrayClass @@ -127,7 +113,7 @@ public void ByteArrayWhere() new ByteArrayClass() { bytes = null } //Null should be supported }; - var database = new SQLiteConnection(_sqlite3Platform, TestPath.GetTempFileName()); + var database = new SQLiteConnection(_sqlite3Platform, TestPath.CreateTemporaryDatabase()); database.CreateTable(); byte[] criterion = new byte[] { 1, 0, 1 }; @@ -164,7 +150,7 @@ public void ByteArrayWhereNull() new ByteArrayClass() { bytes = null } //Null should be supported }; - var database = new SQLiteConnection(_sqlite3Platform, TestPath.GetTempFileName()); + var database = new SQLiteConnection(_sqlite3Platform, TestPath.CreateTemporaryDatabase()); database.CreateTable(); byte[] criterion = null; @@ -203,7 +189,7 @@ public void LargeByteArray() bytes = bytes }; - var database = new SQLiteConnection(_sqlite3Platform, TestPath.GetTempFileName()); + var database = new SQLiteConnection(_sqlite3Platform, TestPath.CreateTemporaryDatabase()); database.CreateTable(); //Insert the ByteArrayClass diff --git a/tests/CollateTest.cs b/tests/CollateTest.cs index 762be0457..b163bb975 100644 --- a/tests/CollateTest.cs +++ b/tests/CollateTest.cs @@ -3,20 +3,6 @@ using SQLite.Net.Attributes; using SQLite.Net.Interop; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [TestFixture] @@ -65,7 +51,7 @@ public void Collate() CollateNoCase = "Alpha ", }; - var db = new TestDb(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new TestDb(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.Insert(obj); @@ -157,7 +143,7 @@ public void CollateAttributeSubtype() CollateNoCase = "Alpha ", }; - var db = new TestDbSubtype(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new TestDbSubtype(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.Insert(obj); diff --git a/tests/ConnectionTrackingTest.cs b/tests/ConnectionTrackingTest.cs index fab6fc0a9..191790706 100644 --- a/tests/ConnectionTrackingTest.cs +++ b/tests/ConnectionTrackingTest.cs @@ -3,20 +3,6 @@ using SQLite.Net.Attributes; using SQLite.Net.Interop; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [NUnit.Framework.Ignore("This test class/file was not included in the original project and is broken")] @@ -54,7 +40,7 @@ public class OrderLine public class TestDb : SQLiteConnection { public TestDb(ISQLitePlatform sqlitePlatform) - : base(sqlitePlatform, TestPath.GetTempFileName()) + : base(sqlitePlatform, TestPath.CreateTemporaryDatabase()) { CreateTable(); CreateTable(); diff --git a/tests/ContainsTest.cs b/tests/ContainsTest.cs index 398512d26..d2ec18bd4 100644 --- a/tests/ContainsTest.cs +++ b/tests/ContainsTest.cs @@ -4,20 +4,6 @@ using SQLite.Net.Attributes; using SQLite.Net.Interop; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [TestFixture] @@ -55,7 +41,7 @@ public void ContainsConstantData() Name = i.ToString() }; - var db = new TestDb(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new TestDb(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.InsertAll(cq); @@ -80,7 +66,7 @@ public void ContainsQueriedData() Name = i.ToString() }; - var db = new TestDb(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new TestDb(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.InsertAll(cq); diff --git a/tests/DateTimeOffsetTest.cs b/tests/DateTimeOffsetTest.cs index 0250967e9..a47084090 100644 --- a/tests/DateTimeOffsetTest.cs +++ b/tests/DateTimeOffsetTest.cs @@ -3,21 +3,6 @@ using SQLite.Net.Attributes; using NUnit.Framework; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -42,9 +27,8 @@ public void AsTicks () [Test] public void AsyncAsTicks () { - var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); - var sqLiteConnectionString = new SQLiteConnectionString(TestPath.GetTempFileName(), false); - var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString)); + var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), false); + var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString)); TestAsyncDateTimeOffset (db); } diff --git a/tests/DateTimeTest.cs b/tests/DateTimeTest.cs index f517f25e9..5170f8bbc 100644 --- a/tests/DateTimeTest.cs +++ b/tests/DateTimeTest.cs @@ -4,21 +4,6 @@ using SQLite.Net.Async; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -30,7 +15,8 @@ private class TestObj public int Id { get; set; } public string Name { get; set; } - public DateTime ModifiedTime { get; set; } + public DateTime Time1 { get; set; } + public DateTime Time2 { get; set; } } @@ -38,42 +24,39 @@ private async Task TestAsyncDateTime(SQLiteAsyncConnection db, bool storeDateTim { await db.CreateTableAsync(); - TestObj o, o2; - - // - // Ticks - // - o = new TestObj + var org = new TestObj { - ModifiedTime = DateTime.UtcNow, + Time1 = DateTime.UtcNow, + Time2 = DateTime.Now, }; - await db.InsertAsync(o); - o2 = await db.GetAsync(o.Id); - Assert.AreEqual(o.ModifiedTime, o2.ModifiedTime.ToUniversalTime()); + await db.InsertAsync(org); + var fromDb = await db.GetAsync(org.Id); + Assert.AreEqual(fromDb.Time1.ToUniversalTime(), org.Time1.ToUniversalTime()); + Assert.AreEqual(fromDb.Time2.ToUniversalTime(), org.Time2.ToUniversalTime()); - var expectedTimeZone = storeDateTimeAsTicks ? DateTimeKind.Utc : DateTimeKind.Local; - Assert.AreEqual(o2.ModifiedTime.Kind, expectedTimeZone); + Assert.AreEqual(fromDb.Time1.ToLocalTime(), org.Time1.ToLocalTime()); + Assert.AreEqual(fromDb.Time2.ToLocalTime(), org.Time2.ToLocalTime()); } private void TestDateTime(TestDb db) { db.CreateTable(); - TestObj o, o2; - // // Ticks // - o = new TestObj + var org = new TestObj { - ModifiedTime = DateTime.UtcNow, + Time1 = DateTime.UtcNow, + Time2 = DateTime.Now, }; - db.Insert(o); - o2 = db.Get(o.Id); - Assert.AreEqual(o.ModifiedTime, o2.ModifiedTime.ToUniversalTime()); + db.Insert(org); + var fromDb = db.Get(org.Id); + Assert.AreEqual(fromDb.Time1.ToUniversalTime(), org.Time1.ToUniversalTime()); + Assert.AreEqual(fromDb.Time2.ToUniversalTime(), org.Time2.ToUniversalTime()); - var expectedTimeZone = db.StoreDateTimeAsTicks ? DateTimeKind.Utc : DateTimeKind.Local; - Assert.AreEqual(o2.ModifiedTime.Kind, expectedTimeZone); + Assert.AreEqual(fromDb.Time1.ToLocalTime(), org.Time1.ToLocalTime()); + Assert.AreEqual(fromDb.Time2.ToLocalTime(), org.Time2.ToLocalTime()); } [Test] @@ -93,18 +76,16 @@ public void AsTicks() [Test] public async Task AsyncAsString() { - var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); - var sqLiteConnectionString = new SQLiteConnectionString(TestPath.GetTempFileName(), false); - var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString)); + var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), false); + var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString)); await TestAsyncDateTime(db, sqLiteConnectionString.StoreDateTimeAsTicks); } [Test] public async Task AsyncAsTicks() { - var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); - var sqLiteConnectionString = new SQLiteConnectionString(TestPath.GetTempFileName(), true); - var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString)); + var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), true); + var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString)); await TestAsyncDateTime(db, sqLiteConnectionString.StoreDateTimeAsTicks); } } diff --git a/tests/DefaulAttributeTest.cs b/tests/DefaulAttributeTest.cs index 2c472f22b..9d308cf3c 100644 --- a/tests/DefaulAttributeTest.cs +++ b/tests/DefaulAttributeTest.cs @@ -6,20 +6,6 @@ using SQLite.Net.Attributes; using SQLite.Net.Interop; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [TestFixture] @@ -27,7 +13,7 @@ public class DefaulAttributeTest { private class WithDefaultValue { - + public const string CustomAttributeDefaultValue = "12345"; public const int IntVal = 666; public static decimal DecimalVal = 666.666m; public static string StringVal = "Working String"; @@ -74,6 +60,90 @@ public Default666Attribute() :base(usePropertyValue:false, value:IntVal) } + private class TestDefaultValueAttribute : Attribute + { + public string DefaultValue { get; private set; } + + public TestDefaultValueAttribute(string defaultValue) + { + DefaultValue = defaultValue; + } + } + + public class TestColumnInformationProvider : IColumnInformationProvider + { + public string GetColumnName(PropertyInfo p) + { + return p.Name; + } + + public bool IsIgnored(PropertyInfo p) + { + return false; + } + + public IEnumerable GetIndices(MemberInfo p) + { + return p.GetCustomAttributes(); + } + + public bool IsPK(MemberInfo m) + { + return m.GetCustomAttributes().Any(); + } + public string Collation(MemberInfo m) + { + return string.Empty; + } + public bool IsAutoInc(MemberInfo m) + { + return false; + } + public int? MaxStringLength(PropertyInfo p) + { + return null; + } + public object GetDefaultValue(PropertyInfo p) + { + var defaultValueAttributes = p.GetCustomAttributes (); + if (!defaultValueAttributes.Any()) + { + return null; + } + + return defaultValueAttributes.First().DefaultValue; + } + public bool IsMarkedNotNull(MemberInfo p) + { + return false; + } + } + + public abstract class TestObjBase + { + [AutoIncrement, PrimaryKey] + public int Id { get; set; } + + public T Data { get; set; } + + } + + public class TestObjIntWithDefaultValue : TestObjBase + { + [TestDefaultValue("12345")] + public string SomeValue { get; set; } + } + + public class TestDbWithCustomAttributes : SQLiteConnection + { + public TestDbWithCustomAttributes(String path) + : base(new SQLitePlatformTest(), path) + { + ColumnInformationProvider = new TestColumnInformationProvider(); + CreateTable(); + } + } + [Test] public void TestColumnValues() { @@ -110,5 +180,22 @@ public void TestColumnValues() } } + + [Test] + public void TestCustomDefaultColumnValues() + { + using (var db = new TestDbWithCustomAttributes(TestPath.CreateTemporaryDatabase())) + { + string failed = string.Empty; + foreach (var col in db.GetMapping().Columns) + { + if (col.PropertyName == "SomeValue" && !col.DefaultValue.Equals(WithDefaultValue.CustomAttributeDefaultValue)) + failed += " , SomeValue does not equal " + WithDefaultValue.CustomAttributeDefaultValue; + } + + Assert.True(string.IsNullOrWhiteSpace(failed), failed); + db.ColumnInformationProvider = null; + } + } } } \ No newline at end of file diff --git a/tests/DropTableTest.cs b/tests/DropTableTest.cs index d8fa8b00b..566baf9a0 100644 --- a/tests/DropTableTest.cs +++ b/tests/DropTableTest.cs @@ -1,20 +1,6 @@ using NUnit.Framework; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [TestFixture] @@ -31,7 +17,7 @@ public class Product public class TestDb : SQLiteConnection { - public TestDb() : base(new SQLitePlatformTest(), TestPath.GetTempFileName()) + public TestDb() : base(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()) { TraceListener = DebugTraceListener.Instance; } diff --git a/tests/EqualsTest.cs b/tests/EqualsTest.cs index 9aaaec738..e46e291f0 100644 --- a/tests/EqualsTest.cs +++ b/tests/EqualsTest.cs @@ -4,21 +4,6 @@ using NUnit.Framework; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -58,7 +43,7 @@ public void CanCompareAnyField() Date = new DateTime(2013, 1, i) }; - var db = new TestDb(TestPath.GetTempFileName()); + var db = new TestDb(TestPath.CreateTemporaryDatabase()); db.InsertAll(cq); TableQuery results = db.Table().Where(o => o.Data.Equals("10")); diff --git a/tests/GuidTests.cs b/tests/GuidTests.cs index d1bb251af..56aee51d9 100644 --- a/tests/GuidTests.cs +++ b/tests/GuidTests.cs @@ -5,21 +5,6 @@ using SQLite.Net.Attributes; using SQLite.Net.Interop; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -50,7 +35,7 @@ public TestDb(String path) [Test] public void AutoGuid_EmptyGuid() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(CreateFlags.AutoIncPK); var guid1 = new Guid("36473164-C9E4-4CDF-B266-A0B287C85623"); @@ -80,7 +65,7 @@ public void AutoGuid_EmptyGuid() [Test] public void AutoGuid_HasGuid() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(CreateFlags.AutoIncPK); var guid1 = new Guid("36473164-C9E4-4CDF-B266-A0B287C85623"); @@ -108,7 +93,7 @@ public void AutoGuid_HasGuid() [Test] public void ShouldPersistAndReadGuid() { - var db = new TestDb(TestPath.GetTempFileName()); + var db = new TestDb(TestPath.CreateTemporaryDatabase()); var obj1 = new TestObj { diff --git a/tests/IgnoreTest.cs b/tests/IgnoreTest.cs index 6ce65b83a..8f1a26c3e 100644 --- a/tests/IgnoreTest.cs +++ b/tests/IgnoreTest.cs @@ -2,21 +2,8 @@ using System.Linq; using NUnit.Framework; using SQLite.Net.Attributes; - -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - +using System; +using System.Reflection; namespace SQLite.Net.Tests { @@ -35,12 +22,84 @@ public class DummyClass public List Ignored { get; set; } } + private class TestIgnoreAttribute : Attribute + { + } + + public class TestColumnInformationProvider : IColumnInformationProvider + { + public string GetColumnName(PropertyInfo p) + { + return p.Name; + } + + public bool IsIgnored(PropertyInfo p) + { + return p.IsDefined(typeof (TestIgnoreAttribute), true); + } + + public IEnumerable GetIndices(MemberInfo p) + { + return p.GetCustomAttributes(); + } + + public bool IsPK(MemberInfo m) + { + return m.GetCustomAttributes().Any(); + } + public string Collation(MemberInfo m) + { + return string.Empty; + } + public bool IsAutoInc(MemberInfo m) + { + return false; + } + public int? MaxStringLength(PropertyInfo p) + { + return null; + } + public object GetDefaultValue(PropertyInfo p) + { + return null; + } + public bool IsMarkedNotNull(MemberInfo p) + { + return false; + } + } + + public abstract class TestObjBase + { + [AutoIncrement, PrimaryKey] + public int Id { get; set; } + + public T Data { get; set; } + + } + + public class TestObjIntWithIgnore : TestObjBase + { + [TestIgnore] + public List Ignored { get; set; } + } + [Test] public void NullableFloat() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); // if the Ignored property is not ignore this will cause an exception db.CreateTable(); } + + [Test] + public void CustomIgnoreAttributeTest() + { + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); + db.ColumnInformationProvider = new TestColumnInformationProvider(); + // if the Ignored property is not ignore this will cause an exception + db.CreateTable(); + db.ColumnInformationProvider = null; + } } } \ No newline at end of file diff --git a/tests/InsertTest.cs b/tests/InsertTest.cs index 2c5dd762c..127c6ec7f 100644 --- a/tests/InsertTest.cs +++ b/tests/InsertTest.cs @@ -5,21 +5,6 @@ using NUnit.Framework; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -28,7 +13,7 @@ public class InsertTest [SetUp] public void Setup() { - _db = new TestDb(TestPath.GetTempFileName()); + _db = new TestDb(TestPath.CreateTemporaryDatabase()); } [TearDown] @@ -240,6 +225,31 @@ public void InsertOrReplace() Assert.AreEqual("Foo", r[4].Text); } + [Test] + public void InsertOrIgnore() + { + _db.TraceListener = DebugTraceListener.Instance; + _db.InsertOrIgnoreAll(from i in Enumerable.Range(1, 20) + select new TestObj2 + { + Id = i, + Text = "#" + i + }); + + Assert.AreEqual(20, _db.Table().Count()); + + var t = new TestObj2 + { + Id = 5, + Text = "Foo", + }; + _db.InsertOrIgnore(t); + + List r = (from x in _db.Table() orderby x.Id select x).ToList(); + Assert.AreEqual(20, r.Count); + Assert.AreEqual("#5", r[4].Text); + } + [Test] public void InsertTwoTimes() { diff --git a/tests/NotNullAttributeTest.cs b/tests/NotNullAttributeTest.cs index 61c67452b..57d4785e8 100644 --- a/tests/NotNullAttributeTest.cs +++ b/tests/NotNullAttributeTest.cs @@ -6,20 +6,6 @@ using SQLite.Net.Attributes; using SQLite.Net.Interop; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [TestFixture] diff --git a/tests/NullableTest.cs b/tests/NullableTest.cs index f126ca9b2..4c0751013 100644 --- a/tests/NullableTest.cs +++ b/tests/NullableTest.cs @@ -2,21 +2,6 @@ using NUnit.Framework; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -85,7 +70,7 @@ public override int GetHashCode() [Test] public void NullableScalarInt() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(); var withNull = new NullableIntClass @@ -136,7 +121,7 @@ public void NullableSumTest() [Description("Create a table with a nullable int column then insert and select against it")] public void NullableFloat() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(); var withNull = new NullableFloatClass @@ -175,7 +160,7 @@ public void NullableFloat() [Description("Create a table with a nullable int column then insert and select against it")] public void NullableInt() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(); var withNull = new NullableIntClass @@ -213,7 +198,7 @@ public void NullableInt() [Test] public void NullableString() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(); var withNull = new StringClass @@ -245,7 +230,7 @@ public void NullableString() [Test] public void StringWhereNotNull() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(); var withNull = new StringClass @@ -275,7 +260,7 @@ public void StringWhereNotNull() [Test] public void StringWhereNull() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(); var withNull = new StringClass @@ -304,7 +289,7 @@ public void StringWhereNull() [Test] public void WhereNotNull() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(); var withNull = new NullableIntClass @@ -342,7 +327,7 @@ public void WhereNotNull() [Test] public void WhereNull() { - var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.GetTempFileName()); + var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); db.CreateTable(); var withNull = new NullableIntClass diff --git a/tests/OpenTests.cs b/tests/OpenTests.cs index f1ddbd124..6ce5cbff3 100644 --- a/tests/OpenTests.cs +++ b/tests/OpenTests.cs @@ -3,21 +3,6 @@ using NUnit.Framework; using SQLite.Net.Async; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -28,26 +13,27 @@ public class OpenTest [Test] public void UnicodePaths() { - string path = Path.GetTempFileName() + UnicodeText; + var fileName = TestPath.CreateDefaultTempFilename() + UnicodeText + ".db"; + var filePath = TestPath.CreateTemporaryDatabase(fileName); - using (var db = new SQLiteConnection(new SQLitePlatformTest(), path, true)) + using (var db = new SQLiteConnection(new SQLitePlatformTest(), filePath, true)) { db.CreateTable(); } - Assert.That(new FileInfo(path).Length, Is.GreaterThan(0), path); + Assert.That(filePath.Length, Is.GreaterThan(0), fileName); } [Test] public async Task UnicodePathsAsync() { - string path = Path.GetTempFileName() + UnicodeText; + var fileName = TestPath.CreateDefaultTempFilename() + UnicodeText + ".db"; + var filePath = TestPath.CreateTemporaryDatabase(fileName); - var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); - var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(new SQLiteConnectionString(path, true))); + var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), new SQLiteConnectionString(filePath, true))); await db.CreateTableAsync(); - Assert.That(new FileInfo(path).Length, Is.GreaterThan(0), path); + Assert.That(filePath.Length, Is.GreaterThan(0), fileName); } } } \ No newline at end of file diff --git a/tests/ReplaceTest.cs b/tests/ReplaceTest.cs new file mode 100644 index 000000000..5674d5bec --- /dev/null +++ b/tests/ReplaceTest.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using SQLite.Net.Attributes; +using SQLite.Net.Interop; + +namespace SQLite.Net.Tests +{ + [TestFixture] + public class ReplaceTest + { + public class TestObj + { + [AutoIncrement, PrimaryKey] + public int Id { get; set; } + + public string Name { get; set; } + + public override string ToString() + { + return string.Format("[TestObj: Id={0}, Name={1}]", Id, Name); + } + } + + public class TestDb : SQLiteConnection + { + public TestDb(ISQLitePlatform sqlitePlatform, string path) + : base(sqlitePlatform, path) + { + CreateTable(); + } + } + + + [Test] + + public void ReplaceInWhere() + { + string testElement = "Element"; + string alternateElement = "Alternate"; + string replacedElement = "ReplacedElement"; + + int n = 20; + IEnumerable cq = from i in Enumerable.Range(1, n) + select new TestObj + { + Name = (i % 2 == 0) ? testElement : alternateElement + }; + + var db = new TestDb(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase()); + + db.InsertAll(cq); + + db.TraceListener = DebugTraceListener.Instance; + + + List result = (from o in db.Table() where o.Name.Replace(testElement, replacedElement) == replacedElement select o).ToList(); + Assert.AreEqual(10, result.Count); + + } + + } +} \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.Generic/SQLite.Net.Tests.Generic.csproj b/tests/SQLite.Net.Tests.Generic/SQLite.Net.Tests.Generic.csproj index 201e25a6b..bdfba89a6 100644 --- a/tests/SQLite.Net.Tests.Generic/SQLite.Net.Tests.Generic.csproj +++ b/tests/SQLite.Net.Tests.Generic/SQLite.Net.Tests.Generic.csproj @@ -1,4 +1,4 @@ - + Debug @@ -8,6 +8,8 @@ SQLite.Net.Tests.Generic SQLite.Net.Tests.Generic v4.5 + + true @@ -30,9 +32,31 @@ + - - ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + + + ..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + + ..\..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.dll + + + ..\..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.Abstractions.dll + + + ..\..\packages\System.Data.SQLite.Core.1.0.98.1\lib\net45\System.Data.SQLite.dll @@ -41,11 +65,6 @@ - - - packages.config - - {3AB34E91-8E1A-442F-8E66-2494B371A890} @@ -60,4 +79,16 @@ SQLite.Net.Platform.Generic - + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.Generic/packages.config b/tests/SQLite.Net.Tests.Generic/packages.config new file mode 100644 index 000000000..bc5d5c89f --- /dev/null +++ b/tests/SQLite.Net.Tests.Generic/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.OSX/Properties/AssemblyInfo.cs b/tests/SQLite.Net.Tests.OSX/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..8519e0de2 --- /dev/null +++ b/tests/SQLite.Net.Tests.OSX/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("SQLite.Net.Tests.OSX")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SQLite.Net.Tests.OSX")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. 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("9ca46ef7-2a74-4ca7-8591-b5d4855b982b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/tests/SQLite.Net.Tests.OSX/SQLite.Net.Tests.OSX.csproj b/tests/SQLite.Net.Tests.OSX/SQLite.Net.Tests.OSX.csproj new file mode 100644 index 000000000..af966781c --- /dev/null +++ b/tests/SQLite.Net.Tests.OSX/SQLite.Net.Tests.OSX.csproj @@ -0,0 +1,104 @@ + + + + + Debug + AnyCPU + {8EA10208-DC51-48A1-A0FE-726FEE55DE79} + Library + Properties + SQLite.Net.Tests.OSX + SQLite.Net.Tests.OSX + v4.5 + 512 + ..\..\ + true + + + true + full + false + bin\Debug\ + TRACE;DEBUG;__OSX__ + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE;__OSX__ + prompt + 4 + + + + ..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + True + + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.Abstractions.dll + True + + + + + + + + + + + + + + + + {3AB34E91-8E1A-442F-8E66-2494B371A890} + SQLite.Net.Async + + + {03799AD1-9FCF-48CB-8E6E-B233DF583B11} + SQLite.Net.Platform.OSX + + + {4971D437-0694-4297-A8CC-146CE08C3BD9} + SQLite.Net + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.OSX/packages.config b/tests/SQLite.Net.Tests.OSX/packages.config new file mode 100644 index 000000000..1c7e52845 --- /dev/null +++ b/tests/SQLite.Net.Tests.OSX/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.Win32/SQLite.Net.Tests.Win32.csproj b/tests/SQLite.Net.Tests.Win32/SQLite.Net.Tests.Win32.csproj index 1c123b10e..e7cfc5934 100644 --- a/tests/SQLite.Net.Tests.Win32/SQLite.Net.Tests.Win32.csproj +++ b/tests/SQLite.Net.Tests.Win32/SQLite.Net.Tests.Win32.csproj @@ -15,6 +15,8 @@ true 12.0.0 2.0 + + true @@ -34,11 +36,41 @@ 4 - - ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + + + ..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + True + + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\net45\PCLStorage.Abstractions.dll + True + + ..\..\packages\System.Data.SQLite.Core.1.0.98.1\lib\net45\System.Data.SQLite.dll + True + + @@ -47,7 +79,7 @@ - + @@ -73,7 +105,11 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + - + + Microsoft Visual C++ 2013 Runtime Package for Windows + + + Microsoft Visual Studio Test Core + - + @@ -141,8 +148,29 @@ - - ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\win8\Microsoft.Threading.Tasks.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\win8\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\packages\Newtonsoft.Json.7.0.1\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll + True + + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\portable-win8+wpa81\PCLStorage.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\portable-win8+wpa81\PCLStorage.Abstractions.dll + True @@ -169,7 +197,11 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + - + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.WinRT/packages.config b/tests/SQLite.Net.Tests.WinRT/packages.config index 900373163..c16ff086f 100644 --- a/tests/SQLite.Net.Tests.WinRT/packages.config +++ b/tests/SQLite.Net.Tests.WinRT/packages.config @@ -1,4 +1,10 @@  - + + + + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.WindowsPhone8/SQLite.Net.Tests.WindowsPhone8.csproj b/tests/SQLite.Net.Tests.WindowsPhone8/SQLite.Net.Tests.WindowsPhone8.csproj index 0f6e8483c..af129e4a9 100644 --- a/tests/SQLite.Net.Tests.WindowsPhone8/SQLite.Net.Tests.WindowsPhone8.csproj +++ b/tests/SQLite.Net.Tests.WindowsPhone8/SQLite.Net.Tests.WindowsPhone8.csproj @@ -28,6 +28,8 @@ true ..\..\ true + + true @@ -143,8 +145,33 @@ - - ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\wp8\Microsoft.Threading.Tasks.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\wp8\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\wp8\Microsoft.Threading.Tasks.Extensions.Phone.dll + True + + + ..\..\packages\Newtonsoft.Json.7.0.1\lib\portable-net45+wp80+win8+wpa81+dnxcore50\Newtonsoft.Json.dll + True + + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\wp8\PCLStorage.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\wp8\PCLStorage.Abstractions.dll + True @@ -164,5 +191,7 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.WindowsPhone8/packages.config b/tests/SQLite.Net.Tests.WindowsPhone8/packages.config index 4f4299df7..b275956cf 100644 --- a/tests/SQLite.Net.Tests.WindowsPhone8/packages.config +++ b/tests/SQLite.Net.Tests.WindowsPhone8/packages.config @@ -1,4 +1,9 @@  - + + + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.XamarinAndroid/Resources/Resource.designer.cs b/tests/SQLite.Net.Tests.XamarinAndroid/Resources/Resource.designer.cs index 4f3d67778..bc99d2a2e 100644 --- a/tests/SQLite.Net.Tests.XamarinAndroid/Resources/Resource.designer.cs +++ b/tests/SQLite.Net.Tests.XamarinAndroid/Resources/Resource.designer.cs @@ -2,7 +2,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.0 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -26,8 +26,8 @@ static Resource() public static void UpdateIdValues() { - global::SQLite.Net.Platform.XamarinAndroid.Resource.String.ApplicationName = global::SQLite.Net.Tests.XamarinAndroid.Resource.String.ApplicationName; - global::SQLite.Net.Platform.XamarinAndroid.Resource.String.Hello = global::SQLite.Net.Tests.XamarinAndroid.Resource.String.Hello; + global::PCLStorage.Resource.String.ApplicationName = global::SQLite.Net.Tests.XamarinAndroid.Resource.String.ApplicationName; + global::PCLStorage.Resource.String.Hello = global::SQLite.Net.Tests.XamarinAndroid.Resource.String.Hello; global::Xamarin.Android.NUnitLite.Resource.Id.OptionHostName = global::SQLite.Net.Tests.XamarinAndroid.Resource.Id.OptionHostName; global::Xamarin.Android.NUnitLite.Resource.Id.OptionPort = global::SQLite.Net.Tests.XamarinAndroid.Resource.Id.OptionPort; global::Xamarin.Android.NUnitLite.Resource.Id.OptionRemoteServer = global::SQLite.Net.Tests.XamarinAndroid.Resource.Id.OptionRemoteServer; diff --git a/tests/SQLite.Net.Tests.XamarinAndroid/SQLite.Net.Tests.XamarinAndroid.csproj b/tests/SQLite.Net.Tests.XamarinAndroid/SQLite.Net.Tests.XamarinAndroid.csproj index a5b662563..d74b87cef 100644 --- a/tests/SQLite.Net.Tests.XamarinAndroid/SQLite.Net.Tests.XamarinAndroid.csproj +++ b/tests/SQLite.Net.Tests.XamarinAndroid/SQLite.Net.Tests.XamarinAndroid.csproj @@ -16,8 +16,9 @@ Resources\Resource.designer.cs Resource SQLite.Net.Tests.XamarinAndroid - v4.0.3 + v6.0 Properties\AndroidManifest.xml + d3a84424 true @@ -41,6 +42,26 @@ false + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wpa81\Microsoft.Threading.Tasks.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wpa81\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\packages\Newtonsoft.Json.7.0.1\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\monoandroid\PCLStorage.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\monoandroid\PCLStorage.Abstractions.dll + True + @@ -48,7 +69,7 @@ - + @@ -58,6 +79,7 @@ Tests\packages.config + @@ -82,4 +104,11 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.XamarinAndroid/packages.config b/tests/SQLite.Net.Tests.XamarinAndroid/packages.config new file mode 100644 index 000000000..265be6ab0 --- /dev/null +++ b/tests/SQLite.Net.Tests.XamarinAndroid/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.XamarinIOS.Unified/SQLite.Net.Tests.XamarinIOS.Unified.csproj b/tests/SQLite.Net.Tests.XamarinIOS.Unified/SQLite.Net.Tests.XamarinIOS.Unified.csproj index f3c019ec0..d16524820 100644 --- a/tests/SQLite.Net.Tests.XamarinIOS.Unified/SQLite.Net.Tests.XamarinIOS.Unified.csproj +++ b/tests/SQLite.Net.Tests.XamarinIOS.Unified/SQLite.Net.Tests.XamarinIOS.Unified.csproj @@ -9,6 +9,7 @@ SQLite.Net.Tests.XamarinIOS.Unified Resources SQLiteNetTestsXamarinIOSUnified + ffe01717 true @@ -89,6 +90,18 @@ iPhone Distribution + + ..\..\packages\Newtonsoft.Json.7.0.1\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\portable-Xamarin.iOS+Xamarin.Mac\PCLStorage.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\portable-Xamarin.iOS+Xamarin.Mac\PCLStorage.Abstractions.dll + True + @@ -105,14 +118,12 @@ - - packages.config - + - + @@ -129,4 +140,11 @@ SQLite.Net.Platform.XamarinIOS.Unified - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.XamarinIOS.Unified/packages.config b/tests/SQLite.Net.Tests.XamarinIOS.Unified/packages.config new file mode 100644 index 000000000..718fbf81d --- /dev/null +++ b/tests/SQLite.Net.Tests.XamarinIOS.Unified/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.XamarinIOS/SQLite.Net.Tests.XamarinIOS.csproj b/tests/SQLite.Net.Tests.XamarinIOS/SQLite.Net.Tests.XamarinIOS.csproj index abec5c786..fdea96c5d 100644 --- a/tests/SQLite.Net.Tests.XamarinIOS/SQLite.Net.Tests.XamarinIOS.csproj +++ b/tests/SQLite.Net.Tests.XamarinIOS/SQLite.Net.Tests.XamarinIOS.csproj @@ -9,6 +9,7 @@ SQLite.Net.Tests.XamarinIOS Resources SQLiteNetTestsXamarinIOS + fc53d04b true @@ -77,6 +78,7 @@ + @@ -84,9 +86,29 @@ + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wpa81\Microsoft.Threading.Tasks.dll + True + + + ..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\portable-net45+win8+wpa81\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\..\packages\Newtonsoft.Json.7.0.1\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\monotouch\PCLStorage.dll + True + + + ..\..\packages\PCLStorage.1.0.2\lib\monotouch\PCLStorage.Abstractions.dll + True + @@ -107,4 +129,11 @@ - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/tests/SQLite.Net.Tests.XamarinIOS/packages.config b/tests/SQLite.Net.Tests.XamarinIOS/packages.config new file mode 100644 index 000000000..459e00ed1 --- /dev/null +++ b/tests/SQLite.Net.Tests.XamarinIOS/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/tests/SQLitePlatformTest.cs b/tests/SQLitePlatformTest.cs new file mode 100644 index 000000000..f3a62cd9e --- /dev/null +++ b/tests/SQLitePlatformTest.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +#if __WIN32__ +using _SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; +#elif WINDOWS_PHONE +using _SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; +#elif __WINRT__ +using _SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; +#elif __IOS__ +using _SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; +#elif __ANDROID__ +using _SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; +#elif __OSX__ +using _SQLitePlatformTest = SQLite.Net.Platform.OSX.SQLitePlatformOSX; +#else +using _SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; +#endif + +// ReSharper disable once CheckNamespace +namespace SQLite.Net.Tests +{ + public class SQLitePlatformTest : _SQLitePlatformTest + { + } +} diff --git a/tests/SelectTests.cs b/tests/SelectTests.cs index 6fe5eeabb..073048d5c 100644 --- a/tests/SelectTests.cs +++ b/tests/SelectTests.cs @@ -8,20 +8,6 @@ using SQLite.Net.Async; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { @@ -57,7 +43,7 @@ public TestDb(String path) [Test] public void SelectWorks() { - using (var db = new TestDb(TestPath.GetTempFileName())) + using (var db = new TestDb(TestPath.CreateTemporaryDatabase())) { db.Insert(new TestObj() {Order = 5}); try diff --git a/tests/SerializableTest.cs b/tests/SerializableTest.cs index 359e34c68..f2eaf5fe2 100644 --- a/tests/SerializableTest.cs +++ b/tests/SerializableTest.cs @@ -119,13 +119,20 @@ public void SupportsSerializableTimeSpan() [Test] public void SupportsSerializableDateTime() { - DateTime value = DateTime.UtcNow; - var model = new ComplexType { DateTimeValue = new SerializableDateTime(value) }; + DateTime value1 = DateTime.UtcNow; + DateTime value2 = DateTime.Now; + var model = new ComplexType + { + DateTimeValue = new SerializableDateTime(value1), + DateTimeValue2 = new SerializableDateTime(value2) + }; _db.Insert(model); - var found = _db.Get(m => m.ID == model.ID); - var endOfPreviousSecond = value.AddMilliseconds(-value.Millisecond - 1); - var startOfNextSecond = value.AddMilliseconds(1000 - value.Millisecond + 1); - Assert.That(found.DateTimeValue.InnerValue.ToUniversalTime(), Is.InRange(endOfPreviousSecond, startOfNextSecond)); + ComplexType found = _db.Get(m => m.ID == model.ID); + Assert.That(found.DateTimeValue.InnerValue.ToUniversalTime(), Is.EqualTo(value1.ToUniversalTime())); + Assert.That(found.DateTimeValue2.InnerValue.ToUniversalTime(), Is.EqualTo(value2.ToUniversalTime())); + + Assert.That(found.DateTimeValue.InnerValue.ToLocalTime(), Is.EqualTo(value1.ToLocalTime())); + Assert.That(found.DateTimeValue2.InnerValue.ToLocalTime(), Is.EqualTo(value2.ToLocalTime())); } [Test] @@ -164,6 +171,7 @@ private class ComplexType public SerializableDecimal DecimalValue { get; set; } public SerializableTimeSpan TimeSpanValue { get; set; } public SerializableDateTime DateTimeValue { get; set; } + public SerializableDateTime DateTimeValue2 { get; set; } public SerializableByteArray ByteArrayValue { get; set; } public SerializableGuid GuidValue { get; set; } } diff --git a/tests/SkipTest.cs b/tests/SkipTest.cs index 8b0153276..aabab6a98 100644 --- a/tests/SkipTest.cs +++ b/tests/SkipTest.cs @@ -4,21 +4,6 @@ using NUnit.Framework; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - - namespace SQLite.Net.Tests { [TestFixture] @@ -57,7 +42,7 @@ public void Skip() Order = i }; TestObj[] objs = cq.ToArray(); - var db = new TestDb(TestPath.GetTempFileName()); + var db = new TestDb(TestPath.CreateTemporaryDatabase()); int numIn = db.InsertAll(objs); Assert.AreEqual(numIn, n, "Num inserted must = num objects"); @@ -89,7 +74,7 @@ public void MultipleSkipsWillSkipTheSumOfTheSkips() Order = i }; TestObj[] objs = cq.ToArray(); - var db = new TestDb(TestPath.GetTempFileName()); + var db = new TestDb(TestPath.CreateTemporaryDatabase()); int numIn = db.InsertAll(objs); Assert.AreEqual(numIn, n, "Num inserted must = num objects"); @@ -129,7 +114,7 @@ private static TestDb GetTestDBWith100Elements() Order = i }; TestObj[] objs = cq.ToArray(); - var db = new TestDb(TestPath.GetTempFileName()); + var db = new TestDb(TestPath.CreateTemporaryDatabase()); int numIn = db.InsertAll(objs); Assert.AreEqual(numIn, n, "Num inserted must = num objects"); diff --git a/tests/TestDb.cs b/tests/TestDb.cs index 3d71e0aa7..79f1a8987 100644 --- a/tests/TestDb.cs +++ b/tests/TestDb.cs @@ -1,21 +1,9 @@ using System; using System.IO; +using System.Threading.Tasks; +using PCLStorage; using SQLite.Net.Attributes; -#if __WIN32__ -using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32; -#elif WINDOWS_PHONE -using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8; -#elif __WINRT__ -using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT; -#elif __IOS__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; -#elif __ANDROID__ -using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; -#else -using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; -#endif - namespace SQLite.Net.Tests { [Table("Product")] @@ -120,7 +108,7 @@ public class TestDb : SQLiteConnection { public TestDb(bool storeDateTimeAsTicks = true, IContractResolver resolver = null) : base( - new SQLitePlatformTest(), TestPath.GetTempFileName(), storeDateTimeAsTicks, null, + new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase(), storeDateTimeAsTicks, null, extraTypeMappings: null, resolver: resolver) { @@ -130,9 +118,21 @@ public TestDb(bool storeDateTimeAsTicks = true, IContractResolver resolver = nul public class TestPath { - public static string GetTempFileName() + public static string CreateTemporaryDatabase(string fileName = null) + { + var desiredName = fileName ?? CreateDefaultTempFilename() + ".db"; + var localStorage = FileSystem.Current.LocalStorage; + if (localStorage.CheckExistsAsync("temp").Result != ExistenceCheckResult.FolderExists) + { + localStorage.CreateFolderAsync("temp", CreationCollisionOption.OpenIfExists).Wait(); + } + IFolder tempFolder = localStorage.GetFolderAsync("temp").Result; + return tempFolder.CreateFileAsync(desiredName, CreationCollisionOption.FailIfExists).Result.Path; + } + + public static Guid CreateDefaultTempFilename() { - return Path.GetTempFileName(); + return Guid.NewGuid(); } } } diff --git a/tests/TimeSpanTest.cs b/tests/TimeSpanTest.cs index 7e6a94db9..135e7718b 100644 --- a/tests/TimeSpanTest.cs +++ b/tests/TimeSpanTest.cs @@ -14,6 +14,8 @@ using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; #elif __ANDROID__ using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; +#elif __OSX__ +using SQLitePlatformTest = SQLite.Net.Platform.OSX.SQLitePlatformOSX; #else using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; #endif @@ -49,9 +51,8 @@ private async Task TestAsyncDateTime(SQLiteAsyncConnection db) [Test] public async Task TestTimeSpan() { - var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); - var sqLiteConnectionString = new SQLiteConnectionString(TestPath.GetTempFileName(), true); - var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString)); + var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), true); + var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString)); await TestAsyncDateTime(db); } } diff --git a/tests/TransactionTest.cs b/tests/TransactionTest.cs index dfb1a5dc6..b9ba5b418 100644 --- a/tests/TransactionTest.cs +++ b/tests/TransactionTest.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using PCLStorage; using SQLite.Net.Attributes; #if __WIN32__ @@ -14,6 +15,8 @@ using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS; #elif __ANDROID__ using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid; +#elif __OSX__ +using SQLitePlatformTest = SQLite.Net.Platform.OSX.SQLitePlatformOSX; #else using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric; #endif @@ -28,7 +31,7 @@ public void Setup() { testObjects = Enumerable.Range(1, 20).Select(i => new TestObj()).ToList(); - db = new TestDb(TestPath.GetTempFileName()); + db = new TestDb(TestPath.CreateTemporaryDatabase()); db.InsertAll(testObjects); } diff --git a/tests/UnicodeTest.cs b/tests/UnicodeTest.cs index fc4306c2d..14e260bdd 100644 --- a/tests/UnicodeTest.cs +++ b/tests/UnicodeTest.cs @@ -1,49 +1,66 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using SQLite.Net.Attributes; namespace SQLite.Net.Tests { - [TestFixture] - public class UnicodeTest - { - [Test] - public void Insert() - { - var db = new TestDb(); + [TestFixture] + public class UnicodeTest + { + [Table("\u7523\u54C1")] + public class UnicodeProduct + { + [AutoIncrement, PrimaryKey, Column("\u6A19\u8B58")] + public int Id { get; set; } - db.CreateTable(); + [Column("\u540D")] + public string Name { get; set; } - string testString = "\u2329\u221E\u232A"; + [Column("\u5024")] + public decimal Price { get; set; } - db.Insert(new Product - { - Name = testString, - }); + [Column("\u53CE\u76CA")] + public uint TotalSales { get; set; } + } - var p = db.Get(1); + [Test] + public void Insert() + { + var db = new TestDb(); - Assert.AreEqual(testString, p.Name); - } + db.CreateTable(); - [Test] - public void Query() - { - var db = new TestDb(); + string testString = "\u2329\u221E\u232A"; - db.CreateTable(); + db.Insert(new UnicodeProduct + { + Name = testString, + }); - string testString = "\u2329\u221E\u232A"; + var p = db.Get(1); - db.Insert(new Product - { - Name = testString, - }); + Assert.AreEqual(testString, p.Name); + } - List ps = (from p in db.Table() where p.Name == testString select p).ToList(); + [Test] + public void Query() + { + var db = new TestDb(); - Assert.AreEqual(1, ps.Count); - Assert.AreEqual(testString, ps[0].Name); - } - } + db.CreateTable(); + + string testString = "\u2329\u221E\u232A"; + + db.Insert(new UnicodeProduct + { + Name = testString, + }); + + var ps = (from p in db.Table() where p.Name == testString select p).ToList(); + + Assert.AreEqual(1, ps.Count); + Assert.AreEqual(testString, ps[0].Name); + } + } } \ No newline at end of file diff --git a/tests/packages.config b/tests/packages.config deleted file mode 100644 index ad37a5282..000000000 --- a/tests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file