├── .gitattributes
├── .gitignore
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── NuGet.targets
├── LICENSE.txt
├── README.mdown
├── SQLite.Net.OSS.sln
├── SQLite.Net.sln
├── SQLite.Net.sln.DotSettings
├── appveyor.yml
├── examples
├── Stocks
│ ├── AssemblyInfo.cs
│ ├── Main.cs
│ ├── Stocks.cs
│ ├── Stocks.csproj
│ ├── Stocks.sln
│ └── app.config
└── StocksTouch
│ ├── AddStockView.xib
│ ├── AddStockView.xib.cs
│ ├── AddStockView.xib.designer.cs
│ ├── Info.plist
│ ├── Main.cs
│ ├── MainWindow.xib
│ ├── MainWindow.xib.designer.cs
│ ├── StocksTouch.csproj
│ ├── StocksTouch.sln
│ ├── StocksView.xib
│ ├── StocksView.xib.cs
│ └── StocksView.xib.designer.cs
├── lib
├── metro
│ ├── ARM
│ │ └── sqlite3.dll
│ ├── x64
│ │ └── sqlite3.dll
│ └── x86
│ │ └── sqlite3.dll
└── wp7
│ └── Community.CsharpSqlite.WinPhone.dll
├── license.md
├── logo.gif
├── logo.psd
├── nuget
├── SQLite.Net.Async.nuspec
├── SQLite.Net.Core.nuspec
├── SQLite.Net.nuspec
├── build.bat
├── prepare.bat
└── upload.bat
├── src
├── GlobalAssemblyInfo.cs
├── SQLite.Net.Async
│ ├── AsyncTableQuery.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SQLite.Net.Async.csproj
│ └── SQLiteAsyncConnection.cs
├── SQLite.Net.Platform.Generic
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReflectionServiceGeneric.cs
│ ├── SQLite.Net.Platform.Generic.csproj
│ ├── SQLiteApiGeneric.cs
│ ├── SQLiteApiGenericInternal.cs
│ ├── SQLitePlatformGeneric.cs
│ ├── StopwatchFactoryGeneric.cs
│ └── VolatileServiceGeneric.cs
├── SQLite.Net.Platform.OSX
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReflectionServiceOSX.cs
│ ├── SQLite.Net.Platform.OSX.csproj
│ ├── SQLite.Net.Platform.OSX.dll.config
│ ├── SQLiteApiOSX.cs
│ ├── SQLitePlatformOSX.cs
│ ├── SQliteApiOSXInternal.cs
│ ├── StopwatchFactoryOSX.cs
│ ├── VolatileServiceOSX.cs
│ ├── i386
│ │ └── libsqlite3_for_net.dylib
│ └── x86_64
│ │ └── libsqlite3_for_net.dylib
├── SQLite.Net.Platform.Win32
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReflectionServiceWin32.cs
│ ├── SQLite.Net.Platform.Win32.csproj
│ ├── SQLiteApiWin32.cs
│ ├── SQLiteApiWin32InternalConfiguration.cs
│ ├── SQLitePlatformWin32.cs
│ ├── SQliteApiWin32Internal.cs
│ ├── StopwatchFactoryWin32.cs
│ ├── VolatileServiceWin32.cs
│ ├── packages.config
│ ├── x64
│ │ └── SQLite.Interop.dll
│ └── x86
│ │ └── SQLite.Interop.dll
├── SQLite.Net.Platform.WinRT
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReflectionServiceWinRT.cs
│ ├── SQLite.Net.Platform.WinRT.csproj
│ ├── SQLiteApiWinRT.cs
│ ├── SQLitePlatformWinRT.cs
│ ├── StopwatchFactoryWinRT.cs
│ └── VolatileServiceWinRT.cs
├── SQLite.Net.Platform.WindowsPhone8
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReflectionServiceWP8.cs
│ ├── SQLite.Net.Platform.WindowsPhone8.csproj
│ ├── SQLiteApiWP8.cs
│ ├── SQLitePlatformWP8.cs
│ ├── StopwatchFactoryWP8.cs
│ ├── VolatileServiceWP8.cs
│ └── packages.config
├── SQLite.Net.Platform.WindowsPhoneApp81
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── SQLite.Net.Platform.WindowsPhoneApp81.csproj
├── SQLite.Net.Platform.XamarinAndroid
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReflectionServiceAndroid.cs
│ ├── Resources
│ │ ├── AboutResources.txt
│ │ ├── Resource.Designer.cs
│ │ └── Values
│ │ │ └── Strings.xml
│ ├── SQLite.Net.Platform.XamarinAndroid.csproj
│ ├── SQLiteApiAndroid.cs
│ ├── SQLiteApiAndroidInternal.cs
│ ├── SQLitePlatformAndroid.cs
│ ├── StopwatchFactoryAndroid.cs
│ └── VolatileServiceAndroid.cs
├── SQLite.Net.Platform.XamarinIOS.Unified
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReflectionServiceIOS.cs
│ ├── SQLite.Net.Platform.XamarinIOS.Unified.csproj
│ ├── SQLiteApiIOS.cs
│ ├── SQLiteApiIOSInternal.cs
│ ├── SQLitePlatformIOS.cs
│ ├── StopwatchFactoryIOS.cs
│ └── VolatileServiceIOS.cs
├── SQLite.Net.Platform.XamarinIOS
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ReflectionServiceIOS.cs
│ ├── SQLite.Net.Platform.XamarinIOS.csproj
│ ├── SQLiteApiIOS.cs
│ ├── SQLiteApiIOSInternal.cs
│ ├── SQLitePlatformIOS.cs
│ ├── StopwatchFactoryIOS.cs
│ └── VolatileServiceIOS.cs
└── SQLite.Net
│ ├── ActiveInsertCommand.cs
│ ├── Annotations
│ └── JetBrains.cs
│ ├── Attributes
│ ├── AutoIncrementAttribute.cs
│ ├── CollationAttribute.cs
│ ├── ColumnAttribute.cs
│ ├── DefaultAttribute.cs
│ ├── DefaultColumnInformationProvider.cs
│ ├── IColumnInformationProvider.cs
│ ├── IgnoreAttribute.cs
│ ├── IndexedAttribute.cs
│ ├── MaxLengthAttribute.cs
│ ├── NotNullAttribute.cs
│ ├── PrimaryKeyAttribute.cs
│ ├── TableAttribute.cs
│ └── UniqueAttribute.cs
│ ├── BaseTableQuery.cs
│ ├── BlobSerializerDelegate.cs
│ ├── ContractResolver.cs
│ ├── CreateTablesResult.cs
│ ├── DebugTraceListener.cs
│ ├── IBlobSerializer.cs
│ ├── IContractResolver.cs
│ ├── ISerializable.cs
│ ├── ITraceListener.cs
│ ├── Interop
│ ├── ColType.cs
│ ├── ConfigOption.cs
│ ├── CreateFlags.cs
│ ├── ExtendedResult.cs
│ ├── IDbBackupHandle.cs
│ ├── IDbHandle.cs
│ ├── IDbStatement.cs
│ ├── IReflectionService.cs
│ ├── ISQLiteApi.cs
│ ├── ISQLiteApiExt.cs
│ ├── ISQLitePlatform.cs
│ ├── IStopwatch.cs
│ ├── IStopwatchFactory.cs
│ ├── IVolatileService.cs
│ ├── Result.cs
│ ├── SQLite3.cs
│ └── SQLiteOpenFlags.cs
│ ├── NotNullConstraintViolationException.cs
│ ├── Orm.cs
│ ├── PreparedSqlLiteInsertCommand.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── SQLite.Net.csproj
│ ├── SQLiteCommand.cs
│ ├── SQLiteConnection.cs
│ ├── SQLiteConnectionPool.cs
│ ├── SQLiteConnectionString.cs
│ ├── SQLiteConnectionWithLock.cs
│ ├── SQLiteException.cs
│ ├── TableMapping.cs
│ ├── TableQuery.cs
│ └── TraceListenerExtensions.cs
└── tests
├── ArithmeticTest.cs
├── AsyncTests.cs
├── BackupTest.cs
├── BlobSerializationTest.cs
├── BooleanTest.cs
├── ByteArrayTest.cs
├── CollateTest.cs
├── ConnectionTrackingTest.cs
├── ContainsTest.cs
├── CreateTableImplicitTest.cs
├── CreateTableTest.cs
├── DateTimeOffsetTest.cs
├── DateTimeTest.cs
├── DefaulAttributeTest.cs
├── DeleteTest.cs
├── DropTableTest.cs
├── EqualsTest.cs
├── ExceptionAssert.cs
├── ExpressionTests.cs
├── GuidTests.cs
├── IgnoreTest.cs
├── InheritanceTest.cs
├── InsertTest.cs
├── IoCUnitTest.cs
├── LinqTest.cs
├── MappingTest.cs
├── MigrationTest.cs
├── NotNullAttributeTest.cs
├── NullableTest.cs
├── OpenTests.cs
├── ReplaceTest.cs
├── SQLite.Net.Tests.Generic
├── Properties
│ └── AssemblyInfo.cs
├── SQLite.Net.Tests.Generic.csproj
└── packages.config
├── SQLite.Net.Tests.OSX
├── Properties
│ └── AssemblyInfo.cs
├── SQLite.Net.Tests.OSX.csproj
└── packages.config
├── SQLite.Net.Tests.Win32
├── Properties
│ └── AssemblyInfo.cs
├── SQLite.Net.Tests.Win32.csproj
└── packages.config
├── SQLite.Net.Tests.WinRT
├── Images
│ ├── UnitTestLogo.scale-100.png
│ ├── UnitTestSmallLogo.scale-100.png
│ ├── UnitTestSplashScreen.scale-100.png
│ └── UnitTestStoreLogo.scale-100.png
├── Package.appxmanifest
├── Properties
│ └── AssemblyInfo.cs
├── SQLite.Net.Tests.WinRT.csproj
├── SQLite.Net.Tests.WinRT_TemporaryKey.pfx
└── packages.config
├── SQLite.Net.Tests.WindowsPhone8
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── AlignmentGrid.png
│ ├── ApplicationIcon.png
│ └── Tiles
│ │ ├── FlipCycleTileLarge.png
│ │ ├── FlipCycleTileMedium.png
│ │ └── FlipCycleTileSmall.png
├── LocalizedStrings.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── Properties
│ ├── AppManifest.xml
│ ├── AssemblyInfo.cs
│ └── WMAppManifest.xml
├── Resources
│ ├── AppResources.Designer.cs
│ └── AppResources.resx
├── SQLite.Net.Tests.WindowsPhone8.csproj
└── packages.config
├── SQLite.Net.Tests.XamarinAndroid
├── Assets
│ └── AboutAssets.txt
├── MainActivity.cs
├── Properties
│ ├── AndroidManifest.xml
│ └── AssemblyInfo.cs
├── Resources
│ ├── AboutResources.txt
│ ├── Resource.designer.cs
│ └── drawable
│ │ └── Icon.png
├── SQLite.Net.Tests.XamarinAndroid.csproj
├── TestsSample.cs
└── packages.config
├── SQLite.Net.Tests.XamarinIOS.Unified
├── AppDelegate.cs
├── Info.plist
├── Main.cs
├── Resources
│ ├── Images.xcassets
│ │ └── AppIcons.appiconset
│ │ │ └── Contents.json
│ └── LaunchScreen.xib
├── SQLite.Net.Tests.XamarinIOS.Unified.csproj
└── packages.config
├── SQLite.Net.Tests.XamarinIOS
├── AppDelegate.cs
├── Info.plist
├── Main.cs
├── Properties
│ └── AssemblyInfo.cs
├── Resources
│ ├── Default-568h@2x.png
│ ├── Default.png
│ └── Default@2x.png
├── SQLite.Net.Tests.XamarinIOS.csproj
└── packages.config
├── SQLitePlatformTest.cs
├── ScalarTest.cs
├── SelectTests.cs
├── SerializableTest.cs
├── SkipTest.cs
├── StringQueryTest.cs
├── TestDb.cs
├── TimeSpanTest.cs
├── TransactionTest.cs
├── UnicodeTest.cs
└── UniqueTest.cs
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.pidb
3 | *.userprefs
4 | *.user
5 | *.suo
6 | _Resharper*
7 | obj
8 | bin
9 | test-results
10 | TestResults
11 | *.nupkg
12 | /packages
13 | /SQLite.Net.sln.ide
14 | /.vs
15 | /nuget/SQLite.Net*
16 |
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | build:
2 | project: SQLite.Net.OSS.sln
3 |
4 | test:
5 | assemblies:
6 | - '**\SQLite.Net.Tests.Win32.dll'
7 |
--------------------------------------------------------------------------------
/examples/Stocks/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 |
7 | [assembly: AssemblyTitle("Stocks")]
8 | [assembly: AssemblyDescription("An example of using sqlite-net")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("")]
12 | [assembly: AssemblyCopyright("")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
19 |
20 | [assembly: AssemblyVersion("1.0.*")]
21 |
22 | // The following attributes are used to specify the signing key for the assembly,
23 | // if desired. See the Mono documentation for more information about signing.
24 |
25 | //[assembly: AssemblyDelaySign(false)]
26 | //[assembly: AssemblyKeyFile("")]
27 |
--------------------------------------------------------------------------------
/examples/Stocks/Stocks.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 10.00
3 | # Visual Studio 2008
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stocks", "Stocks.csproj", "{9E5D6B89-B69B-486B-9F7B-406BE8690589}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {9E5D6B89-B69B-486B-9F7B-406BE8690589}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(MonoDevelopProperties) = preSolution
18 | StartupItem = Stocks.csproj
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/examples/Stocks/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/examples/StocksTouch/AddStockView.xib.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using MonoTouch.Foundation;
6 | using MonoTouch.UIKit;
7 |
8 | namespace Stocks.Touch
9 | {
10 | public partial class AddStockView : UIViewController
11 | {
12 | Database _db;
13 |
14 | public event EventHandler Finished = delegate {};
15 |
16 | public AddStockView (Database db)
17 | : base("AddStockView", null)
18 | {
19 | _db = db;
20 |
21 | Title = "New Symbol";
22 | NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, Cancel);
23 | NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, AddSymbol);
24 | }
25 |
26 | UITextField _symbolName;
27 |
28 | public override void ViewDidLoad ()
29 | {
30 | _symbolName = symbolName;
31 | _symbolName.ShouldReturn = delegate {
32 | AddSymbol (symbolName, EventArgs.Empty);
33 | return true;
34 | };
35 | }
36 |
37 | void Cancel (object sender, EventArgs e)
38 | {
39 | DismissModalViewControllerAnimated(true);
40 | }
41 |
42 | void AddSymbol (object sender, EventArgs e)
43 | {
44 | _db.UpdateStock (symbolName.Text);
45 | DismissModalViewControllerAnimated (true);
46 | Finished (this, EventArgs.Empty);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/examples/StocksTouch/AddStockView.xib.designer.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Mono Runtime Version: 2.0.50727.1433
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | // ------------------------------------------------------------------------------
10 |
11 | namespace Stocks.Touch {
12 |
13 |
14 | // Base type probably should be MonoTouch.UIKit.UIViewController or subclass
15 | [MonoTouch.Foundation.Register("AddStockView")]
16 | public partial class AddStockView {
17 |
18 | #pragma warning disable 0169
19 | [MonoTouch.Foundation.Connect("view")]
20 | private MonoTouch.UIKit.UIView view {
21 | get {
22 | return ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
23 | }
24 | set {
25 | this.SetNativeField("view", value);
26 | }
27 | }
28 |
29 | [MonoTouch.Foundation.Connect("symbolName")]
30 | private MonoTouch.UIKit.UITextField symbolName {
31 | get {
32 | return ((MonoTouch.UIKit.UITextField)(this.GetNativeField("symbolName")));
33 | }
34 | set {
35 | this.SetNativeField("symbolName", value);
36 | }
37 | }
38 |
39 | [MonoTouch.Foundation.Connect("addBtn")]
40 | private MonoTouch.UIKit.UIButton addBtn {
41 | get {
42 | return ((MonoTouch.UIKit.UIButton)(this.GetNativeField("addBtn")));
43 | }
44 | set {
45 | this.SetNativeField("addBtn", value);
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/examples/StocksTouch/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSMainNibFile
6 | MainWindow
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/StocksTouch/Main.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using MonoTouch.Foundation;
6 | using MonoTouch.UIKit;
7 | using Path = System.IO.Path;
8 | using SQLite;
9 |
10 | namespace Stocks.Touch
11 | {
12 | public class Application
13 | {
14 | static void Main (string[] args)
15 | {
16 | UIApplication.Main (args);
17 | }
18 | }
19 |
20 | public partial class AppDelegate : UIApplicationDelegate
21 | {
22 | Database _db;
23 | UINavigationController _navigationController;
24 |
25 | public override bool FinishedLaunching (UIApplication app, NSDictionary options)
26 | {
27 | _db = new Database (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "stocks.db"));
28 | _db.Trace = true;
29 |
30 | var stocksView = new StocksView (_db);
31 |
32 | _navigationController = new UINavigationController (stocksView);
33 |
34 | window.AddSubview (_navigationController.View);
35 |
36 | window.MakeKeyAndVisible ();
37 |
38 | return true;
39 | }
40 |
41 | // This method is required in iPhoneOS 3.0
42 | public override void OnActivated (UIApplication application)
43 | {
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/examples/StocksTouch/MainWindow.xib.designer.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Stocks.Touch
3 | {
4 | // Base type probably should be MonoTouch.Foundation.NSObject or subclass
5 | [MonoTouch.Foundation.Register("AppDelegate")]
6 | public partial class AppDelegate
7 | {
8 |
9 | [MonoTouch.Foundation.Connect("window")]
10 | private MonoTouch.UIKit.UIWindow window {
11 | get { return ((MonoTouch.UIKit.UIWindow)(this.GetNativeField ("window"))); }
12 | set { this.SetNativeField ("window", value); }
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/examples/StocksTouch/StocksTouch.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StocksTouch", "StocksTouch.csproj", "{082A4687-D717-4879-8AB1-3CE2BE1F16A0}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|iPhoneSimulator = Debug|iPhoneSimulator
9 | Release|iPhoneSimulator = Release|iPhoneSimulator
10 | Debug|iPhone = Debug|iPhone
11 | Release|iPhone = Release|iPhone
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {082A4687-D717-4879-8AB1-3CE2BE1F16A0}.Debug|iPhone.ActiveCfg = Debug|iPhone
15 | {082A4687-D717-4879-8AB1-3CE2BE1F16A0}.Debug|iPhone.Build.0 = Debug|iPhone
16 | {082A4687-D717-4879-8AB1-3CE2BE1F16A0}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
17 | {082A4687-D717-4879-8AB1-3CE2BE1F16A0}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
18 | {082A4687-D717-4879-8AB1-3CE2BE1F16A0}.Release|iPhone.ActiveCfg = Release|iPhone
19 | {082A4687-D717-4879-8AB1-3CE2BE1F16A0}.Release|iPhone.Build.0 = Release|iPhone
20 | {082A4687-D717-4879-8AB1-3CE2BE1F16A0}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
21 | {082A4687-D717-4879-8AB1-3CE2BE1F16A0}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
22 | EndGlobalSection
23 | GlobalSection(MonoDevelopProperties) = preSolution
24 | StartupItem = StocksTouch.csproj
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/examples/StocksTouch/StocksView.xib.designer.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Mono Runtime Version: 2.0.50727.1433
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | // ------------------------------------------------------------------------------
10 |
11 | namespace Stocks.Touch {
12 |
13 |
14 | // Base type probably should be MonoTouch.UIKit.UIViewController or subclass
15 | [MonoTouch.Foundation.Register("StocksView")]
16 | public partial class StocksView {
17 |
18 | [MonoTouch.Foundation.Connect("view")]
19 | private MonoTouch.UIKit.UIView view {
20 | get {
21 | return ((MonoTouch.UIKit.UIView)(this.GetNativeField("view")));
22 | }
23 | set {
24 | this.SetNativeField("view", value);
25 | }
26 | }
27 |
28 | [MonoTouch.Foundation.Connect("table")]
29 | private MonoTouch.UIKit.UITableView table {
30 | get {
31 | return ((MonoTouch.UIKit.UITableView)(this.GetNativeField("table")));
32 | }
33 | set {
34 | this.SetNativeField("table", value);
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/lib/metro/ARM/sqlite3.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/lib/metro/ARM/sqlite3.dll
--------------------------------------------------------------------------------
/lib/metro/x64/sqlite3.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/lib/metro/x64/sqlite3.dll
--------------------------------------------------------------------------------
/lib/metro/x86/sqlite3.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/lib/metro/x86/sqlite3.dll
--------------------------------------------------------------------------------
/lib/wp7/Community.CsharpSqlite.WinPhone.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/lib/wp7/Community.CsharpSqlite.WinPhone.dll
--------------------------------------------------------------------------------
/license.md:
--------------------------------------------------------------------------------
1 | License
2 | ===
3 |
4 | Copyright (c) 2009-2012 Krueger Systems, Inc.
5 | Copyright (c) 2013 Øystein Krog
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
--------------------------------------------------------------------------------
/logo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/logo.gif
--------------------------------------------------------------------------------
/logo.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/logo.psd
--------------------------------------------------------------------------------
/nuget/SQLite.Net.Async.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SQLite.Net.Async-PCL
5 | 3.1.1
6 | SQLite.Net.Async PCL
7 | Øystein Krog,Frank Krueger,Tim Heuer
8 | Øystein Krog
9 | https://raw.github.com/oysteinkrog/SQLite.Net-PCL/master/LICENSE.txt
10 | https://github.com/oysteinkrog/SQLite.Net-PCL
11 | false
12 | SQLite.Net PCL is an open source, minimal library to allow .NET and Mono applications to store data in SQLite databases.
13 | 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.
14 | This package is compatible with the following .net platforms: net4+sl5+wp8+win8+monotouch+monoAndroid
15 | A .NET client library to access SQLite embedded database files in a LINQ manner.
16 | This package provides Async extensions to the core SQLite.Net package.
17 | https://github.com/oysteinkrog/SQLite.Net-PCL/commits
18 | sqlite pcl sql database ios android windows metro winrt xamarin monotouch monodroid win32 windowsphone wp wp8 wp8.1
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/nuget/SQLite.Net.Core.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SQLite.Net.Core-PCL
5 | 3.1.1
6 | SQLite.Net PCL
7 | Øystein Krog,Frank Krueger,Tim Heuer
8 | Øystein Krog
9 | https://raw.github.com/oysteinkrog/SQLite.Net-PCL/master/LICENSE.txt
10 | https://github.com/oysteinkrog/SQLite.Net-PCL
11 | false
12 | SQLite.Net PCL is an open source, minimal library to allow .NET and Mono applications to store data in SQLite databases.
13 | 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.
14 | 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)
15 | A .NET client library to access SQLite embedded database files in a LINQ manner.
16 | https://github.com/oysteinkrog/SQLite.Net-PCL/commits
17 | sqlite pcl sql database ios android windows metro winrt xamarin monotouch monodroid win32 windowsphone wp wp8 wp8.1
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/nuget/build.bat:
--------------------------------------------------------------------------------
1 | @mkdir output
2 | ..\.nuget\nuget pack SQLite.Net.Core.nuspec -o output
3 | ..\.nuget\nuget pack SQLite.Net.nuspec -o output
4 | ..\.nuget\nuget pack SQLite.Net.Async.nuspec -o output
5 |
--------------------------------------------------------------------------------
/nuget/prepare.bat:
--------------------------------------------------------------------------------
1 | mkdir SQLite.Net
2 | copy /y ..\src\SQLite.Net\bin\Release\SQLite.Net.dll SQLite.Net
3 | type nul >SQLite.Net\_._
4 |
5 | mkdir SQLite.Net.Async
6 | copy /y ..\src\SQLite.Net.Async\bin\Release\SQLite.Net.Async.dll SQLite.Net.Async
7 |
8 | mkdir SQLite.Net.Platform.Generic
9 | copy /y ..\src\SQLite.Net.Platform.Generic\bin\Release\SQLite.Net.Platform.Generic.dll SQLite.Net.Platform.Generic
10 |
11 | mkdir SQLite.Net.Platform.Win32
12 | copy /y ..\src\SQLite.Net.Platform.Win32\bin\Release\SQLite.Net.Platform.Win32.dll SQLite.Net.Platform.Win32
13 |
14 | mkdir SQLite.Net.Platform.WindowsPhone8
15 | mkdir SQLite.Net.Platform.WindowsPhone8\ARM
16 | mkdir SQLite.Net.Platform.WindowsPhone8\x86
17 | copy /y ..\src\SQLite.Net.Platform.WindowsPhone8\bin\x86\Release\SQLite.Net.Platform.WindowsPhone8.dll SQLite.Net.Platform.WindowsPhone8\x86
18 | copy /y ..\src\SQLite.Net.Platform.WindowsPhone8\bin\ARM\Release\SQLite.Net.Platform.WindowsPhone8.dll SQLite.Net.Platform.WindowsPhone8\ARM
19 |
20 | mkdir SQLite.Net.Platform.WinRT
21 | copy /y ..\src\SQLite.Net.Platform.WinRT\bin\Release\SQLite.Net.Platform.WinRT.dll SQLite.Net.Platform.WinRT
22 |
23 | mkdir SQLite.Net.Platform.XamarinAndroid
24 | copy /y ..\src\SQLite.Net.Platform.XamarinAndroid\bin\Release\SQLite.Net.Platform.XamarinAndroid.dll SQLite.Net.Platform.XamarinAndroid
25 |
26 | mkdir SQLite.Net.Platform.XamarinIOS
27 | copy /y ..\src\SQLite.Net.Platform.XamarinIOS\bin\iPhone\Release\SQLite.Net.Platform.XamarinIOS.dll SQLite.Net.Platform.XamarinIOS
28 |
29 | mkdir SQLite.Net.Platform.XamarinIOS.Unified
30 | copy /y ..\src\SQLite.Net.Platform.XamarinIOS.Unified\bin\Release\SQLite.Net.Platform.XamarinIOS.Unified.dll SQLite.Net.Platform.XamarinIOS.Unified
31 |
--------------------------------------------------------------------------------
/nuget/upload.bat:
--------------------------------------------------------------------------------
1 | ..\.nuget\nuget push output\SQLite.Net.Core-PCL.3.1.1.nupkg
2 | ..\.nuget\nuget push output\SQLite.Net-PCL.3.1.1.nupkg
3 | ..\.nuget\nuget push output\SQLite.Net.Async-PCL.3.1.1.nupkg
4 |
--------------------------------------------------------------------------------
/src/GlobalAssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | // Version information for an assembly consists of the following four values:
4 | //
5 | // Major Version
6 | // Minor Version
7 | // Build Number
8 | // Revision
9 | //
10 | // You can specify all the values or you can default the Build and Revision Numbers
11 | // by using the '*' as shown below:
12 | // [assembly: AssemblyVersion("1.0.*")]
13 |
14 | [assembly: AssemblyVersion("3.1.1.0")]
15 | [assembly: AssemblyFileVersion("3.1.1.0")]
16 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Async/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | // General Information about an assembly is controlled through the following
4 | // set of attributes. Change these attribute values to modify the information
5 | // associated with an assembly.
6 |
7 | [assembly: AssemblyTitle("SQLite.Net.Async")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Øystein Krog")]
11 | [assembly: AssemblyProduct("SQLite.Net.Async")]
12 | [assembly: AssemblyCopyright("Copyright © Øystein Krog, Krueger Systems Inc.")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Generic/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 | [assembly: AssemblyTitle ("SQLite.Net.Platform.Generic")]
7 | [assembly: AssemblyDescription ("")]
8 | [assembly: AssemblyConfiguration ("")]
9 | [assembly: AssemblyCompany ("")]
10 | [assembly: AssemblyProduct ("")]
11 | [assembly: AssemblyCopyright ("James Ottaway")]
12 | [assembly: AssemblyTrademark ("")]
13 | [assembly: AssemblyCulture ("")]
14 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Generic/ReflectionServiceGeneric.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq.Expressions;
4 | using System.Reflection;
5 | using SQLite.Net.Interop;
6 |
7 | namespace SQLite.Net.Platform.Generic
8 | {
9 | public class ReflectionServiceGeneric : IReflectionService
10 | {
11 | public IEnumerable GetPublicInstanceProperties(Type mappedType)
12 | {
13 | return mappedType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
14 | }
15 |
16 | public object GetMemberValue(object obj, Expression expr, MemberInfo member)
17 | {
18 | if (member.MemberType == MemberTypes.Property)
19 | {
20 | var m = (PropertyInfo) member;
21 | return m.GetValue(obj, null);
22 | }
23 | if (member.MemberType == MemberTypes.Field)
24 | {
25 | var m = (FieldInfo) member;
26 | return m.GetValue(obj);
27 | }
28 | throw new NotSupportedException("MemberExpr: " + member.MemberType);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Generic/SQLite.Net.Platform.Generic.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {F662E15A-8753-468E-A67E-3FCF45F12B89}
7 | Library
8 | SQLite.Net.Platform.Generic
9 | SQLite.Net.Platform.Generic
10 | v4.5
11 |
12 |
13 | true
14 | full
15 | false
16 | bin\Debug
17 | DEBUG;
18 | prompt
19 | 4
20 | false
21 |
22 |
23 | full
24 | true
25 | bin\Release
26 | prompt
27 | 4
28 | false
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | Properties\GlobalAssemblyInfo.cs
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | {4971D437-0694-4297-A8CC-146CE08C3BD9}
52 | SQLite.Net
53 |
54 |
55 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Generic/SQLitePlatformGeneric.cs:
--------------------------------------------------------------------------------
1 | using SQLite.Net.Interop;
2 |
3 | namespace SQLite.Net.Platform.Generic
4 | {
5 | public class SQLitePlatformGeneric : ISQLitePlatform
6 | {
7 | public SQLitePlatformGeneric()
8 | {
9 | SQLiteApi = new SQLiteApiGeneric();
10 | StopwatchFactory = new StopwatchFactoryGeneric();
11 | ReflectionService = new ReflectionServiceGeneric();
12 | VolatileService = new VolatileServiceGeneric();
13 | }
14 |
15 | public ISQLiteApi SQLiteApi { get; private set; }
16 | public IStopwatchFactory StopwatchFactory { get; private set; }
17 | public IReflectionService ReflectionService { get; private set; }
18 | public IVolatileService VolatileService { get; private set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Generic/StopwatchFactoryGeneric.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.Generic
5 | {
6 | public class StopwatchFactoryGeneric : IStopwatchFactory
7 | {
8 | public IStopwatch Create()
9 | {
10 | return new StopwatchGeneric();
11 | }
12 |
13 | private class StopwatchGeneric : IStopwatch
14 | {
15 | private readonly Stopwatch _stopWatch;
16 |
17 | public StopwatchGeneric()
18 | {
19 | _stopWatch = new Stopwatch();
20 | }
21 |
22 | public void Stop()
23 | {
24 | _stopWatch.Stop();
25 | }
26 |
27 | public void Reset()
28 | {
29 | _stopWatch.Reset();
30 | }
31 |
32 | public void Start()
33 | {
34 | _stopWatch.Start();
35 | }
36 |
37 | public long ElapsedMilliseconds
38 | {
39 | get { return _stopWatch.ElapsedMilliseconds; }
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Generic/VolatileServiceGeneric.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.Generic
5 | {
6 | public class VolatileServiceGeneric : IVolatileService
7 | {
8 | public void Write(ref int transactionDepth, int depth)
9 | {
10 | Thread.VolatileWrite(ref transactionDepth, depth);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.OSX/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("SQLite.Net.Platform.OSX")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Øystein Krog")]
12 | [assembly: AssemblyProduct("SQLite.Net.Platform.OSX")]
13 | [assembly: AssemblyCopyright("Copyright © Øystein Krog")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("4f906778-2564-403a-81d7-1b8ba8c2cee6")]
26 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.OSX/ReflectionServiceOSX.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq.Expressions;
4 | using System.Reflection;
5 | using SQLite.Net.Interop;
6 |
7 | namespace SQLite.Net.Platform.OSX
8 | {
9 | public class ReflectionServiceOSX : IReflectionService
10 | {
11 | public IEnumerable GetPublicInstanceProperties(Type mappedType)
12 | {
13 | return mappedType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
14 | }
15 |
16 | public object GetMemberValue(object obj, Expression expr, MemberInfo member)
17 | {
18 | if (member.MemberType == MemberTypes.Property)
19 | {
20 | var m = (PropertyInfo) member;
21 | return m.GetValue(obj, null);
22 | }
23 | if (member.MemberType == MemberTypes.Field)
24 | {
25 | var m = (FieldInfo) member;
26 | return m.GetValue(obj);
27 | }
28 | throw new NotSupportedException("MemberExpr: " + member.MemberType);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.OSX/SQLite.Net.Platform.OSX.dll.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.OSX/SQLitePlatformOSX.cs:
--------------------------------------------------------------------------------
1 | using SQLite.Net.Interop;
2 |
3 | namespace SQLite.Net.Platform.OSX
4 | {
5 | public class SQLitePlatformOSX : ISQLitePlatform
6 | {
7 | public SQLitePlatformOSX()
8 | {
9 | SQLiteApi = new SQLiteApiOSX();
10 | StopwatchFactory = new StopwatchFactoryOSX();
11 | ReflectionService = new ReflectionServiceOSX();
12 | VolatileService = new VolatileServiceOSX();
13 | }
14 |
15 | public ISQLiteApi SQLiteApi { get; private set; }
16 | public IStopwatchFactory StopwatchFactory { get; private set; }
17 | public IReflectionService ReflectionService { get; private set; }
18 | public IVolatileService VolatileService { get; private set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.OSX/StopwatchFactoryOSX.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.OSX
5 | {
6 | public class StopwatchFactoryOSX : IStopwatchFactory
7 | {
8 | public IStopwatch Create()
9 | {
10 | return new StopwatchOSX();
11 | }
12 |
13 | private class StopwatchOSX : IStopwatch
14 | {
15 | private readonly Stopwatch _stopWatch;
16 |
17 | public StopwatchOSX()
18 | {
19 | _stopWatch = new Stopwatch();
20 | }
21 |
22 | public void Stop()
23 | {
24 | _stopWatch.Stop();
25 | }
26 |
27 | public void Reset()
28 | {
29 | _stopWatch.Reset();
30 | }
31 |
32 | public void Start()
33 | {
34 | _stopWatch.Start();
35 | }
36 |
37 | public long ElapsedMilliseconds
38 | {
39 | get { return _stopWatch.ElapsedMilliseconds; }
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.OSX/VolatileServiceOSX.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.OSX
5 | {
6 | public class VolatileServiceOSX : IVolatileService
7 | {
8 | public void Write(ref int transactionDepth, int depth)
9 | {
10 | Thread.VolatileWrite(ref transactionDepth, depth);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.OSX/i386/libsqlite3_for_net.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/src/SQLite.Net.Platform.OSX/i386/libsqlite3_for_net.dylib
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.OSX/x86_64/libsqlite3_for_net.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/src/SQLite.Net.Platform.OSX/x86_64/libsqlite3_for_net.dylib
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("SQLite.Net.Platform.Win32")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Øystein Krog")]
12 | [assembly: AssemblyProduct("SQLite.Net.Platform.Win32")]
13 | [assembly: AssemblyCopyright("Copyright © Øystein Krog")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("4f906778-2564-403a-81d7-1b8ba8c2cee6")]
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/ReflectionServiceWin32.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq.Expressions;
4 | using System.Reflection;
5 | using SQLite.Net.Interop;
6 |
7 | namespace SQLite.Net.Platform.Win32
8 | {
9 | public class ReflectionServiceWin32 : IReflectionService
10 | {
11 | public IEnumerable GetPublicInstanceProperties(Type mappedType)
12 | {
13 | return mappedType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
14 | }
15 |
16 | public object GetMemberValue(object obj, Expression expr, MemberInfo member)
17 | {
18 | if (member.MemberType == MemberTypes.Property)
19 | {
20 | var m = (PropertyInfo) member;
21 | return m.GetValue(obj, null);
22 | }
23 | if (member.MemberType == MemberTypes.Field)
24 | {
25 | var m = (FieldInfo) member;
26 | return m.GetValue(obj);
27 | }
28 | throw new NotSupportedException("MemberExpr: " + member.MemberType);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/SQLiteApiWin32InternalConfiguration.cs:
--------------------------------------------------------------------------------
1 | namespace SQLite.Net.Platform.Win32
2 | {
3 | internal static class SQLiteApiWin32InternalConfiguration
4 | {
5 | public static string NativeInteropSearchPath { get; set; }
6 | }
7 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/SQLitePlatformWin32.cs:
--------------------------------------------------------------------------------
1 | using SQLite.Net.Interop;
2 |
3 | namespace SQLite.Net.Platform.Win32
4 | {
5 | public class SQLitePlatformWin32 : ISQLitePlatform
6 | {
7 | public SQLitePlatformWin32(string nativeInteropSearchPath = null)
8 | {
9 | SQLiteApi = new SQLiteApiWin32(nativeInteropSearchPath);
10 | StopwatchFactory = new StopwatchFactoryWin32();
11 | ReflectionService = new ReflectionServiceWin32();
12 | VolatileService = new VolatileServiceWin32();
13 | }
14 |
15 | public ISQLiteApi SQLiteApi { get; private set; }
16 | public IStopwatchFactory StopwatchFactory { get; private set; }
17 | public IReflectionService ReflectionService { get; private set; }
18 | public IVolatileService VolatileService { get; private set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/StopwatchFactoryWin32.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.Win32
5 | {
6 | public class StopwatchFactoryWin32 : IStopwatchFactory
7 | {
8 | public IStopwatch Create()
9 | {
10 | return new StopwatchWin32();
11 | }
12 |
13 | private class StopwatchWin32 : IStopwatch
14 | {
15 | private readonly Stopwatch _stopWatch;
16 |
17 | public StopwatchWin32()
18 | {
19 | _stopWatch = new Stopwatch();
20 | }
21 |
22 | public void Stop()
23 | {
24 | _stopWatch.Stop();
25 | }
26 |
27 | public void Reset()
28 | {
29 | _stopWatch.Reset();
30 | }
31 |
32 | public void Start()
33 | {
34 | _stopWatch.Start();
35 | }
36 |
37 | public long ElapsedMilliseconds
38 | {
39 | get { return _stopWatch.ElapsedMilliseconds; }
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/VolatileServiceWin32.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.Win32
5 | {
6 | public class VolatileServiceWin32 : IVolatileService
7 | {
8 | public void Write(ref int transactionDepth, int depth)
9 | {
10 | Thread.VolatileWrite(ref transactionDepth, depth);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/x64/SQLite.Interop.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/src/SQLite.Net.Platform.Win32/x64/SQLite.Interop.dll
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.Win32/x86/SQLite.Interop.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/src/SQLite.Net.Platform.Win32/x86/SQLite.Interop.dll
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WinRT/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | // General Information about an assembly is controlled through the following
4 | // set of attributes. Change these attribute values to modify the information
5 | // associated with an assembly.
6 |
7 | [assembly: AssemblyTitle("SQLite.Net.Platform.WinRT")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Øystein Krog")]
11 | [assembly: AssemblyProduct("SQLite.Net.Platform.WinRT")]
12 | [assembly: AssemblyCopyright("Copyright © Øystein Krog")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WinRT/ReflectionServiceWinRT.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Linq.Expressions;
5 | using System.Reflection;
6 | using SQLite.Net.Interop;
7 |
8 | namespace SQLite.Net.Platform.WinRT
9 | {
10 | public class ReflectionServiceWinRT : IReflectionService
11 | {
12 | public IEnumerable GetPublicInstanceProperties(Type mappedType)
13 | {
14 | return from p in mappedType.GetRuntimeProperties()
15 | where
16 | ((p.GetMethod != null && p.GetMethod.IsPublic) || (p.SetMethod != null && p.SetMethod.IsPublic) ||
17 | (p.GetMethod != null && p.GetMethod.IsStatic) || (p.SetMethod != null && p.SetMethod.IsStatic))
18 | select p;
19 | }
20 |
21 | public object GetMemberValue(object obj, Expression expr, MemberInfo member)
22 | {
23 | if (member is PropertyInfo)
24 | {
25 | var m = (PropertyInfo) member;
26 | return m.GetValue(obj, null);
27 | }
28 | if (member is FieldInfo)
29 | {
30 | var m = (FieldInfo) member;
31 | return m.GetValue(obj);
32 | }
33 | throw new NotSupportedException("MemberExpr: " + member.DeclaringType);
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WinRT/SQLitePlatformWinRT.cs:
--------------------------------------------------------------------------------
1 | using Windows.Storage;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.WinRT
5 | {
6 | public class SQLitePlatformWinRT : ISQLitePlatform
7 | {
8 | ///
9 | /// Creates a SQLite platform object for use from WinRT.
10 | ///
11 | /// Optional: Temporary folder path. Defaults to
12 | /// 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.
13 | public SQLitePlatformWinRT(string tempFolderPath = null, bool useWinSqlite = false)
14 | {
15 | SQLiteApi = new SQLiteApiWinRT(tempFolderPath, useWinSqlite);
16 | VolatileService = new VolatileServiceWinRT();
17 | StopwatchFactory = new StopwatchFactoryWinRT();
18 | ReflectionService = new ReflectionServiceWinRT();
19 | }
20 |
21 | public string DatabaseRootDirectory
22 | {
23 | get { return ApplicationData.Current.LocalFolder.Path; }
24 | }
25 |
26 | public ISQLiteApi SQLiteApi { get; private set; }
27 | public IStopwatchFactory StopwatchFactory { get; private set; }
28 | public IReflectionService ReflectionService { get; private set; }
29 | public IVolatileService VolatileService { get; private set; }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WinRT/StopwatchFactoryWinRT.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.WinRT
5 | {
6 | public class StopwatchFactoryWinRT : IStopwatchFactory
7 | {
8 | public IStopwatch Create()
9 | {
10 | return new StopwatchWinRT();
11 | }
12 |
13 | private class StopwatchWinRT : IStopwatch
14 | {
15 | private readonly Stopwatch _stopWatch;
16 |
17 | public StopwatchWinRT()
18 | {
19 | _stopWatch = new Stopwatch();
20 | }
21 |
22 | public void Stop()
23 | {
24 | _stopWatch.Stop();
25 | }
26 |
27 | public void Reset()
28 | {
29 | _stopWatch.Reset();
30 | }
31 |
32 | public void Start()
33 | {
34 | _stopWatch.Start();
35 | }
36 |
37 | public long ElapsedMilliseconds
38 | {
39 | get { return _stopWatch.ElapsedMilliseconds; }
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WinRT/VolatileServiceWinRT.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.WinRT
5 | {
6 | public class VolatileServiceWinRT : IVolatileService
7 | {
8 | public void Write(ref int transactionDepth, int depth)
9 | {
10 | Volatile.Write(ref transactionDepth, depth);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WindowsPhone8/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("SQLite.Net.Platform.WindowsPhone8")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SQLite.Net.Platform.WindowsPhone8")]
13 | [assembly: AssemblyCopyright("Copyright © Øystein Krog")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("741521f8-f9d8-40f4-a5d4-aed4e26841ed")]
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WindowsPhone8/ReflectionServiceWP8.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Linq.Expressions;
5 | using System.Reflection;
6 | using SQLite.Net.Interop;
7 |
8 | namespace SQLite.Net.Platform.WindowsPhone8
9 | {
10 | public class ReflectionServiceWP8 : IReflectionService
11 | {
12 | public IEnumerable GetPublicInstanceProperties(Type mappedType)
13 | {
14 | if (mappedType == null)
15 | {
16 | throw new ArgumentNullException("mappedType");
17 | }
18 | return from p in mappedType.GetRuntimeProperties()
19 | where
20 | ((p.GetMethod != null && p.GetMethod.IsPublic) || (p.SetMethod != null && p.SetMethod.IsPublic) ||
21 | (p.GetMethod != null && p.GetMethod.IsStatic) || (p.SetMethod != null && p.SetMethod.IsStatic))
22 | select p;
23 | }
24 |
25 | public object GetMemberValue(object obj, Expression expr, MemberInfo member)
26 | {
27 | if (member.MemberType == MemberTypes.Property)
28 | {
29 | var m = (PropertyInfo) member;
30 | return m.GetValue(obj, null);
31 | }
32 | if (member.MemberType == MemberTypes.Field)
33 | {
34 | return Expression.Lambda(expr).Compile().DynamicInvoke();
35 | }
36 | throw new NotSupportedException("MemberExpr: " + member.MemberType);
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WindowsPhone8/SQLitePlatformWP8.cs:
--------------------------------------------------------------------------------
1 | using SQLite.Net.Interop;
2 |
3 | namespace SQLite.Net.Platform.WindowsPhone8
4 | {
5 | public class SQLitePlatformWP8 : ISQLitePlatform
6 | {
7 | public SQLitePlatformWP8()
8 | {
9 | var api = new SQLiteApiWP8();
10 |
11 | // api.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
12 |
13 | SQLiteApi = api;
14 | VolatileService = new VolatileServiceWP8();
15 | ReflectionService = new ReflectionServiceWP8();
16 | StopwatchFactory = new StopwatchFactoryWP8();
17 | }
18 |
19 | public ISQLiteApi SQLiteApi { get; private set; }
20 | public IStopwatchFactory StopwatchFactory { get; private set; }
21 | public IReflectionService ReflectionService { get; private set; }
22 | public IVolatileService VolatileService { get; private set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WindowsPhone8/StopwatchFactoryWP8.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.WindowsPhone8
5 | {
6 | public class StopwatchFactoryWP8 : IStopwatchFactory
7 | {
8 | public IStopwatch Create()
9 | {
10 | return new StopwatchWP8();
11 | }
12 |
13 | private class StopwatchWP8 : IStopwatch
14 | {
15 | private readonly Stopwatch _stopWatch;
16 |
17 | public StopwatchWP8()
18 | {
19 | _stopWatch = new Stopwatch();
20 | }
21 |
22 | public void Stop()
23 | {
24 | _stopWatch.Stop();
25 | }
26 |
27 | public void Reset()
28 | {
29 | _stopWatch.Reset();
30 | }
31 |
32 | public void Start()
33 | {
34 | _stopWatch.Start();
35 | }
36 |
37 | public long ElapsedMilliseconds
38 | {
39 | get { return _stopWatch.ElapsedMilliseconds; }
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WindowsPhone8/VolatileServiceWP8.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.WindowsPhone8
5 | {
6 | public class VolatileServiceWP8 : IVolatileService
7 | {
8 | public void Write(ref int transactionDepth, int depth)
9 | {
10 | Volatile.Write(ref transactionDepth, depth);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WindowsPhone8/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.WindowsPhoneApp81/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | // General Information about an assembly is controlled through the following
4 | // set of attributes. Change these attribute values to modify the information
5 | // associated with an assembly.
6 |
7 | [assembly: AssemblyTitle("SQLite.Net.Platform.WindowsPhoneApp81")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("Øystein Krog")]
11 | [assembly: AssemblyProduct("SQLite.Net.Platform.WinRT")]
12 | [assembly: AssemblyCopyright("Copyright © Øystein Krog")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinAndroid/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using Android;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 |
10 | [assembly: AssemblyTitle("SQLite.Net.Platform.XamarinAndroid")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Øystein Krog")]
14 | [assembly: AssemblyProduct("SQLite.Net.Platform.XamarinAndroid")]
15 | [assembly: AssemblyCopyright("Copyright © Øystein Krog")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 | [assembly: ComVisible(false)]
19 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinAndroid/ReflectionServiceAndroid.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq.Expressions;
4 | using System.Reflection;
5 | using SQLite.Net.Interop;
6 |
7 | namespace SQLite.Net.Platform.XamarinAndroid
8 | {
9 | public class ReflectionServiceAndroid : IReflectionService
10 | {
11 | public IEnumerable GetPublicInstanceProperties(Type mappedType)
12 | {
13 | return mappedType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
14 | }
15 |
16 | public object GetMemberValue(object obj, Expression expr, MemberInfo member)
17 | {
18 | if (member.MemberType == MemberTypes.Property)
19 | {
20 | var m = (PropertyInfo) member;
21 | return m.GetValue(obj, null);
22 | }
23 | if (member.MemberType == MemberTypes.Field)
24 | {
25 | var m = (FieldInfo) member;
26 | return m.GetValue(obj);
27 | }
28 | throw new NotSupportedException("MemberExpr: " + member.MemberType);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinAndroid/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.xml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable-hdpi/
12 | icon.png
13 |
14 | drawable-ldpi/
15 | icon.png
16 |
17 | drawable-mdpi/
18 | icon.png
19 |
20 | layout/
21 | main.xml
22 |
23 | values/
24 | strings.xml
25 |
26 | In order to get the build system to recognize Android resources, set the build action to
27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
28 | instead operate on resource IDs. When you compile an Android application that uses resources,
29 | the build system will package the resources for distribution and generate a class called
30 | "Resource" that contains the tokens for each one of the resources included. For example,
31 | for the above Resources layout, this is what the Resource class would expose:
32 |
33 | public class Resource {
34 | public class drawable {
35 | public const int icon = 0x123;
36 | }
37 |
38 | public class layout {
39 | public const int main = 0x456;
40 | }
41 |
42 | public class strings {
43 | public const int first_string = 0xabc;
44 | public const int second_string = 0xbcd;
45 | }
46 | }
47 |
48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50 | string in the dictionary file values/strings.xml.
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinAndroid/Resources/Resource.Designer.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable 1591
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.42000
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | [assembly: global::Android.Runtime.ResourceDesignerAttribute("SQLite.Net.Platform.XamarinAndroid.Resource", IsApplication=false)]
13 |
14 | namespace SQLite.Net.Platform.XamarinAndroid
15 | {
16 |
17 |
18 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
19 | public partial class Resource
20 | {
21 |
22 | static Resource()
23 | {
24 | global::Android.Runtime.ResourceIdManager.UpdateIdValues();
25 | }
26 |
27 | public partial class Attribute
28 | {
29 |
30 | static Attribute()
31 | {
32 | global::Android.Runtime.ResourceIdManager.UpdateIdValues();
33 | }
34 |
35 | private Attribute()
36 | {
37 | }
38 | }
39 |
40 | public partial class String
41 | {
42 |
43 | // aapt resource value: 0x7f020001
44 | public static int ApplicationName = 2130837505;
45 |
46 | // aapt resource value: 0x7f020000
47 | public static int Hello = 2130837504;
48 |
49 | static String()
50 | {
51 | global::Android.Runtime.ResourceIdManager.UpdateIdValues();
52 | }
53 |
54 | private String()
55 | {
56 | }
57 | }
58 | }
59 | }
60 | #pragma warning restore 1591
61 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinAndroid/Resources/Values/Strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello World, Click Me!
5 | $projectname$
6 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinAndroid/SQLitePlatformAndroid.cs:
--------------------------------------------------------------------------------
1 | using SQLite.Net.Interop;
2 |
3 | namespace SQLite.Net.Platform.XamarinAndroid
4 | {
5 | public class SQLitePlatformAndroid : ISQLitePlatform
6 | {
7 | public SQLitePlatformAndroid()
8 | {
9 | SQLiteApi = new SQLiteApiAndroid();
10 | StopwatchFactory = new StopwatchFactoryAndroid();
11 | ReflectionService = new ReflectionServiceAndroid();
12 | VolatileService = new VolatileServiceAndroid();
13 | }
14 |
15 | public ISQLiteApi SQLiteApi { get; private set; }
16 | public IStopwatchFactory StopwatchFactory { get; private set; }
17 | public IReflectionService ReflectionService { get; private set; }
18 | public IVolatileService VolatileService { get; private set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinAndroid/StopwatchFactoryAndroid.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.XamarinAndroid
5 | {
6 | public class StopwatchFactoryAndroid : IStopwatchFactory
7 | {
8 | public IStopwatch Create()
9 | {
10 | return new StopwatchAndroid();
11 | }
12 |
13 | private class StopwatchAndroid : IStopwatch
14 | {
15 | private readonly Stopwatch _stopWatch;
16 |
17 | public StopwatchAndroid()
18 | {
19 | _stopWatch = new Stopwatch();
20 | }
21 |
22 | public void Stop()
23 | {
24 | _stopWatch.Stop();
25 | }
26 |
27 | public void Reset()
28 | {
29 | _stopWatch.Reset();
30 | }
31 |
32 | public void Start()
33 | {
34 | _stopWatch.Start();
35 | }
36 |
37 | public long ElapsedMilliseconds
38 | {
39 | get { return _stopWatch.ElapsedMilliseconds; }
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinAndroid/VolatileServiceAndroid.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.XamarinAndroid
5 | {
6 | public class VolatileServiceAndroid : IVolatileService
7 | {
8 | public void Write(ref int transactionDepth, int depth)
9 | {
10 | Volatile.Write(ref transactionDepth, depth);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS.Unified/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Information about this assembly is defined by the following attributes.
6 | // Change them to the values specific to your project.
7 |
8 | [assembly: AssemblyTitle ("SQLite.Net.Platform.XamarinIOS.Unified")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Leon Lucardie")]
12 | [assembly: AssemblyProduct("SQLite.Net.Platform.XamarinIOS.Unified")]
13 | [assembly: AssemblyCopyright("Copyright ©Øystein Krog 2013-2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following attributes are used to specify the signing key for the assembly,
24 | // if desired. See the Mono documentation for more information about signing.
25 |
26 | //[assembly: AssemblyDelaySign(false)]
27 | //[assembly: AssemblyKeyFile("")]
28 |
29 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS.Unified/ReflectionServiceIOS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq.Expressions;
4 | using System.Reflection;
5 | using SQLite.Net.Interop;
6 |
7 | namespace SQLite.Net.Platform.XamarinIOS
8 | {
9 | public class ReflectionServiceIOS : IReflectionService
10 | {
11 | public IEnumerable GetPublicInstanceProperties(Type mappedType)
12 | {
13 | return mappedType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
14 | }
15 |
16 | public object GetMemberValue(object obj, Expression expr, MemberInfo member)
17 | {
18 | if (member.MemberType == MemberTypes.Property)
19 | {
20 | var m = (PropertyInfo) member;
21 | return m.GetValue(obj, null);
22 | }
23 | if (member.MemberType == MemberTypes.Field)
24 | {
25 | var m = (FieldInfo) member;
26 | return m.GetValue(obj);
27 | }
28 | throw new NotSupportedException("MemberExpr: " + member.MemberType);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS.Unified/SQLite.Net.Platform.XamarinIOS.Unified.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
7 | {3173703F-8B1F-4772-9AE3-44913F413FB1}
8 | Library
9 | SQLite.Net.Platform.XamarinIOS.Unified
10 | Resources
11 | SQLite.Net.Platform.XamarinIOS.Unified
12 |
13 |
14 | true
15 | full
16 | false
17 | bin\Debug
18 | DEBUG;
19 | prompt
20 | 4
21 | false
22 |
23 |
24 | full
25 | true
26 | bin\Release
27 | prompt
28 | 4
29 | false
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | Properties\GlobalAssemblyInfo.cs
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | {4971D437-0694-4297-A8CC-146CE08C3BD9}
53 | SQLite.Net
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS.Unified/SQLitePlatformIOS.cs:
--------------------------------------------------------------------------------
1 | using SQLite.Net.Interop;
2 |
3 | namespace SQLite.Net.Platform.XamarinIOS
4 | {
5 | public class SQLitePlatformIOS : ISQLitePlatform
6 | {
7 | public SQLitePlatformIOS()
8 | {
9 | SQLiteApi = new SQLiteApiIOS();
10 | StopwatchFactory = new StopwatchFactoryIOS();
11 | ReflectionService = new ReflectionServiceIOS();
12 | VolatileService = new VolatileServiceIOS();
13 | }
14 |
15 | public ISQLiteApi SQLiteApi { get; private set; }
16 | public IStopwatchFactory StopwatchFactory { get; private set; }
17 | public IReflectionService ReflectionService { get; private set; }
18 | public IVolatileService VolatileService { get; private set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS.Unified/StopwatchFactoryIOS.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.XamarinIOS
5 | {
6 | public class StopwatchFactoryIOS : IStopwatchFactory
7 | {
8 | public IStopwatch Create()
9 | {
10 | return new StopwatchIOS();
11 | }
12 |
13 | private class StopwatchIOS : IStopwatch
14 | {
15 | private readonly Stopwatch _stopWatch;
16 |
17 | public StopwatchIOS()
18 | {
19 | _stopWatch = new Stopwatch();
20 | }
21 |
22 | public void Stop()
23 | {
24 | _stopWatch.Stop();
25 | }
26 |
27 | public void Reset()
28 | {
29 | _stopWatch.Reset();
30 | }
31 |
32 | public void Start()
33 | {
34 | _stopWatch.Start();
35 | }
36 |
37 | public long ElapsedMilliseconds
38 | {
39 | get { return _stopWatch.ElapsedMilliseconds; }
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS.Unified/VolatileServiceIOS.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.XamarinIOS
5 | {
6 | public class VolatileServiceIOS : IVolatileService
7 | {
8 | public void Write(ref int transactionDepth, int depth)
9 | {
10 | Volatile.Write(ref transactionDepth, depth);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("SQLite.Net.Platform.XamarinIOS")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Øystein Krog")]
12 | [assembly: AssemblyProduct("SQLite.Net.Platform.XamarinIOS")]
13 | [assembly: AssemblyCopyright("Copyright ©Øystein Krog 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 |
25 | [assembly: Guid("d5fbb63f-29de-4148-887f-bfe12c64783b")]
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS/ReflectionServiceIOS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq.Expressions;
4 | using System.Reflection;
5 | using SQLite.Net.Interop;
6 |
7 | namespace SQLite.Net.Platform.XamarinIOS
8 | {
9 | public class ReflectionServiceIOS : IReflectionService
10 | {
11 | public IEnumerable GetPublicInstanceProperties(Type mappedType)
12 | {
13 | return mappedType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty);
14 | }
15 |
16 | public object GetMemberValue(object obj, Expression expr, MemberInfo member)
17 | {
18 | if (member.MemberType == MemberTypes.Property)
19 | {
20 | var m = (PropertyInfo) member;
21 | return m.GetValue(obj, null);
22 | }
23 | if (member.MemberType == MemberTypes.Field)
24 | {
25 | var m = (FieldInfo) member;
26 | return m.GetValue(obj);
27 | }
28 | throw new NotSupportedException("MemberExpr: " + member.MemberType);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS/SQLite.Net.Platform.XamarinIOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | iPhoneSimulator
6 | 8.0.30703
7 | 2.0
8 | {6377929D-6253-450D-BF4B-3E8ECE2564F7}
9 | {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | SQLite.Net.Platform.XamarinIOS
12 | Resources
13 | SQLite.Net.Platform.XamarinIOS
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\iPhone\Debug
20 | DEBUG
21 | prompt
22 | 4
23 | false
24 | true
25 | iPhone Developer
26 |
27 |
28 | none
29 | true
30 | bin\iPhone\Release
31 | prompt
32 | 4
33 | false
34 | iPhone Developer
35 |
36 |
37 |
38 | Properties\GlobalAssemblyInfo.cs
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | {4971d437-0694-4297-a8cc-146ce08c3bd9}
57 | SQLite.Net
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS/SQLitePlatformIOS.cs:
--------------------------------------------------------------------------------
1 | using SQLite.Net.Interop;
2 |
3 | namespace SQLite.Net.Platform.XamarinIOS
4 | {
5 | public class SQLitePlatformIOS : ISQLitePlatform
6 | {
7 | public SQLitePlatformIOS()
8 | {
9 | SQLiteApi = new SQLiteApiIOS();
10 | StopwatchFactory = new StopwatchFactoryIOS();
11 | ReflectionService = new ReflectionServiceIOS();
12 | VolatileService = new VolatileServiceIOS();
13 | }
14 |
15 | public ISQLiteApi SQLiteApi { get; private set; }
16 | public IStopwatchFactory StopwatchFactory { get; private set; }
17 | public IReflectionService ReflectionService { get; private set; }
18 | public IVolatileService VolatileService { get; private set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS/StopwatchFactoryIOS.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.XamarinIOS
5 | {
6 | public class StopwatchFactoryIOS : IStopwatchFactory
7 | {
8 | public IStopwatch Create()
9 | {
10 | return new StopwatchIOS();
11 | }
12 |
13 | private class StopwatchIOS : IStopwatch
14 | {
15 | private readonly Stopwatch _stopWatch;
16 |
17 | public StopwatchIOS()
18 | {
19 | _stopWatch = new Stopwatch();
20 | }
21 |
22 | public void Stop()
23 | {
24 | _stopWatch.Stop();
25 | }
26 |
27 | public void Reset()
28 | {
29 | _stopWatch.Reset();
30 | }
31 |
32 | public void Start()
33 | {
34 | _stopWatch.Start();
35 | }
36 |
37 | public long ElapsedMilliseconds
38 | {
39 | get { return _stopWatch.ElapsedMilliseconds; }
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/SQLite.Net.Platform.XamarinIOS/VolatileServiceIOS.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using SQLite.Net.Interop;
3 |
4 | namespace SQLite.Net.Platform.XamarinIOS
5 | {
6 | public class VolatileServiceIOS : IVolatileService
7 | {
8 | public void Write(ref int transactionDepth, int depth)
9 | {
10 | Volatile.Write(ref transactionDepth, depth);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/ActiveInsertCommand.cs:
--------------------------------------------------------------------------------
1 | // Author: Prasanna V. Loganathar
2 | // Created: 2:37 PM 07-03-2015
3 | // Project: SQLite.Net
4 | // License: See project license
5 |
6 | using System;
7 | using System.Linq;
8 |
9 | namespace SQLite.Net
10 | {
11 | internal class ActiveInsertCommand
12 | {
13 | private readonly TableMapping _tableMapping;
14 | private PreparedSqlLiteInsertCommand _insertCommand;
15 | private string _insertCommandExtra;
16 |
17 | public ActiveInsertCommand(TableMapping tableMapping)
18 | {
19 | _tableMapping = tableMapping;
20 | }
21 |
22 | public PreparedSqlLiteInsertCommand GetCommand(SQLiteConnection conn, string extra)
23 | {
24 | if (_insertCommand == null)
25 | {
26 | _insertCommand = CreateCommand(conn, extra);
27 | _insertCommandExtra = extra;
28 | }
29 | else if (_insertCommandExtra != extra)
30 | {
31 | _insertCommand.Dispose();
32 | _insertCommand = CreateCommand(conn, extra);
33 | _insertCommandExtra = extra;
34 | }
35 | return _insertCommand;
36 | }
37 |
38 | protected internal void Dispose()
39 | {
40 | if (_insertCommand != null)
41 | {
42 | _insertCommand.Dispose();
43 | _insertCommand = null;
44 | }
45 | }
46 |
47 | private PreparedSqlLiteInsertCommand CreateCommand(SQLiteConnection conn, string extra)
48 | {
49 | var cols = _tableMapping.InsertColumns;
50 | string insertSql;
51 | if (!cols.Any() && _tableMapping.Columns.Count() == 1 && _tableMapping.Columns[0].IsAutoInc)
52 | {
53 | insertSql = string.Format("insert {1} into \"{0}\" default values", _tableMapping.TableName, extra);
54 | }
55 | else
56 | {
57 | var replacing = string.Compare(extra, "OR REPLACE", StringComparison.OrdinalIgnoreCase) == 0;
58 |
59 | if (replacing)
60 | {
61 | cols = _tableMapping.Columns;
62 | }
63 |
64 | insertSql = string.Format("insert {3} into \"{0}\"({1}) values ({2})", _tableMapping.TableName,
65 | string.Join(",", (from c in cols
66 | select "\"" + c.Name + "\"").ToArray()),
67 | string.Join(",", (from c in cols
68 | select "?").ToArray()), extra);
69 | }
70 |
71 | return new PreparedSqlLiteInsertCommand(conn)
72 | {
73 | CommandText = insertSql
74 | };
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/AutoIncrementAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Property)]
30 | public class AutoIncrementAttribute : Attribute
31 | {
32 | }
33 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/CollationAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Property)]
30 | public class CollationAttribute : Attribute
31 | {
32 | public CollationAttribute(string collation)
33 | {
34 | Value = collation;
35 | }
36 |
37 | public string Value { get; private set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/ColumnAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Property)]
30 | public class ColumnAttribute : Attribute
31 | {
32 | public ColumnAttribute(string name)
33 | {
34 | Name = name;
35 | }
36 |
37 | public string Name { get; set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/DefaultAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using JetBrains.Annotations;
3 |
4 | namespace SQLite.Net.Attributes
5 | {
6 | [PublicAPI]
7 | [AttributeUsage(AttributeTargets.Property)]
8 | public class DefaultAttribute : Attribute
9 | {
10 | ///
11 | /// Used to set default value in database
12 | ///
13 | ///
14 | /// Will set default value to same as property. You would use proprty with backing field to
15 | /// set this
16 | ///
17 | /// The value to set as default if usePropertyValue is false
18 | public DefaultAttribute(bool usePropertyValue = true, object value = null)
19 | {
20 | UseProperty = usePropertyValue;
21 | Value = value;
22 | }
23 | public bool UseProperty { get; set; }
24 | public object Value { get; private set; }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/DefaultColumnInformationProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Reflection;
4 | using SQLite.Net.Attributes;
5 | using System.Collections.Generic;
6 |
7 | namespace SQLite.Net
8 | {
9 | public class DefaultColumnInformationProvider : IColumnInformationProvider
10 | {
11 | #region IColumnInformationProvider implementation
12 |
13 | public string GetColumnName(PropertyInfo p)
14 | {
15 | var colAttr = p.GetCustomAttributes(true).FirstOrDefault();
16 | return colAttr == null ? p.Name : colAttr.Name;
17 | }
18 |
19 | public bool IsIgnored(PropertyInfo p)
20 | {
21 | return p.IsDefined(typeof (IgnoreAttribute), true);
22 | }
23 |
24 | public IEnumerable GetIndices(MemberInfo p)
25 | {
26 | return p.GetCustomAttributes();
27 | }
28 |
29 | public bool IsPK(MemberInfo m)
30 | {
31 | return m.GetCustomAttributes().Any();
32 | }
33 |
34 | public string Collation(MemberInfo m)
35 | {
36 | foreach (var attribute in m.GetCustomAttributes())
37 | {
38 | return attribute.Value;
39 | }
40 | return string.Empty;
41 | }
42 |
43 | public bool IsAutoInc(MemberInfo m)
44 | {
45 | return m.GetCustomAttributes().Any();
46 | }
47 |
48 | public int? MaxStringLength(PropertyInfo p)
49 | {
50 | foreach (var attribute in p.GetCustomAttributes())
51 | {
52 | return attribute.Value;
53 | }
54 | return null;
55 | }
56 |
57 | public object GetDefaultValue(PropertyInfo p)
58 | {
59 | foreach (var attribute in p.GetCustomAttributes())
60 | {
61 | try
62 | {
63 | if (!attribute.UseProperty)
64 | {
65 | return Convert.ChangeType(attribute.Value, p.PropertyType);
66 | }
67 |
68 | var obj = Activator.CreateInstance(p.DeclaringType);
69 | return p.GetValue(obj);
70 | }
71 | catch (Exception exception)
72 | {
73 | throw new Exception("Unable to convert " + attribute.Value + " to type " + p.PropertyType, exception);
74 | }
75 | }
76 | return null;
77 | }
78 |
79 | public bool IsMarkedNotNull(MemberInfo p)
80 | {
81 | var attrs = p.GetCustomAttributes(true);
82 | return attrs.Any();
83 | }
84 |
85 | #endregion
86 | }
87 | }
88 |
89 |
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/IColumnInformationProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Collections.Generic;
3 | using SQLite.Net.Attributes;
4 |
5 | namespace SQLite.Net
6 | {
7 | public interface IColumnInformationProvider
8 | {
9 | bool IsPK(MemberInfo m);
10 | string Collation(MemberInfo m);
11 | bool IsAutoInc(MemberInfo m);
12 | int? MaxStringLength(PropertyInfo p);
13 | IEnumerable GetIndices(MemberInfo p);
14 | object GetDefaultValue(PropertyInfo p);
15 | bool IsMarkedNotNull(MemberInfo p);
16 | bool IsIgnored(PropertyInfo p);
17 | string GetColumnName(PropertyInfo p);
18 | }
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/IgnoreAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Property)]
30 | public class IgnoreAttribute : Attribute
31 | {
32 | }
33 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/IndexedAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Property)]
30 | public class IndexedAttribute : Attribute
31 | {
32 | public IndexedAttribute()
33 | {
34 | }
35 |
36 | public IndexedAttribute(string name, int order)
37 | {
38 | Name = name;
39 | Order = order;
40 | }
41 |
42 | public string Name { get; set; }
43 | public int Order { get; set; }
44 | public virtual bool Unique { get; set; }
45 | }
46 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/MaxLengthAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Property)]
30 | public class MaxLengthAttribute : Attribute
31 | {
32 | public MaxLengthAttribute(int length)
33 | {
34 | Value = length;
35 | }
36 |
37 | public int Value { get; private set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/NotNullAttribute.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/src/SQLite.Net/Attributes/NotNullAttribute.cs
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/PrimaryKeyAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Property)]
30 | public class PrimaryKeyAttribute : Attribute
31 | {
32 | }
33 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/TableAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
30 | public class TableAttribute : Attribute
31 | {
32 | public TableAttribute(string name)
33 | {
34 | Name = name;
35 | }
36 |
37 | public string Name { get; set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Attributes/UniqueAttribute.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Attributes
27 | {
28 | [PublicAPI]
29 | [AttributeUsage(AttributeTargets.Property)]
30 | public class UniqueAttribute : IndexedAttribute
31 | {
32 | public override bool Unique
33 | {
34 | get { return true; }
35 | set
36 | {
37 | /* throw? */
38 | }
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/BaseTableQuery.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | using JetBrains.Annotations;
23 |
24 | namespace SQLite.Net
25 | {
26 | [PublicAPI]
27 | public abstract class BaseTableQuery
28 | {
29 | protected class Ordering
30 | {
31 | [CanBeNull]
32 | public string ColumnName { get; set; }
33 |
34 | public bool Ascending { get; set; }
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/BlobSerializerDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using JetBrains.Annotations;
3 |
4 | namespace SQLite.Net
5 | {
6 | public class BlobSerializerDelegate : IBlobSerializer
7 | {
8 | public delegate bool CanSerializeDelegate(Type type);
9 |
10 | public delegate object DeserializeDelegate(byte[] data, Type type);
11 |
12 | public delegate byte[] SerializeDelegate(object obj);
13 |
14 | private readonly CanSerializeDelegate _canDeserializeDelegate;
15 | private readonly DeserializeDelegate _deserializeDelegate;
16 | private readonly SerializeDelegate _serializeDelegate;
17 |
18 | [PublicAPI]
19 | public BlobSerializerDelegate(SerializeDelegate serializeDelegate,
20 | DeserializeDelegate deserializeDelegate,
21 | CanSerializeDelegate canDeserializeDelegate)
22 | {
23 | _serializeDelegate = serializeDelegate;
24 | _deserializeDelegate = deserializeDelegate;
25 | _canDeserializeDelegate = canDeserializeDelegate;
26 | }
27 |
28 | #region IBlobSerializer implementation
29 |
30 | [PublicAPI]
31 | public byte[] Serialize(T obj)
32 | {
33 | return _serializeDelegate(obj);
34 | }
35 |
36 | [PublicAPI]
37 | public object Deserialize(byte[] data, Type type)
38 | {
39 | return _deserializeDelegate(data, type);
40 | }
41 |
42 | [PublicAPI]
43 | public bool CanDeserialize(Type type)
44 | {
45 | return _canDeserializeDelegate(type);
46 | }
47 |
48 | #endregion
49 | }
50 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/CreateTablesResult.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | using System;
23 | using System.Collections.Generic;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net
27 | {
28 | public class CreateTablesResult
29 | {
30 | internal CreateTablesResult()
31 | {
32 | Results = new Dictionary();
33 | }
34 |
35 | [NotNull]
36 | [PublicAPI]
37 | public Dictionary Results { get; private set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/DebugTraceListener.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | namespace SQLite.Net
4 | {
5 | public sealed class DebugTraceListener : ITraceListener
6 | {
7 | public static DebugTraceListener Instance = new DebugTraceListener();
8 |
9 | private DebugTraceListener()
10 | {
11 | }
12 |
13 | public void Receive(string message)
14 | {
15 | Debug.WriteLine(message);
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/IBlobSerializer.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2013, Sami M. Kallio
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | using System;
18 | using JetBrains.Annotations;
19 |
20 | namespace SQLite.Net
21 | {
22 | ///
23 | /// The TextSerializer interface.
24 | ///
25 | public interface IBlobSerializer
26 | {
27 | ///
28 | /// Serializes object to a byte buffer
29 | ///
30 | /// Object to serialize
31 | /// Serialized blob of the object
32 | [PublicAPI]
33 | byte[] Serialize(T obj);
34 |
35 | ///
36 | /// Deserializes byte buffer into an object
37 | ///
38 | /// Serialized object
39 | /// Type of object
40 | /// Deserialized object
41 | [PublicAPI]
42 | object Deserialize(byte[] data, Type type);
43 |
44 | [PublicAPI]
45 | bool CanDeserialize(Type type);
46 | }
47 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/IContractResolver.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using JetBrains.Annotations;
3 |
4 | namespace SQLite.Net
5 | {
6 | ///
7 | /// Interface for the ContractResolver. This interface provides the contract for resolving interfaces to concreate
8 | /// classes during
9 | /// creation of an object/complex type
10 | ///
11 | public interface IContractResolver
12 | {
13 | ///
14 | /// Gets or sets the can create function method.
15 | /// This function take a object
16 | ///
17 | ///
18 | /// Returns true if the type can be resolved. Note, if the default constructor is used, this will always return
19 | /// true
20 | ///
21 | [PublicAPI]
22 | Func CanCreate { get; }
23 |
24 | ///
25 | /// Gets or sets the create function method.
26 | /// This function take a object and an array of items that can be passed to
27 | /// the constructor
28 | /// if the resolve supports it.
29 | ///
30 | /// The create.
31 | [PublicAPI]
32 | Func Create { get; }
33 |
34 | ///
35 | /// Creates the object.
36 | ///
37 | /// The type.
38 | /// The constructor arguments.
39 | /// System.Object.
40 | [PublicAPI]
41 | object CreateObject(Type type, object[] constructorArgs = null);
42 | }
43 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/ISerializable.cs:
--------------------------------------------------------------------------------
1 | using JetBrains.Annotations;
2 |
3 | namespace SQLite.Net
4 | {
5 | public interface ISerializable
6 | {
7 | [PublicAPI]
8 | T Serialize();
9 | }
10 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/ITraceListener.cs:
--------------------------------------------------------------------------------
1 | using JetBrains.Annotations;
2 |
3 | namespace SQLite.Net
4 | {
5 | public interface ITraceListener
6 | {
7 | [PublicAPI]
8 | void Receive(string message);
9 | }
10 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/ColType.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using JetBrains.Annotations;
24 |
25 | namespace SQLite.Net.Interop
26 | {
27 | [PublicAPI]
28 | public enum ColType
29 | {
30 | Integer = 1,
31 | Float = 2,
32 | Text = 3,
33 | Blob = 4,
34 | Null = 5
35 | }
36 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/ConfigOption.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using JetBrains.Annotations;
24 |
25 | namespace SQLite.Net.Interop
26 | {
27 | [PublicAPI]
28 | public enum ConfigOption
29 | {
30 | SingleThread = 1,
31 | MultiThread = 2,
32 | Serialized = 3
33 | }
34 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/CreateFlags.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Interop
27 | {
28 | [PublicAPI]
29 | [Flags]
30 | public enum CreateFlags
31 | {
32 | None = 0,
33 | ImplicitPK = 1, // create a primary key for field called 'Id' (Orm.ImplicitPkName)
34 | ImplicitIndex = 2, // create an index for fields ending in 'Id' (Orm.ImplicitIndexSuffix)
35 | AllImplicit = 3, // do both above
36 |
37 | AutoIncPK = 4 // force PK field to be auto inc
38 | }
39 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/ExtendedResult.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 | using JetBrains.Annotations;
3 |
4 | namespace SQLite.Net.Interop
5 | {
6 | [PublicAPI]
7 | [SuppressMessage("ReSharper", "InconsistentNaming")]
8 | public enum ExtendedResult
9 | {
10 | IOErrorRead = (Result.IOError | (1 << 8)),
11 | IOErrorShortRead = (Result.IOError | (2 << 8)),
12 | IOErrorWrite = (Result.IOError | (3 << 8)),
13 | IOErrorFsync = (Result.IOError | (4 << 8)),
14 | IOErrorDirFSync = (Result.IOError | (5 << 8)),
15 | IOErrorTruncate = (Result.IOError | (6 << 8)),
16 | IOErrorFStat = (Result.IOError | (7 << 8)),
17 | IOErrorUnlock = (Result.IOError | (8 << 8)),
18 | IOErrorRdlock = (Result.IOError | (9 << 8)),
19 | IOErrorDelete = (Result.IOError | (10 << 8)),
20 | IOErrorBlocked = (Result.IOError | (11 << 8)),
21 | IOErrorNoMem = (Result.IOError | (12 << 8)),
22 | IOErrorAccess = (Result.IOError | (13 << 8)),
23 | IOErrorCheckReservedLock = (Result.IOError | (14 << 8)),
24 | IOErrorLock = (Result.IOError | (15 << 8)),
25 | IOErrorClose = (Result.IOError | (16 << 8)),
26 | IOErrorDirClose = (Result.IOError | (17 << 8)),
27 | IOErrorSHMOpen = (Result.IOError | (18 << 8)),
28 | IOErrorSHMSize = (Result.IOError | (19 << 8)),
29 | IOErrorSHMLock = (Result.IOError | (20 << 8)),
30 | IOErrorSHMMap = (Result.IOError | (21 << 8)),
31 | IOErrorSeek = (Result.IOError | (22 << 8)),
32 | IOErrorDeleteNoEnt = (Result.IOError | (23 << 8)),
33 | IOErrorMMap = (Result.IOError | (24 << 8)),
34 | LockedSharedcache = (Result.Locked | (1 << 8)),
35 | BusyRecovery = (Result.Busy | (1 << 8)),
36 | CannottOpenNoTempDir = (Result.CannotOpen | (1 << 8)),
37 | CannotOpenIsDir = (Result.CannotOpen | (2 << 8)),
38 | CannotOpenFullPath = (Result.CannotOpen | (3 << 8)),
39 | CorruptVTab = (Result.Corrupt | (1 << 8)),
40 | ReadonlyRecovery = (Result.ReadOnly | (1 << 8)),
41 | ReadonlyCannotLock = (Result.ReadOnly | (2 << 8)),
42 | ReadonlyRollback = (Result.ReadOnly | (3 << 8)),
43 | AbortRollback = (Result.Abort | (2 << 8)),
44 | ConstraintCheck = (Result.Constraint | (1 << 8)),
45 | ConstraintCommitHook = (Result.Constraint | (2 << 8)),
46 | ConstraintForeignKey = (Result.Constraint | (3 << 8)),
47 | ConstraintFunction = (Result.Constraint | (4 << 8)),
48 | ConstraintNotNull = (Result.Constraint | (5 << 8)),
49 | ConstraintPrimaryKey = (Result.Constraint | (6 << 8)),
50 | ConstraintTrigger = (Result.Constraint | (7 << 8)),
51 | ConstraintUnique = (Result.Constraint | (8 << 8)),
52 | ConstraintVTab = (Result.Constraint | (9 << 8)),
53 | NoticeRecoverWAL = (Result.Notice | (1 << 8)),
54 | NoticeRecoverRollback = (Result.Notice | (2 << 8))
55 | }
56 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/IDbBackupHandle.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2015 Wilson Meier (wilson.meier@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | namespace SQLite.Net.Interop {
24 | public interface IDbBackupHandle {
25 | }
26 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/IDbHandle.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using JetBrains.Annotations;
24 |
25 | namespace SQLite.Net.Interop
26 | {
27 | [PublicAPI]
28 | public interface IDbHandle
29 | {
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/IDbStatement.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using JetBrains.Annotations;
24 |
25 | namespace SQLite.Net.Interop
26 | {
27 | [PublicAPI]
28 | public interface IDbStatement
29 | {
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/IReflectionService.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | using System;
23 | using System.Collections.Generic;
24 | using System.Linq.Expressions;
25 | using System.Reflection;
26 | using JetBrains.Annotations;
27 |
28 | namespace SQLite.Net.Interop
29 | {
30 | [PublicAPI]
31 | public interface IReflectionService
32 | {
33 | IEnumerable GetPublicInstanceProperties(Type mappedType);
34 | object GetMemberValue(object obj, Expression expr, MemberInfo member);
35 | }
36 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/ISQLiteApiExt.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | using System;
23 |
24 | namespace SQLite.Net.Interop
25 | {
26 | public interface ISQLiteApiExt : ISQLiteApi
27 | {
28 | #region Backup
29 |
30 | IDbBackupHandle BackupInit(IDbHandle destHandle, string destName, IDbHandle srcHandle, string srcName);
31 |
32 | Result BackupStep(IDbBackupHandle handle, int pageCount);
33 |
34 | Result BackupFinish(IDbBackupHandle handle);
35 |
36 | int BackupRemaining(IDbBackupHandle handle);
37 |
38 | int BackupPagecount(IDbBackupHandle handle);
39 |
40 | int Sleep(int millis);
41 |
42 | #endregion
43 | }
44 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/ISQLitePlatform.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | using JetBrains.Annotations;
23 |
24 | namespace SQLite.Net.Interop
25 | {
26 | [PublicAPI]
27 | public interface ISQLitePlatform
28 | {
29 | ISQLiteApi SQLiteApi { get; }
30 | IStopwatchFactory StopwatchFactory { get; }
31 | IReflectionService ReflectionService { get; }
32 | IVolatileService VolatileService { get; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/IStopwatch.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | using JetBrains.Annotations;
23 |
24 | namespace SQLite.Net.Interop
25 | {
26 | [PublicAPI]
27 | public interface IStopwatch
28 | {
29 | long ElapsedMilliseconds { get; }
30 | void Stop();
31 | void Reset();
32 | void Start();
33 | }
34 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/IStopwatchFactory.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | using JetBrains.Annotations;
23 |
24 | namespace SQLite.Net.Interop
25 | {
26 | [PublicAPI]
27 | public interface IStopwatchFactory
28 | {
29 | IStopwatch Create();
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/IVolatileService.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 |
22 | using JetBrains.Annotations;
23 |
24 | namespace SQLite.Net.Interop
25 | {
26 | [PublicAPI]
27 | public interface IVolatileService
28 | {
29 | void Write(ref int transactionDepth, int depth);
30 | }
31 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/Result.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 | using JetBrains.Annotations;
3 |
4 | namespace SQLite.Net.Interop
5 | {
6 | [PublicAPI]
7 | [SuppressMessage("ReSharper", "InconsistentNaming")]
8 | public enum Result
9 | {
10 | OK = 0,
11 | Error = 1,
12 | Internal = 2,
13 | Perm = 3,
14 | Abort = 4,
15 | Busy = 5,
16 | Locked = 6,
17 | NoMem = 7,
18 | ReadOnly = 8,
19 | Interrupt = 9,
20 | IOError = 10,
21 | Corrupt = 11,
22 | NotFound = 12,
23 | Full = 13,
24 | CannotOpen = 14,
25 | LockErr = 15,
26 | Empty = 16,
27 | SchemaChngd = 17,
28 | TooBig = 18,
29 | Constraint = 19,
30 | Mismatch = 20,
31 | Misuse = 21,
32 | NotImplementedLFS = 22,
33 | AccessDenied = 23,
34 | Format = 24,
35 | Range = 25,
36 | NonDBFile = 26,
37 | Notice = 27,
38 | Warning = 28,
39 | Row = 100,
40 | Done = 101
41 | }
42 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/Interop/SQLiteOpenFlags.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | //
4 | // Permission is hereby granted, free of charge, to any person obtaining a copy
5 | // of this software and associated documentation files (the "Software"), to deal
6 | // in the Software without restriction, including without limitation the rights
7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | // copies of the Software, and to permit persons to whom the Software is
9 | // furnished to do so, subject to the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included in
12 | // all copies or substantial portions of the Software.
13 | //
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | // THE SOFTWARE.
21 | //
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 |
26 | namespace SQLite.Net.Interop
27 | {
28 | [PublicAPI]
29 | [Flags]
30 | public enum SQLiteOpenFlags
31 | {
32 | ReadOnly = 1,
33 | ReadWrite = 2,
34 | Create = 4,
35 | NoMutex = 0x8000,
36 | FullMutex = 0x10000,
37 | SharedCache = 0x20000,
38 | PrivateCache = 0x40000,
39 | ProtectionComplete = 0x00100000,
40 | ProtectionCompleteUnlessOpen = 0x00200000,
41 | ProtectionCompleteUntilFirstUserAuthentication = 0x00300000,
42 | ProtectionNone = 0x00400000
43 | }
44 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/NotNullConstraintViolationException.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/src/SQLite.Net/NotNullConstraintViolationException.cs
--------------------------------------------------------------------------------
/src/SQLite.Net/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("SQLite.Net")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Øystein Krog")]
12 | [assembly: AssemblyProduct("SQLite.Net")]
13 | [assembly: AssemblyCopyright("Copyright © Øystein Krog, Krueger Systems Inc.")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 | [assembly: InternalsVisibleTo("SQLite.Net.Tests")]
17 | [assembly: InternalsVisibleTo("SQLite.Net.Async")]
--------------------------------------------------------------------------------
/src/SQLite.Net/SQLiteConnectionString.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 | //
23 |
24 | using JetBrains.Annotations;
25 | using SQLite.Net.Interop;
26 |
27 | namespace SQLite.Net
28 | {
29 | ///
30 | /// Represents a parsed connection string.
31 | ///
32 | public class SQLiteConnectionString
33 | {
34 | [PublicAPI]
35 | public SQLiteConnectionString(string databasePath, bool storeDateTimeAsTicks,
36 | IBlobSerializer serializer = null,
37 | IContractResolver resolver = null,
38 | SQLiteOpenFlags? openFlags = null)
39 | {
40 | ConnectionString = databasePath;
41 | StoreDateTimeAsTicks = storeDateTimeAsTicks;
42 |
43 | DatabasePath = databasePath;
44 | Serializer = serializer;
45 | Resolver = resolver ?? ContractResolver.Current;
46 | OpenFlags = openFlags ?? SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create;
47 | }
48 |
49 | [PublicAPI]
50 | public string ConnectionString { get; private set; }
51 |
52 | [PublicAPI]
53 | public string DatabasePath { get; private set; }
54 |
55 | [PublicAPI]
56 | public bool StoreDateTimeAsTicks { get; private set; }
57 |
58 | [PublicAPI]
59 | public IBlobSerializer Serializer { get; private set; }
60 |
61 | [PublicAPI]
62 | public IContractResolver Resolver { get; private set; }
63 |
64 | [PublicAPI]
65 | public SQLiteOpenFlags OpenFlags {get; private set; }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/SQLiteConnectionWithLock.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/src/SQLite.Net/SQLiteConnectionWithLock.cs
--------------------------------------------------------------------------------
/src/SQLite.Net/SQLiteException.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Krueger Systems, Inc.
3 | // Copyright (c) 2013 Øystein Krog (oystein.krog@gmail.com)
4 | //
5 | // Permission is hereby granted, free of charge, to any person obtaining a copy
6 | // of this software and associated documentation files (the "Software"), to deal
7 | // in the Software without restriction, including without limitation the rights
8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | // copies of the Software, and to permit persons to whom the Software is
10 | // furnished to do so, subject to the following conditions:
11 | //
12 | // The above copyright notice and this permission notice shall be included in
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 |
23 | using System;
24 | using JetBrains.Annotations;
25 | using SQLite.Net.Interop;
26 |
27 | namespace SQLite.Net
28 | {
29 | [PublicAPI]
30 | public class SQLiteException : Exception
31 | {
32 | protected SQLiteException(Result r, string message) : base(message)
33 | {
34 | Result = r;
35 | }
36 |
37 | [PublicAPI]
38 | public Result Result { get; private set; }
39 |
40 | [PublicAPI]
41 | public static SQLiteException New(Result r, string message)
42 | {
43 | return new SQLiteException(r, message);
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/src/SQLite.Net/TraceListenerExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 | using JetBrains.Annotations;
3 |
4 | namespace SQLite.Net
5 | {
6 | public static class TraceListenerExtensions
7 | {
8 | [PublicAPI]
9 | public static void WriteLine(this ITraceListener @this, string message)
10 | {
11 | if (@this == null)
12 | {
13 | return;
14 | }
15 |
16 | @this.Receive(message);
17 | }
18 |
19 | [PublicAPI]
20 | public static void WriteLine(this ITraceListener @this, string format, object arg1)
21 | {
22 | if (@this == null)
23 | {
24 | return;
25 | }
26 |
27 | @this.Receive(string.Format(CultureInfo.InvariantCulture, format, arg1));
28 | }
29 |
30 | [PublicAPI]
31 | public static void WriteLine(this ITraceListener @this, string format, object arg1, object arg2)
32 | {
33 | if (@this == null)
34 | {
35 | return;
36 | }
37 |
38 | @this.Receive(string.Format(CultureInfo.InvariantCulture, format, arg1, arg2));
39 | }
40 |
41 | [PublicAPI]
42 | public static void WriteLine(this ITraceListener @this, string format, params object[] args)
43 | {
44 | if (@this == null)
45 | {
46 | return;
47 | }
48 |
49 | @this.Receive(string.Format(CultureInfo.InvariantCulture, format, args));
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/tests/BooleanTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using NUnit.Framework;
4 | using SQLite.Net.Attributes;
5 | using SQLite.Net.Interop;
6 |
7 | namespace SQLite.Net.Tests
8 | {
9 | [TestFixture]
10 | public class BooleanTest
11 | {
12 | public class VO
13 | {
14 | [AutoIncrement, PrimaryKey]
15 | public int ID { get; set; }
16 |
17 | public bool Flag { get; set; }
18 | public String Text { get; set; }
19 |
20 | public override string ToString()
21 | {
22 | return string.Format("VO:: ID:{0} Flag:{1} Text:{2}", ID, Flag, Text);
23 | }
24 | }
25 |
26 | public class DbAcs : SQLiteConnection
27 | {
28 | public DbAcs(ISQLitePlatform sqlitePlatform, String path)
29 | : base(sqlitePlatform, path)
30 | {
31 | TraceListener = DebugTraceListener.Instance;
32 | }
33 |
34 | public void buildTable()
35 | {
36 | CreateTable();
37 | }
38 |
39 | public int CountWithFlag(Boolean flag)
40 | {
41 | SQLiteCommand cmd = CreateCommand("SELECT COUNT(*) FROM VO Where Flag = ?", flag);
42 | return cmd.ExecuteScalar();
43 | }
44 | }
45 |
46 | [Test]
47 | public void TestBoolean()
48 | {
49 | var sqlite3Platform = new SQLitePlatformTest();
50 | string tmpFile = TestPath.CreateTemporaryDatabase();
51 | var db = new DbAcs(sqlite3Platform, tmpFile);
52 | db.buildTable();
53 | for (int i = 0; i < 10; i++)
54 | {
55 | db.Insert(new VO
56 | {
57 | Flag = (i%3 == 0),
58 | Text = String.Format("VO{0}", i)
59 | });
60 | }
61 |
62 | // count vo which flag is true
63 | Assert.AreEqual(4, db.CountWithFlag(true));
64 | Assert.AreEqual(6, db.CountWithFlag(false));
65 |
66 | Debug.WriteLine("VO with true flag:");
67 | foreach (VO vo in db.Query("SELECT * FROM VO Where Flag = ?", true))
68 | {
69 | Debug.WriteLine(vo.ToString());
70 | }
71 |
72 | Debug.WriteLine("VO with false flag:");
73 | foreach (VO vo in db.Query("SELECT * FROM VO Where Flag = ?", false))
74 | {
75 | Debug.WriteLine(vo.ToString());
76 | }
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/tests/DateTimeOffsetTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using SQLite.Net.Async;
3 | using SQLite.Net.Attributes;
4 | using NUnit.Framework;
5 |
6 | namespace SQLite.Net.Tests
7 | {
8 | [TestFixture]
9 | public class DateTimeOffsetTest
10 | {
11 | class TestObj
12 | {
13 | [PrimaryKey, AutoIncrement]
14 | public int Id { get; set; }
15 |
16 | public string Name { get; set; }
17 | public DateTimeOffset ModifiedTime { get; set; }
18 | }
19 |
20 | [Test]
21 | public void AsTicks ()
22 | {
23 | var db = new TestDb ();
24 | TestDateTimeOffset (db);
25 | }
26 |
27 | [Test]
28 | public void AsyncAsTicks ()
29 | {
30 | var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), false);
31 | var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString));
32 | TestAsyncDateTimeOffset (db);
33 | }
34 |
35 | void TestAsyncDateTimeOffset (SQLiteAsyncConnection db)
36 | {
37 | db.CreateTableAsync ().Wait ();
38 |
39 | TestObj o, o2;
40 |
41 | //
42 | // Ticks
43 | //
44 | o = new TestObj {
45 | ModifiedTime = new DateTimeOffset (2012, 1, 14, 3, 2, 1, TimeSpan.Zero),
46 | };
47 | db.InsertAsync (o).Wait ();
48 | o2 = db.GetAsync (o.Id).Result;
49 | Assert.AreEqual (o.ModifiedTime, o2.ModifiedTime);
50 | }
51 |
52 | void TestDateTimeOffset (TestDb db)
53 | {
54 | db.CreateTable ();
55 |
56 | TestObj o, o2;
57 |
58 | //
59 | // Ticks
60 | //
61 | o = new TestObj {
62 | ModifiedTime = new DateTimeOffset (2012, 1, 14, 3, 2, 1, TimeSpan.Zero),
63 | };
64 | db.Insert (o);
65 | o2 = db.Get (o.Id);
66 | Assert.AreEqual (o.ModifiedTime, o2.ModifiedTime);
67 | }
68 |
69 | }
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/tests/DropTableTest.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using SQLite.Net.Attributes;
3 |
4 | namespace SQLite.Net.Tests
5 | {
6 | [TestFixture]
7 | public class DropTableTest
8 | {
9 | public class Product
10 | {
11 | [AutoIncrement, PrimaryKey]
12 | public int Id { get; set; }
13 |
14 | public string Name { get; set; }
15 | public decimal Price { get; set; }
16 | }
17 |
18 | public class TestDb : SQLiteConnection
19 | {
20 | public TestDb() : base(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase())
21 | {
22 | TraceListener = DebugTraceListener.Instance;
23 | }
24 | }
25 |
26 | [Test]
27 | public void CreateInsertDrop()
28 | {
29 | var db = new TestDb();
30 |
31 | db.CreateTable();
32 |
33 | db.Insert(new Product
34 | {
35 | Name = "Hello",
36 | Price = 16,
37 | });
38 |
39 | int n = db.Table().Count();
40 |
41 | Assert.AreEqual(1, n);
42 |
43 | db.DropTable();
44 |
45 | ExceptionAssert.Throws(() => db.Table().Count());
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/tests/EqualsTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using NUnit.Framework;
5 | using SQLite.Net.Attributes;
6 |
7 | namespace SQLite.Net.Tests
8 | {
9 | [TestFixture]
10 | internal class EqualsTest
11 | {
12 | public abstract class TestObjBase
13 | {
14 | [AutoIncrement, PrimaryKey]
15 | public int Id { get; set; }
16 |
17 | public T Data { get; set; }
18 |
19 | public DateTime Date { get; set; }
20 | }
21 |
22 | public class TestObjString : TestObjBase
23 | {
24 | }
25 |
26 | public class TestDb : SQLiteConnection
27 | {
28 | public TestDb(String path)
29 | : base(new SQLitePlatformTest(), path)
30 | {
31 | CreateTable();
32 | }
33 | }
34 |
35 | [Test]
36 | public void CanCompareAnyField()
37 | {
38 | int n = 20;
39 | IEnumerable cq = from i in Enumerable.Range(1, n)
40 | select new TestObjString
41 | {
42 | Data = Convert.ToString(i),
43 | Date = new DateTime(2013, 1, i)
44 | };
45 |
46 | var db = new TestDb(TestPath.CreateTemporaryDatabase());
47 | db.InsertAll(cq);
48 |
49 | TableQuery results = db.Table().Where(o => o.Data.Equals("10"));
50 | Assert.AreEqual(results.Count(), 1);
51 | Assert.AreEqual(results.FirstOrDefault().Data, "10");
52 |
53 | results = db.Table().Where(o => o.Id.Equals(10));
54 | Assert.AreEqual(results.Count(), 1);
55 | Assert.AreEqual(results.FirstOrDefault().Data, "10");
56 |
57 | var date = new DateTime(2013, 1, 10);
58 | results = db.Table().Where(o => o.Date.Equals(date));
59 | Assert.AreEqual(results.Count(), 1);
60 | Assert.AreEqual(results.FirstOrDefault().Data, "10");
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/tests/ExceptionAssert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using NUnit.Framework;
3 |
4 | namespace SQLite.Net.Tests
5 | {
6 | public class ExceptionAssert
7 | {
8 | public static T Throws(Action action) where T : Exception
9 | {
10 | try
11 | {
12 | action();
13 | }
14 | catch (T ex)
15 | {
16 | return ex;
17 | }
18 |
19 | Assert.Fail("Expected exception of type {0}.", typeof (T));
20 |
21 | return null;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/tests/ExpressionTests.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using NUnit.Framework;
3 | using SQLite.Net.Attributes;
4 |
5 | namespace SQLite.Net.Tests
6 | {
7 | [TestFixture]
8 | public class ExpressionTests
9 | {
10 | [Table("AGoodTableName")]
11 | private class TestTable
12 | {
13 | [PrimaryKey]
14 | public int Id { get; set; }
15 |
16 | public string Name { get; set; }
17 | }
18 |
19 |
20 | [Test]
21 | public void ToLower()
22 | {
23 | var db = new TestDb();
24 |
25 | db.CreateTable();
26 | var testTable = new TestTable()
27 | {
28 | Name = "TEST"
29 | };
30 | db.Insert(testTable);
31 |
32 | var x = db.Table().Where(t => t.Name.ToLower() == "test");
33 |
34 | Assert.AreEqual(1, x.Count());
35 | }
36 |
37 | [Test]
38 | public void ToUpper()
39 | {
40 | var db = new TestDb();
41 |
42 | db.CreateTable();
43 | var testTable = new TestTable()
44 | {
45 | Name = "test"
46 | };
47 | db.Insert(testTable);
48 |
49 | var x = db.Table().Where(t => t.Name.ToUpper() == "TEST");
50 |
51 | Assert.AreEqual(1, x.Count());
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/tests/IgnoreTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using NUnit.Framework;
4 | using SQLite.Net.Attributes;
5 | using System;
6 | using System.Reflection;
7 |
8 | namespace SQLite.Net.Tests
9 | {
10 | [TestFixture]
11 | public class IgnoredTest
12 | {
13 | public class DummyClass
14 | {
15 | [PrimaryKey, AutoIncrement]
16 | public int Id { get; set; }
17 |
18 | public string Foo { get; set; }
19 | public string Bar { get; set; }
20 |
21 | [Attributes.Ignore]
22 | public List Ignored { get; set; }
23 | }
24 |
25 | private class TestIgnoreAttribute : Attribute
26 | {
27 | }
28 |
29 | public class TestColumnInformationProvider : IColumnInformationProvider
30 | {
31 | public string GetColumnName(PropertyInfo p)
32 | {
33 | return p.Name;
34 | }
35 |
36 | public bool IsIgnored(PropertyInfo p)
37 | {
38 | return p.IsDefined(typeof (TestIgnoreAttribute), true);
39 | }
40 |
41 | public IEnumerable GetIndices(MemberInfo p)
42 | {
43 | return p.GetCustomAttributes();
44 | }
45 |
46 | public bool IsPK(MemberInfo m)
47 | {
48 | return m.GetCustomAttributes().Any();
49 | }
50 | public string Collation(MemberInfo m)
51 | {
52 | return string.Empty;
53 | }
54 | public bool IsAutoInc(MemberInfo m)
55 | {
56 | return false;
57 | }
58 | public int? MaxStringLength(PropertyInfo p)
59 | {
60 | return null;
61 | }
62 | public object GetDefaultValue(PropertyInfo p)
63 | {
64 | return null;
65 | }
66 | public bool IsMarkedNotNull(MemberInfo p)
67 | {
68 | return false;
69 | }
70 | }
71 |
72 | public abstract class TestObjBase
73 | {
74 | [AutoIncrement, PrimaryKey]
75 | public int Id { get; set; }
76 |
77 | public T Data { get; set; }
78 |
79 | }
80 |
81 | public class TestObjIntWithIgnore : TestObjBase
82 | {
83 | [TestIgnore]
84 | public List Ignored { get; set; }
85 | }
86 |
87 | [Test]
88 | public void NullableFloat()
89 | {
90 | var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase());
91 | // if the Ignored property is not ignore this will cause an exception
92 | db.CreateTable();
93 | }
94 |
95 | [Test]
96 | public void CustomIgnoreAttributeTest()
97 | {
98 | var db = new SQLiteConnection(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase());
99 | db.ColumnInformationProvider = new TestColumnInformationProvider();
100 | // if the Ignored property is not ignore this will cause an exception
101 | db.CreateTable();
102 | db.ColumnInformationProvider = null;
103 | }
104 | }
105 | }
--------------------------------------------------------------------------------
/tests/InheritanceTest.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using SQLite.Net.Attributes;
3 |
4 | namespace SQLite.Net.Tests
5 | {
6 | [TestFixture]
7 | public class InheritanceTest
8 | {
9 | private class Base
10 | {
11 | [PrimaryKey]
12 | public int Id { get; set; }
13 |
14 | public string BaseProp { get; set; }
15 | }
16 |
17 | private class Derived : Base
18 | {
19 | public string DerivedProp { get; set; }
20 | }
21 |
22 |
23 | [Test]
24 | public void InheritanceWorks()
25 | {
26 | var db = new TestDb();
27 |
28 | TableMapping mapping = db.GetMapping();
29 |
30 | Assert.AreEqual(3, mapping.Columns.Length);
31 | Assert.AreEqual("Id", mapping.PK.Name);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/tests/MappingTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using NUnit.Framework;
3 | using SQLite.Net.Attributes;
4 |
5 | namespace SQLite.Net.Tests
6 | {
7 | [TestFixture]
8 | public class MappingTest
9 | {
10 | [Table("AGoodTableName")]
11 | private class AFunnyTableName
12 | {
13 | [PrimaryKey]
14 | public int Id { get; set; }
15 |
16 | [Column("AGoodColumnName")]
17 | public string AFunnyColumnName { get; set; }
18 | }
19 |
20 |
21 | [Table("foo")]
22 | public class Foo
23 | {
24 | [Column("baz")]
25 | public int Bar { get; set; }
26 | }
27 |
28 | [Test]
29 | public void HasGoodNames()
30 | {
31 | var db = new TestDb();
32 |
33 | db.CreateTable();
34 |
35 | TableMapping mapping = db.GetMapping();
36 |
37 | Assert.AreEqual("AGoodTableName", mapping.TableName);
38 |
39 | Assert.AreEqual("Id", mapping.Columns[0].Name);
40 | Assert.AreEqual("AGoodColumnName", mapping.Columns[1].Name);
41 | }
42 |
43 | [Test]
44 | public void Issue86()
45 | {
46 | var db = new TestDb();
47 | db.CreateTable();
48 |
49 | db.Insert(new Foo
50 | {
51 | Bar = 42
52 | });
53 | db.Insert(new Foo
54 | {
55 | Bar = 69
56 | });
57 |
58 | Foo found42 = db.Table().Where(f => f.Bar == 42).FirstOrDefault();
59 | Assert.IsNotNull(found42);
60 |
61 | var ordered = new List(db.Table().OrderByDescending(f => f.Bar));
62 | Assert.AreEqual(2, ordered.Count);
63 | Assert.AreEqual(69, ordered[0].Bar);
64 | Assert.AreEqual(42, ordered[1].Bar);
65 | }
66 |
67 | private class PluralisedTableAttribute : TableAttribute
68 | {
69 | public PluralisedTableAttribute(string name) : base(name + "s")
70 | {
71 | }
72 | }
73 |
74 | [PluralisedTable("Cat")]
75 | public class Cat
76 | {
77 | public string Breed { get; set; }
78 | }
79 |
80 | [Test]
81 | public void CanUseSubtypeOfTableAttribute()
82 | {
83 | var db = new TestDb();
84 | db.CreateTable();
85 |
86 | db.Insert(new Cat()
87 | {
88 | Breed = "Siamese"
89 | });
90 |
91 | int numCats = db.ExecuteScalar("select count(*) from Cats");
92 |
93 | Assert.That(numCats,Is.EqualTo(1), "The resulting num cats should be 1.");
94 | }
95 | }
96 | }
--------------------------------------------------------------------------------
/tests/MigrationTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using NUnit.Framework;
4 | using SQLite.Net.Attributes;
5 |
6 | namespace SQLite.Net.Tests
7 | {
8 | [TestFixture]
9 | public class MigrationTest
10 | {
11 | [Table("Test")]
12 | private class LowerId
13 | {
14 | public int Id { get; set; }
15 | }
16 |
17 | [Table("Test")]
18 | private class UpperId
19 | {
20 | public int ID { get; set; }
21 | }
22 |
23 | [Test]
24 | public void UpperAndLowerColumnNames()
25 | {
26 | using (var db = new TestDb(true)
27 | {
28 | TraceListener = DebugTraceListener.Instance
29 | })
30 | {
31 | db.CreateTable();
32 | db.CreateTable();
33 |
34 | List cols = db.GetTableInfo("Test").ToList();
35 | Assert.That(cols.Count, Is.EqualTo(1));
36 | Assert.That(cols[0].Name, Is.EqualTo("Id"));
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/tests/OpenTests.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Threading.Tasks;
3 | using NUnit.Framework;
4 | using SQLite.Net.Async;
5 |
6 | namespace SQLite.Net.Tests
7 | {
8 | [TestFixture]
9 | public class OpenTest
10 | {
11 | private const string UnicodeText = "\u01F427 \u221E";
12 |
13 | [Test]
14 | public void UnicodePaths()
15 | {
16 | var fileName = TestPath.CreateDefaultTempFilename() + UnicodeText + ".db";
17 | var filePath = TestPath.CreateTemporaryDatabase(fileName);
18 |
19 | using (var db = new SQLiteConnection(new SQLitePlatformTest(), filePath, true))
20 | {
21 | db.CreateTable();
22 | }
23 |
24 | Assert.That(filePath.Length, Is.GreaterThan(0), fileName);
25 | }
26 |
27 | [Test]
28 | public async Task UnicodePathsAsync()
29 | {
30 | var fileName = TestPath.CreateDefaultTempFilename() + UnicodeText + ".db";
31 | var filePath = TestPath.CreateTemporaryDatabase(fileName);
32 |
33 | var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), new SQLiteConnectionString(filePath, true)));
34 | await db.CreateTableAsync();
35 |
36 | Assert.That(filePath.Length, Is.GreaterThan(0), fileName);
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/tests/ReplaceTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using NUnit.Framework;
4 | using SQLite.Net.Attributes;
5 | using SQLite.Net.Interop;
6 |
7 | namespace SQLite.Net.Tests
8 | {
9 | [TestFixture]
10 | public class ReplaceTest
11 | {
12 | public class TestObj
13 | {
14 | [AutoIncrement, PrimaryKey]
15 | public int Id { get; set; }
16 |
17 | public string Name { get; set; }
18 |
19 | public override string ToString()
20 | {
21 | return string.Format("[TestObj: Id={0}, Name={1}]", Id, Name);
22 | }
23 | }
24 |
25 | public class TestDb : SQLiteConnection
26 | {
27 | public TestDb(ISQLitePlatform sqlitePlatform, string path)
28 | : base(sqlitePlatform, path)
29 | {
30 | CreateTable();
31 | }
32 | }
33 |
34 |
35 | [Test]
36 |
37 | public void ReplaceInWhere()
38 | {
39 | string testElement = "Element";
40 | string alternateElement = "Alternate";
41 | string replacedElement = "ReplacedElement";
42 |
43 | int n = 20;
44 | IEnumerable cq = from i in Enumerable.Range(1, n)
45 | select new TestObj
46 | {
47 | Name = (i % 2 == 0) ? testElement : alternateElement
48 | };
49 |
50 | var db = new TestDb(new SQLitePlatformTest(), TestPath.CreateTemporaryDatabase());
51 |
52 | db.InsertAll(cq);
53 |
54 | db.TraceListener = DebugTraceListener.Instance;
55 |
56 |
57 | List result = (from o in db.Table() where o.Name.Replace(testElement, replacedElement) == replacedElement select o).ToList();
58 | Assert.AreEqual(10, result.Count);
59 |
60 | }
61 |
62 | }
63 | }
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.Generic/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 | [assembly: AssemblyTitle ("SQLite.Net.Tests.Mono")]
7 | [assembly: AssemblyDescription ("")]
8 | [assembly: AssemblyConfiguration ("")]
9 | [assembly: AssemblyCompany ("")]
10 | [assembly: AssemblyProduct ("")]
11 | [assembly: AssemblyCopyright ("James Ottaway")]
12 | [assembly: AssemblyTrademark ("")]
13 | [assembly: AssemblyCulture ("")]
14 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
15 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
16 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
17 | [assembly: AssemblyVersion ("1.0.*")]
18 | // The following attributes are used to specify the signing key for the assembly,
19 | // if desired. See the Mono documentation for more information about signing.
20 | //[assembly: AssemblyDelaySign(false)]
21 | //[assembly: AssemblyKeyFile("")]
22 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.Generic/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.OSX/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SQLite.Net.Tests.OSX")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SQLite.Net.Tests.OSX")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("9ca46ef7-2a74-4ca7-8591-b5d4855b982b")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.OSX/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.Win32/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SQLite.Net.Tests.Win32")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SQLite.Net.Tests.Win32")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("9ca46ef7-2a74-4ca7-8591-b5d4855b982b")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.Win32/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WinRT/Images/UnitTestLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WinRT/Images/UnitTestLogo.scale-100.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WinRT/Images/UnitTestSmallLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WinRT/Images/UnitTestSmallLogo.scale-100.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WinRT/Images/UnitTestSplashScreen.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WinRT/Images/UnitTestSplashScreen.scale-100.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WinRT/Images/UnitTestStoreLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WinRT/Images/UnitTestStoreLogo.scale-100.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WinRT/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 | SQLite.Net.Tests.WinRT
10 | Øystein
11 | Images\UnitTestStoreLogo.png
12 | SQLite.Net.Tests.WinRT
13 |
14 |
15 |
16 | 6.3.0
17 | 6.3.0
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
35 |
36 |
37 |
38 |
39 |
42 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WinRT/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SQLite.Net.Tests.WinRT")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SQLite.Net.Tests.WinRT")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WinRT/SQLite.Net.Tests.WinRT_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WinRT/SQLite.Net.Tests.WinRT_TemporaryKey.pfx
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WinRT/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/Assets/AlignmentGrid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WindowsPhone8/Assets/AlignmentGrid.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/Assets/ApplicationIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WindowsPhone8/Assets/ApplicationIcon.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/Assets/Tiles/FlipCycleTileLarge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WindowsPhone8/Assets/Tiles/FlipCycleTileLarge.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/Assets/Tiles/FlipCycleTileMedium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WindowsPhone8/Assets/Tiles/FlipCycleTileMedium.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/Assets/Tiles/FlipCycleTileSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.WindowsPhone8/Assets/Tiles/FlipCycleTileSmall.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/LocalizedStrings.cs:
--------------------------------------------------------------------------------
1 | using SQLite.Net.Tests.WindowsPhone8.Resources;
2 |
3 | namespace SQLite.Net.Tests.WindowsPhone8
4 | {
5 | ///
6 | /// Provides access to string resources.
7 | ///
8 | public class LocalizedStrings
9 | {
10 | private static AppResources _localizedResources = new AppResources();
11 |
12 | public AppResources LocalizedResources { get { return _localizedResources; } }
13 | }
14 | }
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Net;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Navigation;
8 | using Microsoft.Phone.Controls;
9 | using Microsoft.Phone.Shell;
10 | using SQLite.Net.Tests.WindowsPhone8.Resources;
11 | using System.Threading;
12 | using Microsoft.VisualStudio.TestPlatform.Core;
13 | using vstest_executionengine_platformbridge;
14 | using Microsoft.VisualStudio.TestPlatform.TestExecutor;
15 | using System.Reflection;
16 |
17 | namespace SQLite.Net.Tests.WindowsPhone8
18 | {
19 | public partial class MainPage : PhoneApplicationPage
20 | {
21 | // Constructor
22 | public MainPage()
23 | {
24 | InitializeComponent();
25 |
26 | var wrapper = new TestExecutorServiceWrapper();
27 | new Thread(new ServiceMain((param0, param1) => wrapper.SendMessage((ContractName)param0, param1)).Run).Start();
28 |
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/Properties/AppManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using System.Resources;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("SQLite.Net.Tests.WindowsPhone8")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("SQLite.Net.Tests.WindowsPhone8")]
14 | [assembly: AssemblyCopyright("Copyright © 2014")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("d45b5167-efa6-496a-92cb-975438814621")]
25 |
26 | // Version information for an assembly consists of the following four values:
27 | //
28 | // Major Version
29 | // Minor Version
30 | // Build Number
31 | // Revision
32 | //
33 | // You can specify all the values or you can default the Revision and Build Numbers
34 | // by using the '*' as shown below:
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 | [assembly: NeutralResourcesLanguageAttribute("en-US")]
38 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/Properties/WMAppManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Assets\ApplicationIcon.png
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Assets\Tiles\FlipCycleTileSmall.png
21 | 0
22 | Assets\Tiles\FlipCycleTileMedium.png
23 | SQLite.Net.Tests.WindowsPhone8
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | vstest_executionengine_platformbridge.dll
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.WindowsPhone8/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinAndroid/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with your package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
20 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinAndroid/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using Android.App;
3 | using Android.OS;
4 | using Xamarin.Android.NUnitLite;
5 |
6 | namespace SQLite.Net.Tests.XamarinAndroid
7 | {
8 | [Activity (Label = "SQLite.Net.Tests.XamarinAndroid", MainLauncher = true)]
9 | public class MainActivity : TestSuiteActivity
10 | {
11 | protected override void OnCreate (Bundle bundle)
12 | {
13 | // tests can be inside the main assembly
14 | AddTest (Assembly.GetExecutingAssembly ());
15 | // or in any reference assemblies
16 | // AddTest (typeof (Your.Library.TestClass).Assembly);
17 |
18 | // Once you called base.OnCreate(), you cannot add more assemblies.
19 | base.OnCreate (bundle);
20 | }
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinAndroid/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinAndroid/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using Android.App;
4 |
5 | // Information about this assembly is defined by the following attributes.
6 | // Change them to the values specific to your project.
7 | [assembly: AssemblyTitle ("SQLite.Net.Tests.XamarinAndroid")]
8 | [assembly: AssemblyDescription ("")]
9 | [assembly: AssemblyConfiguration ("")]
10 | [assembly: AssemblyCompany ("")]
11 | [assembly: AssemblyProduct ("")]
12 | [assembly: AssemblyCopyright ("Øystein")]
13 | [assembly: AssemblyTrademark ("")]
14 | [assembly: AssemblyCulture ("")]
15 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
16 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
17 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
18 | [assembly: AssemblyVersion ("1.0.0")]
19 | // The following attributes are used to specify the signing key for the assembly,
20 | // if desired. See the Mono documentation for more information about signing.
21 | //[assembly: AssemblyDelaySign(false)]
22 | //[assembly: AssemblyKeyFile("")]
23 |
24 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinAndroid/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.axml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable/
12 | icon.png
13 |
14 | layout/
15 | main.axml
16 |
17 | values/
18 | strings.xml
19 |
20 | In order to get the build system to recognize Android resources, set the build action to
21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
22 | instead operate on resource IDs. When you compile an Android application that uses resources,
23 | the build system will package the resources for distribution and generate a class called "R"
24 | (this is an Android convention) that contains the tokens for each one of the resources
25 | included. For example, for the above Resources layout, this is what the R class would expose:
26 |
27 | public class R {
28 | public class drawable {
29 | public const int icon = 0x123;
30 | }
31 |
32 | public class layout {
33 | public const int main = 0x456;
34 | }
35 |
36 | public class strings {
37 | public const int first_string = 0xabc;
38 | public const int second_string = 0xbcd;
39 | }
40 | }
41 |
42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first
44 | string in the dictionary file values/strings.xml.
45 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinAndroid/Resources/drawable/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.XamarinAndroid/Resources/drawable/Icon.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinAndroid/TestsSample.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using NUnit.Framework;
3 |
4 | namespace SQLite.Net.Tests.XamarinAndroid
5 | {
6 | [TestFixture]
7 | public class TestsSample
8 | {
9 | [SetUp]
10 | public void Setup ()
11 | {
12 | }
13 |
14 | [TearDown]
15 | public void Tear ()
16 | {
17 | }
18 |
19 | [Test]
20 | public void Pass ()
21 | {
22 | Console.WriteLine ("test1");
23 | Assert.True (true);
24 | }
25 |
26 | [Test]
27 | public void Fail ()
28 | {
29 | Assert.False (true);
30 | }
31 |
32 | [Test]
33 | [Ignore ("another time")]
34 | public void Ignore ()
35 | {
36 | Assert.True (false);
37 | }
38 |
39 | [Test]
40 | public void Inconclusive ()
41 | {
42 | Assert.Inconclusive ("Inconclusive");
43 | }
44 | }
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinAndroid/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS.Unified/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 | using MonoTouch.NUnit.UI;
8 |
9 | namespace SQLite.Net.Tests.XamarinIOS.Unified
10 | {
11 | // The UIApplicationDelegate for the application. This class is responsible for launching the
12 | // User Interface of the application, as well as listening (and optionally responding) to
13 | // application events from iOS.
14 | [Register ("AppDelegate")]
15 | public partial class AppDelegate : UIApplicationDelegate
16 | {
17 | // class-level declarations
18 | UIWindow window;
19 | TouchRunner runner;
20 |
21 | //
22 | // This method is invoked when the application has loaded and is ready to run. In this
23 | // method you should instantiate the window, load the UI into it and then make the window
24 | // visible.
25 | //
26 | // You have 17 seconds to return from this method, or iOS will terminate your application.
27 | //
28 | public override bool FinishedLaunching (UIApplication app, NSDictionary options)
29 | {
30 | window = new UIWindow(UIScreen.MainScreen.Bounds);
31 | runner = new TouchRunner(window);
32 |
33 | // register every tests included in the main application/assembly
34 | runner.Add(System.Reflection.Assembly.GetExecutingAssembly());
35 |
36 | window.RootViewController = new UINavigationController(runner.GetViewController());
37 |
38 | // make the window visible
39 | window.MakeKeyAndVisible();
40 |
41 | return true;
42 | }
43 | }
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS.Unified/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDisplayName
6 | SQLite.Net.Tests.XamarinIOS.Unified
7 | CFBundleIdentifier
8 | SQLite.Net.Tests.XamarinIOS.Unified
9 | LSRequiresIPhoneOS
10 |
11 | MinimumOSVersion
12 | 6.0
13 | UIDeviceFamily
14 |
15 | 1
16 | 2
17 |
18 | UILaunchStoryboardName
19 | LaunchScreen
20 | UIRequiredDeviceCapabilities
21 |
22 | armv7
23 |
24 | UISupportedInterfaceOrientations
25 |
26 | UIInterfaceOrientationPortrait
27 | UIInterfaceOrientationLandscapeLeft
28 | UIInterfaceOrientationLandscapeRight
29 |
30 | UISupportedInterfaceOrientations~ipad
31 |
32 | UIInterfaceOrientationPortrait
33 | UIInterfaceOrientationPortraitUpsideDown
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | XSAppIconAssets
38 | Resources/Images.xcassets/AppIcons.appiconset
39 |
40 |
41 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS.Unified/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 |
8 | namespace SQLite.Net.Tests.XamarinIOS.Unified
9 | {
10 | public class Application
11 | {
12 | // This is the main entry point of the application.
13 | static void Main (string[] args)
14 | {
15 | // if you want to use a different Application Delegate class from "AppDelegate"
16 | // you can specify it here.
17 | UIApplication.Main (args, null, "AppDelegate");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS.Unified/Resources/Images.xcassets/AppIcons.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "size": "29x29",
5 | "scale": "1x",
6 | "idiom": "iphone"
7 | },
8 | {
9 | "size": "29x29",
10 | "scale": "2x",
11 | "idiom": "iphone"
12 | },
13 | {
14 | "size": "29x29",
15 | "scale": "3x",
16 | "idiom": "iphone"
17 | },
18 | {
19 | "size": "40x40",
20 | "scale": "2x",
21 | "idiom": "iphone"
22 | },
23 | {
24 | "size": "40x40",
25 | "scale": "3x",
26 | "idiom": "iphone"
27 | },
28 | {
29 | "size": "57x57",
30 | "scale": "1x",
31 | "idiom": "iphone"
32 | },
33 | {
34 | "size": "57x57",
35 | "scale": "2x",
36 | "idiom": "iphone"
37 | },
38 | {
39 | "size": "60x60",
40 | "scale": "2x",
41 | "idiom": "iphone"
42 | },
43 | {
44 | "size": "60x60",
45 | "scale": "3x",
46 | "idiom": "iphone"
47 | },
48 | {
49 | "size": "29x29",
50 | "scale": "1x",
51 | "idiom": "ipad"
52 | },
53 | {
54 | "size": "29x29",
55 | "scale": "2x",
56 | "idiom": "ipad"
57 | },
58 | {
59 | "size": "40x40",
60 | "scale": "1x",
61 | "idiom": "ipad"
62 | },
63 | {
64 | "size": "40x40",
65 | "scale": "2x",
66 | "idiom": "ipad"
67 | },
68 | {
69 | "size": "50x50",
70 | "scale": "1x",
71 | "idiom": "ipad"
72 | },
73 | {
74 | "size": "50x50",
75 | "scale": "2x",
76 | "idiom": "ipad"
77 | },
78 | {
79 | "size": "72x72",
80 | "scale": "1x",
81 | "idiom": "ipad"
82 | },
83 | {
84 | "size": "72x72",
85 | "scale": "2x",
86 | "idiom": "ipad"
87 | },
88 | {
89 | "size": "76x76",
90 | "scale": "1x",
91 | "idiom": "ipad"
92 | },
93 | {
94 | "size": "76x76",
95 | "scale": "2x",
96 | "idiom": "ipad"
97 | },
98 | {
99 | "size": "120x120",
100 | "scale": "1x",
101 | "idiom": "car"
102 | }
103 | ],
104 | "info": {
105 | "version": 1,
106 | "author": "xcode"
107 | }
108 | }
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS.Unified/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using MonoTouch.Foundation;
6 | using MonoTouch.UIKit;
7 | using MonoTouch.NUnit.UI;
8 |
9 | namespace SQLite.Net.Tests.XamarinIOS
10 | {
11 | // The UIApplicationDelegate for the application. This class is responsible for launching the
12 | // User Interface of the application, as well as listening (and optionally responding) to
13 | // application events from iOS.
14 | [Register("AppDelegate")]
15 | public partial class AppDelegate : UIApplicationDelegate
16 | {
17 | // class-level declarations
18 | UIWindow window;
19 | TouchRunner runner;
20 |
21 | //
22 | // This method is invoked when the application has loaded and is ready to run. In this
23 | // method you should instantiate the window, load the UI into it and then make the window
24 | // visible.
25 | //
26 | // You have 17 seconds to return from this method, or iOS will terminate your application.
27 | //
28 | public override bool FinishedLaunching(UIApplication app, NSDictionary options)
29 | {
30 | // create a new window instance based on the screen size
31 | window = new UIWindow(UIScreen.MainScreen.Bounds);
32 | runner = new TouchRunner(window);
33 |
34 | // register every tests included in the main application/assembly
35 | runner.Add(System.Reflection.Assembly.GetExecutingAssembly());
36 |
37 | window.RootViewController = new UINavigationController(runner.GetViewController());
38 |
39 | // make the window visible
40 | window.MakeKeyAndVisible();
41 |
42 | return true;
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIDeviceFamily
6 |
7 | 1
8 | 2
9 |
10 | UISupportedInterfaceOrientations
11 |
12 | UIInterfaceOrientationPortrait
13 | UIInterfaceOrientationLandscapeLeft
14 | UIInterfaceOrientationLandscapeRight
15 |
16 | UISupportedInterfaceOrientations~ipad
17 |
18 | MinimumOSVersion
19 | 6.0
20 | CFBundleDisplayName
21 | SQLite.Net.Tests.XamarinIOS
22 | CFBundleIdentifier
23 | SQLite.Net.Tests.XamarinIOS
24 | CFBundleVersion
25 |
26 | NSMainNibFile
27 |
28 | NSMainNibFile~ipad
29 |
30 | CFBundleIconFiles
31 |
32 | Default.png
33 | Default@2x.png
34 | Default-568h@2x.png
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using MonoTouch.Foundation;
6 | using MonoTouch.UIKit;
7 |
8 | namespace SQLite.Net.Tests.XamarinIOS
9 | {
10 | public class Application
11 | {
12 | // This is the main entry point of the application.
13 | static void Main(string[] args)
14 | {
15 | // if you want to use a different Application Delegate class from "AppDelegate"
16 | // you can specify it here.
17 | UIApplication.Main(args, null, "AppDelegate");
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("SQLite.Net.Tests.XamarinIOS")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SQLite.Net.Tests.XamarinIOS")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("2a5fa896-43b9-4ecb-89fa-bffd2ef24202")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.XamarinIOS/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS/Resources/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.XamarinIOS/Resources/Default.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS/Resources/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oysteinkrog/SQLite.Net-PCL/61a4a0c21997adcc12fc0d5500896084a6c0880e/tests/SQLite.Net.Tests.XamarinIOS/Resources/Default@2x.png
--------------------------------------------------------------------------------
/tests/SQLite.Net.Tests.XamarinIOS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/SQLitePlatformTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | #if __WIN32__
8 | using _SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32;
9 | #elif WINDOWS_PHONE
10 | using _SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8;
11 | #elif __WINRT__
12 | using _SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT;
13 | #elif __IOS__
14 | using _SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS;
15 | #elif __ANDROID__
16 | using _SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid;
17 | #elif __OSX__
18 | using _SQLitePlatformTest = SQLite.Net.Platform.OSX.SQLitePlatformOSX;
19 | #else
20 | using _SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric;
21 | #endif
22 |
23 | // ReSharper disable once CheckNamespace
24 | namespace SQLite.Net.Tests
25 | {
26 | public class SQLitePlatformTest : _SQLitePlatformTest
27 | {
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tests/ScalarTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using NUnit.Framework;
4 | using SQLite.Net.Attributes;
5 |
6 | namespace SQLite.Net.Tests
7 | {
8 | [TestFixture]
9 | public class ScalarTest
10 | {
11 | private class TestTable
12 | {
13 | [PrimaryKey, AutoIncrement]
14 | public int Id { get; set; }
15 |
16 | public int Two { get; set; }
17 | }
18 |
19 | private const int Count = 100;
20 |
21 | private SQLiteConnection CreateDb()
22 | {
23 | var db = new TestDb();
24 | db.CreateTable();
25 | IEnumerable items = from i in Enumerable.Range(0, Count)
26 | select new TestTable
27 | {
28 | Two = 2
29 | };
30 | db.InsertAll(items);
31 | Assert.AreEqual(Count, db.Table().Count());
32 | return db;
33 | }
34 |
35 |
36 | [Test]
37 | public void Int32()
38 | {
39 | SQLiteConnection db = CreateDb();
40 |
41 | var r = db.ExecuteScalar("SELECT SUM(Two) FROM TestTable");
42 |
43 | Assert.AreEqual(Count*2, r);
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/tests/SelectTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 | using NUnit.Framework;
8 | using SQLite.Net.Async;
9 | using SQLite.Net.Attributes;
10 |
11 | namespace SQLite.Net.Tests
12 | {
13 |
14 |
15 | ///
16 | /// Defines tests that exercise async behaviour.
17 | ///
18 | [TestFixture]
19 | public class SelectTest
20 | {
21 | public class TestObj
22 | {
23 | [AutoIncrement, PrimaryKey]
24 | public int Id { get; set; }
25 |
26 | public int Order { get; set; }
27 |
28 | public override string ToString()
29 | {
30 | return string.Format("[TestObj: Id={0}, Order={1}]", Id, Order);
31 | }
32 | }
33 |
34 | public class TestDb : SQLiteConnection
35 | {
36 | public TestDb(String path)
37 | : base(new SQLitePlatformTest(), path)
38 | {
39 | CreateTable();
40 | }
41 | }
42 |
43 | [Test]
44 | public void SelectWorks()
45 | {
46 | using (var db = new TestDb(TestPath.CreateTemporaryDatabase()))
47 | {
48 | db.Insert(new TestObj() {Order = 5});
49 | try
50 | {
51 | Assert.That(db.Table().Select(obj => obj.Order * 2).First(), Is.EqualTo(10));
52 | }
53 | catch (NotImplementedException)
54 | {
55 | //Allow Not implemented exceptions as the selection may be too complex.
56 | }
57 | }
58 |
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/tests/StringQueryTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using NUnit.Framework;
4 |
5 | namespace SQLite.Net.Tests
6 | {
7 | [TestFixture]
8 | public class StringQueryTest
9 | {
10 | [SetUp]
11 | public void SetUp()
12 | {
13 | db = new TestDb();
14 | db.CreateTable();
15 |
16 | var prods = new[]
17 | {
18 | new Product
19 | {
20 | Name = "Foo"
21 | },
22 | new Product
23 | {
24 | Name = "Bar"
25 | },
26 | new Product
27 | {
28 | Name = "Foobar"
29 | }
30 | };
31 |
32 | db.InsertAll(prods);
33 | }
34 |
35 | private TestDb db;
36 |
37 | [Test]
38 | public void Contains()
39 | {
40 | List fs = db.Table().Where(x => x.Name.Contains("o")).ToList();
41 | Assert.AreEqual(2, fs.Count);
42 |
43 | List bs = db.Table().Where(x => x.Name.Contains("a")).ToList();
44 | Assert.AreEqual(2, bs.Count);
45 | }
46 |
47 | [Test]
48 | public void EndsWith()
49 | {
50 | List fs = db.Table().Where(x => x.Name.EndsWith("ar")).ToList();
51 | Assert.AreEqual(2, fs.Count);
52 |
53 | List bs = db.Table().Where(x => x.Name.EndsWith("o")).ToList();
54 | Assert.AreEqual(1, bs.Count);
55 | }
56 |
57 | [Test]
58 | public void StartsWith()
59 | {
60 | List fs = db.Table().Where(x => x.Name.StartsWith("F")).ToList();
61 | Assert.AreEqual(2, fs.Count);
62 |
63 | List bs = db.Table().Where(x => x.Name.StartsWith("B")).ToList();
64 | Assert.AreEqual(1, bs.Count);
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/tests/TimeSpanTest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using NUnit.Framework;
4 | using SQLite.Net.Async;
5 | using SQLite.Net.Attributes;
6 |
7 | #if __WIN32__
8 | using SQLitePlatformTest = SQLite.Net.Platform.Win32.SQLitePlatformWin32;
9 | #elif WINDOWS_PHONE
10 | using SQLitePlatformTest = SQLite.Net.Platform.WindowsPhone8.SQLitePlatformWP8;
11 | #elif __WINRT__
12 | using SQLitePlatformTest = SQLite.Net.Platform.WinRT.SQLitePlatformWinRT;
13 | #elif __IOS__
14 | using SQLitePlatformTest = SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS;
15 | #elif __ANDROID__
16 | using SQLitePlatformTest = SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid;
17 | #elif __OSX__
18 | using SQLitePlatformTest = SQLite.Net.Platform.OSX.SQLitePlatformOSX;
19 | #else
20 | using SQLitePlatformTest = SQLite.Net.Platform.Generic.SQLitePlatformGeneric;
21 | #endif
22 |
23 |
24 | namespace SQLite.Net.Tests
25 | {
26 | [TestFixture]
27 | public class TimeSpanTest
28 | {
29 | private class TestDb
30 | {
31 | [PrimaryKey, AutoIncrement]
32 | public int Id { get; set; }
33 |
34 | public TimeSpan Time { get; set; }
35 | }
36 |
37 |
38 | private async Task TestAsyncDateTime(SQLiteAsyncConnection db)
39 | {
40 | await db.CreateTableAsync();
41 |
42 | var val1 = new TestDb
43 | {
44 | Time = new TimeSpan(1000),
45 | };
46 | await db.InsertAsync(val1);
47 | TestDb val2 = await db.GetAsync(val1.Id);
48 | Assert.AreEqual(val1.Time, val2.Time);
49 | }
50 |
51 | [Test]
52 | public async Task TestTimeSpan()
53 | {
54 | var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), true);
55 | var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString));
56 | await TestAsyncDateTime(db);
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/tests/UnicodeTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using NUnit.Framework;
4 | using SQLite.Net.Attributes;
5 |
6 | namespace SQLite.Net.Tests
7 | {
8 | [TestFixture]
9 | public class UnicodeTest
10 | {
11 | [Table("\u7523\u54C1")]
12 | public class UnicodeProduct
13 | {
14 | [AutoIncrement, PrimaryKey, Column("\u6A19\u8B58")]
15 | public int Id { get; set; }
16 |
17 | [Column("\u540D")]
18 | public string Name { get; set; }
19 |
20 | [Column("\u5024")]
21 | public decimal Price { get; set; }
22 |
23 | [Column("\u53CE\u76CA")]
24 | public uint TotalSales { get; set; }
25 | }
26 |
27 | [Test]
28 | public void Insert()
29 | {
30 | var db = new TestDb();
31 |
32 | db.CreateTable();
33 |
34 | string testString = "\u2329\u221E\u232A";
35 |
36 | db.Insert(new UnicodeProduct
37 | {
38 | Name = testString,
39 | });
40 |
41 | var p = db.Get(1);
42 |
43 | Assert.AreEqual(testString, p.Name);
44 | }
45 |
46 | [Test]
47 | public void Query()
48 | {
49 | var db = new TestDb();
50 |
51 | db.CreateTable();
52 |
53 | string testString = "\u2329\u221E\u232A";
54 |
55 | db.Insert(new UnicodeProduct
56 | {
57 | Name = testString,
58 | });
59 |
60 | var ps = (from p in db.Table() where p.Name == testString select p).ToList();
61 |
62 | Assert.AreEqual(1, ps.Count);
63 | Assert.AreEqual(testString, ps[0].Name);
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------