Skip to content
Closed

V1 #1

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
460 commits
Select commit Hold shift + click to select a range
2df530a
Fix querying interfaces
praeclarum Aug 1, 2017
0039925
Only use sqlite3_close_v2 if it is supported
praeclarum Aug 1, 2017
68767da
Add tool to diff the async api
praeclarum Aug 1, 2017
cce26c1
Add Delete async functions
praeclarum Aug 1, 2017
e8b4e75
Make API diff output GFM
praeclarum Aug 1, 2017
d0a6d3e
Add `Close` to async connections
praeclarum Aug 2, 2017
1bd11c9
Add async connection properties
praeclarum Aug 2, 2017
864fffd
Add async query functions
praeclarum Aug 2, 2017
0829d44
Add async update methods
praeclarum Aug 2, 2017
3db31a0
Add async CreateTables and CreateIndex overloads
praeclarum Aug 2, 2017
afb8590
Refactor async database locking code
praeclarum Aug 2, 2017
d215bf8
Add .editorconfig
praeclarum Aug 2, 2017
1c4977c
Add space around method params/args
praeclarum Aug 2, 2017
a3b30b0
Change white space to match .editorconfig
praeclarum Aug 2, 2017
5bc7d66
Bump SQLitePCLRaw to 1.1.7 to fix macOS
praeclarum Aug 2, 2017
786ee04
Update Profile 259 nuget lib path
praeclarum Aug 2, 2017
0b08550
Bump the version to 1.5
praeclarum Aug 2, 2017
feead3c
Add API diff to tests
praeclarum Aug 2, 2017
a98925b
Add AsyncConnection documentation comments
praeclarum Aug 2, 2017
4e04161
Fix API diff test
praeclarum Aug 2, 2017
3265138
Add query ToList and ToArray implementations
praeclarum Aug 2, 2017
1bc15f5
Refactor db access code in async queries
praeclarum Aug 2, 2017
3c1a4ac
Fully disable Joins test
praeclarum Aug 2, 2017
49a0537
Add missing async query methods
praeclarum Aug 2, 2017
0735ca4
Fix query Delete to use the query Where clause
praeclarum Aug 2, 2017
d96e30f
Fix the return value of CreateTable
praeclarum Aug 3, 2017
3d1ffc1
Add CreateFlags doc comments
praeclarum Aug 3, 2017
8988f25
Add test for scalar queries with 1 row
praeclarum Aug 3, 2017
9209ea9
Improve the doc comments for CreateFlags
praeclarum Aug 3, 2017
4d5167c
Add doc comments to CollationAttribute
praeclarum Aug 3, 2017
4cb1296
Improve doc comments for Insert
praeclarum Aug 3, 2017
20ad278
Switch to using ListDiff nuget
praeclarum Aug 4, 2017
1158308
Add SQLite-net-base project
praeclarum Aug 4, 2017
46310ce
Add Base nuspec
praeclarum Aug 4, 2017
18ba21c
Generate debug symbols and XML for base nugets
praeclarum Aug 4, 2017
b4bc62f
Retitle the Base package
praeclarum Aug 5, 2017
6c78cbf
Fix nuget deps for base package
praeclarum Aug 5, 2017
7df294f
Merge pull request #596 from praeclarum/add-base
praeclarum Aug 5, 2017
c969ade
Change Close() to be CloseAsync()
praeclarum Aug 5, 2017
5356727
Use absolute paths in README Examples
praeclarum Aug 11, 2017
6451a52
When in full mutex, Writing reading lo longer locks, Default to full …
Clancey Aug 11, 2017
fb9e72a
Added locking Table Creation
Clancey Aug 11, 2017
841427a
Added WAL Support
Clancey Aug 11, 2017
5476d98
Made the ReadAsync, non locking instead of Write
Clancey Aug 11, 2017
ccd849c
Removed blocking CreateTables from async
Clancey Aug 11, 2017
d2b144c
Move prepared inserts out of mapping
praeclarum Aug 12, 2017
280d4ba
Share table mappings and make thread safe
praeclarum Aug 12, 2017
d1fa883
Switch to using custom ToList in First impls
praeclarum Aug 12, 2017
4fabb22
Fix identifier escaping used in the query example
praeclarum Aug 12, 2017
a206cf8
Fix preserving ColumnInfo on iOS and Android with linker
praeclarum Aug 12, 2017
8c72783
Switch to versioning in the CI
praeclarum Aug 12, 2017
44f2c5f
Rename iOS Test so that Instruments works
praeclarum Aug 12, 2017
689ee77
Add String.Replace handling in linq queries
praeclarum Aug 12, 2017
320f16b
Fixes #492: Create temporary on-disk database by specificing empty st…
MKuckert Aug 12, 2017
c471c42
#595: Implements specifying WithoutRowId on the TableAttribute to cre…
MKuckert Aug 12, 2017
e8849bf
Support enums with repeated values
praeclarum Aug 12, 2017
5b2084c
Merge pull request #607 from MKuckert/fix/492
praeclarum Aug 12, 2017
a3b906b
Merge pull request #608 from MKuckert/fix/595
praeclarum Aug 12, 2017
5c9a41f
Make DeferredQuery docs clearer
praeclarum Aug 12, 2017
24c0ce1
Add sqlite-net-sqlcipher nuget package and project
praeclarum Aug 13, 2017
bb5eee3
Test enums defined as bytes
praeclarum Aug 13, 2017
dbe79d6
Add SetKey to connection to support SQLCipher
praeclarum Aug 13, 2017
75926db
Changed naming around the mutex connection.
Clancey Aug 13, 2017
5a9fbeb
Log errors when stress test fails
praeclarum Aug 13, 2017
c7837ce
Merge pull request #505 from Clancey/master
praeclarum Aug 13, 2017
49a42b1
Added Uri, UriBuilder and StringBuilder support
xperiandri Aug 14, 2017
153052e
Merge pull request #611 from xperiandri/uri_support
praeclarum Aug 14, 2017
19ff613
Updated .gitignore to modern set
xperiandri Aug 14, 2017
33a5b68
Merge pull request #612 from xperiandri/modern_gitignore
praeclarum Aug 15, 2017
d9fae5b
Remove debug info from nuget release builds
praeclarum Aug 16, 2017
62c620f
Rollback transactions if the commit/release fails
praeclarum Aug 16, 2017
786f940
Add test to make sure async transaction failures rollback
praeclarum Aug 16, 2017
32ef5e6
according to this article : https://blogs.msdn.microsoft.com/pfxteam/…
FatJohn Aug 17, 2017
405faf1
allow comparison with nullable parameter
kicsiede Aug 20, 2017
de7afe9
Merge pull request #617 from FatJohn/master
praeclarum Aug 24, 2017
5603ee0
Merge pull request #618 from kicsiede/master
praeclarum Aug 24, 2017
3f96368
Fix brace placement
praeclarum Sep 10, 2018
38233f3
Fix build badge
praeclarum Sep 10, 2018
a594109
Add sqlcipher nuspce to sln
praeclarum Sep 10, 2018
65fe573
Add nuget badges
praeclarum Sep 10, 2018
c360ae6
Require encryption keys to be passed to constructors
praeclarum Sep 10, 2018
864f5a7
Fix nuget output dir
praeclarum Sep 10, 2018
3cff559
Bump SQLitePCLRaw to 1.1.11
praeclarum Sep 10, 2018
51c2876
Make SQLiteCommands inheritable
praeclarum Sep 10, 2018
b6a2feb
Bump SQLitePCLRaw to 1.1.11 in sqlcipher
praeclarum Sep 10, 2018
7bc8792
Support for VFS
heyzooi Sep 12, 2018
49b3cf0
When using ExecuteScalar<T>() with value types, no NULL values can be…
Andreas0xffff Sep 13, 2018
c266c7c
changing the zVfs parameter to be string
heyzooi Sep 13, 2018
eb69e79
adding support for Nuget Build Packaging
heyzooi Oct 15, 2018
9304003
Adjustments to constructor for keyed SQLCipher databases
sjlombardo Nov 8, 2018
2d896bb
Merge pull request #775 from sqlcipher/master
praeclarum Jan 23, 2019
3a309a3
Merge pull request #754 from Andreas0xffff/master
praeclarum Jan 23, 2019
4682880
Merge branch 'support-for-vfs' of git://github.com/heyzooi/sqlite-net…
praeclarum Jan 23, 2019
ce1cabb
Make tests not require encryption
praeclarum Jan 23, 2019
6735547
Merge branch 'heyzooi-support-for-vfs'
praeclarum Jan 23, 2019
31db83e
Add old constructors back
praeclarum Jan 23, 2019
dc72259
Fix closing the async read connection
praeclarum Jan 23, 2019
1052684
Fix NRE when closing an unwritten async database
praeclarum Jan 23, 2019
27129b0
Add all construction options to ConnectionString
praeclarum Jan 23, 2019
88c1a44
Make Async ctor match sync
praeclarum Jan 23, 2019
73fd3b3
Add Backup function
praeclarum Jan 23, 2019
60d89fb
Don't use separate read connections for memory dbs
praeclarum Jan 24, 2019
488ea78
Bump Raw to 1.1.12
praeclarum Jan 24, 2019
c647ee9
Make WAL opt-in
praeclarum Jan 24, 2019
fefb55f
Add test for nullable DateTime
praeclarum Jan 24, 2019
754984e
Fix README code samples
praeclarum Jan 24, 2019
af593de
Fix caps
praeclarum Jan 24, 2019
94ab648
Add Query test
praeclarum Jan 24, 2019
7135fbd
Fix Query test namespace
praeclarum Jan 24, 2019
29df553
Document manual SQL
praeclarum Jan 24, 2019
7ab3b06
Fix language
praeclarum Jan 24, 2019
b7fac6a
Bump to Raw 1.1.13
praeclarum Jan 24, 2019
4b16716
Update install instructions
praeclarum Jan 24, 2019
738099f
Rename license file
praeclarum Jan 25, 2019
c71554f
Remove license file ext
praeclarum Jan 25, 2019
3753c10
Cleanup license
praeclarum Jan 25, 2019
140fc2e
Remove key constructor
praeclarum Jan 25, 2019
efd63a2
Fix handling of FullMutex connections
praeclarum Jan 25, 2019
ca1c06b
Make pooled connections weak
praeclarum Jan 25, 2019
91c17ad
Differentiate pooled connections by their OpenFlags
praeclarum Jan 25, 2019
2c2362f
Typo fix
mallibone Jul 5, 2019
2e7e4bc
The right way to do prepared statements
Pythians Jul 20, 2019
52eb23c
Fix to #761, preventing incorrect disposed command object
ElteHupkes Aug 29, 2019
3826756
Adding a regression test for #761
ElteHupkes Aug 29, 2019
345e57e
Allow custom DateTime string format
gtbX Sep 10, 2019
266f16c
Simplify TestDb ctor
gtbX Sep 10, 2019
78cd2cd
DateTimeTest formatting
gtbX Sep 10, 2019
cf41ec3
Allow storing TimeSpans as strings (default to ticks)
gtbX Sep 10, 2019
8649a68
Drop unused arg from ctor
gtbX Sep 11, 2019
20aa06f
Fix Tests
praeclarum Sep 20, 2019
cf7652e
Merge pull request #866 from ElteHupkes/fix-insert-nre-761
praeclarum Sep 20, 2019
1454c82
Merge pull request #849 from mallibone/patch-1
praeclarum Sep 20, 2019
9f7c08c
Merge pull request #869 from perfectco/custom-datetime
praeclarum Sep 20, 2019
ffef983
Scaffold build script
praeclarum Sep 20, 2019
3314490
Add DateFormat to async conneciton
praeclarum Sep 20, 2019
fb0706d
Merge pull request #871 from praeclarum/ghbuild
praeclarum Sep 20, 2019
addb2a4
Update tests to NUnit 3
praeclarum Sep 20, 2019
bc26fb4
Fix build step
praeclarum Sep 20, 2019
77dee63
Merge pull request #873 from praeclarum/updatetests
praeclarum Sep 20, 2019
7d6359d
Convert to .NET Standard 2.0 and update SQLitePCLRaw to 2.0
praeclarum Sep 20, 2019
554e4c0
Remove NETSTANDARD define
praeclarum Sep 20, 2019
b2bce6b
Use projects instead of nuspecs
praeclarum Sep 20, 2019
16b4c9e
Fix ApiDiff project settings
praeclarum Sep 20, 2019
2d82984
Fix nuget output path
praeclarum Sep 20, 2019
50698ed
Merge pull request #874 from praeclarum/sqlraw2
praeclarum Sep 20, 2019
a4bace8
Create FUNDING.yml
praeclarum Sep 20, 2019
e4a0f89
Actually set StoreTimeSpanAsTicks flag
gtbX Sep 23, 2019
730baa3
Assert that TimeSpans are actually stored in the DB as requested.
gtbX Sep 23, 2019
d29894e
Assert that DateTimes are actually stored in the DB as requested.
gtbX Sep 23, 2019
c9ae5d2
Merge branch 'master' into custom-datetime
gtbX Oct 11, 2019
3d900ae
whitespace
gtbX Oct 11, 2019
aa13fac
use ExecuteScalar<string> to handle 'ok' result from PRAGMA key
sjlombardo Oct 17, 2019
bd1aade
Minor comment fix
dawedawe Dec 7, 2019
d9f2ff2
Fixed spelling mistake Jounral -> Journal
LuckyDucko Jan 21, 2020
14215f3
Fixed Spelling Jounral -> Journal
LuckyDucko Jan 21, 2020
b525ca2
Fix getting detailed error messages
Jan 30, 2020
a4ec7ae
Fix compile error
Jan 31, 2020
a82be99
Switch to GitHub Sponsors
praeclarum May 14, 2020
64c956a
Serialize transactions for #881
praeclarum May 15, 2020
9ada70a
Async improvements for #700
praeclarum May 15, 2020
6f3b3d8
Bump SQLitePCLRaw for security fixes
praeclarum May 15, 2020
a8672e7
Merge pull request #913 from paulkyi/detailed-error-messages
praeclarum May 15, 2020
eb917c2
Merge pull request #908 from LuckyDucko/patch-1
praeclarum May 15, 2020
72effbe
Merge pull request #899 from dawedawe/patch-1
praeclarum May 15, 2020
f8d8838
Merge pull request #878 from perfectco/custom-datetime
praeclarum May 15, 2020
d7c608f
fix #811
kinderry Feb 22, 2019
ef080b7
Fix tests for #812
praeclarum May 15, 2020
feb4d49
Rename to QueryScalars for #812
praeclarum May 16, 2020
3584a6d
Merge pull request #856 from Pythians/master
praeclarum May 16, 2020
9a66dc7
Fix formatting
praeclarum May 16, 2020
6466bbe
fixed tests for issue #950
csm101 May 16, 2020
c6696e1
ReadmeTest.cs were failing if run in parallel execution or in "run co…
csm101 May 16, 2020
e6b14ba
Now AsyncTests can be run in parallel without interfering each other.…
csm101 May 16, 2020
e15a84d
Ramdomized the file names used in ReadmeTest.cs, to allow each test t…
csm101 May 16, 2020
1f43c76
Repalced Randodom.Next with Guid.NewGuid() as a randomizer for filena…
csm101 May 16, 2020
5de790b
Adding a FastColumnSetter to bypass the slow Property.Set() method fr…
cherron-aptera Dec 18, 2019
c31dd9b
Adding support for nullable types with FastColumnSet.
cherron-aptera Dec 18, 2019
e57c345
Minor comment fix. There is a null check in the function, but no che…
cherron-aptera Dec 20, 2019
c350219
Make it compatible with IL2CPP(Unity)
abcjjy Sep 6, 2020
a45e254
Remove #define ENABLE_IL2CPP
abcjjy Sep 6, 2020
6e9bc56
Pass along "extra" on InsertAll
StevenThuriot Sep 22, 2020
2fa48ef
Support for ValueTuples
XavierAP Nov 22, 2020
43d0f8f
Please consider updating SQLitePCLRaw from 2.0.3 to 2.0.4
Nov 28, 2020
bafa240
The 'PackageIconUrl'/'iconUrl' element is deprecated.
Jon2G Nov 28, 2020
285ffe8
Merge pull request #1013 from Jouna77/master
praeclarum Dec 6, 2020
b1c5d9b
Merge pull request #993 from abcjjy/master
praeclarum Dec 6, 2020
a0cd2ed
Merge pull request #999 from StevenThuriot/patch-1
praeclarum Dec 6, 2020
2aa58bb
Merge pull request #952 from csm101/readme_test_breaks_if_run_in_para…
praeclarum Dec 6, 2020
5a76b53
Merge pull request #953 from csm101/async_tests_fail_if_run_in_parallel
praeclarum Dec 6, 2020
351363f
Merge pull request #951 from csm101/date_time_tests_are_not_locale_se…
praeclarum Dec 6, 2020
4d95ef3
Merge pull request #902 from cherron-aptera/FastColumnSetter
praeclarum Dec 6, 2020
ce8c60d
Bump to 1.8
praeclarum Dec 6, 2020
4f0aac5
Merge pull request #1 from praeclarum/master
XavierAP Dec 21, 2020
ba66d1a
Merge branch 'master' into issue1007
Dec 21, 2020
6ba0017
Oops
Dec 22, 2020
1942b6b
PR review
Dec 22, 2020
11be159
Oops
Dec 22, 2020
2ed9c77
Facepalm *
Dec 25, 2020
6344829
Cleaner test directory layout
praeclarum Dec 27, 2020
1a25720
Add AltCover
praeclarum Dec 27, 2020
8b81b7a
Update build.yml
praeclarum Dec 27, 2020
4c438a0
Add some attribute tests
praeclarum Jan 3, 2021
39c1f5c
Update build.yml
praeclarum Jan 3, 2021
1b503b6
Update build.yml
praeclarum Jan 3, 2021
5deead9
Update build.yml
praeclarum Jan 3, 2021
da19492
Update build.yml
praeclarum Jan 3, 2021
615281d
Update build.yml
praeclarum Jan 3, 2021
3cb6a8e
Update build.yml
praeclarum Jan 3, 2021
1f37985
Update build.yml
praeclarum Jan 3, 2021
053b90c
Update build.yml
praeclarum Jan 3, 2021
eccce69
Merge pull request #1021 from praeclarum/cctest
praeclarum Jan 3, 2021
f7be407
Add link to code coverage
praeclarum Jan 3, 2021
49f2471
Add more async tests for coverage
praeclarum Jan 17, 2021
38d5235
Improve code comments
praeclarum Jan 17, 2021
5bed8e8
Add code coverage to Makefile
praeclarum Jan 17, 2021
ff6507e
Add code coverage filter
praeclarum Jan 17, 2021
f8e0195
Merge branch 'master' of https://github.com/praeclarum/sqlite-net
XavierAP Jan 29, 2021
cc766d1
Merge branch 'master' into issue1007
XavierAP Jan 29, 2021
c922a87
Update SQLiteAsync.cs
jsilvanus May 11, 2021
7d79fe8
Update SQLiteAsync.cs
jsilvanus May 11, 2021
54cd0b2
fix Update SqlString pkName
AigioL Jul 19, 2021
a678bbe
Merge pull request #1051 from SteamTools-Team/master
praeclarum Aug 25, 2021
377adc8
Merge pull request #1043 from jsilvanus/patch-1
praeclarum Aug 25, 2021
d846ead
Merge pull request #1026 from sqlcipher/pragma-key-ok
praeclarum Aug 25, 2021
47957c5
Merge pull request #1012 from XavierAP/issue1007
praeclarum Aug 25, 2021
69bf7ca
Create static P/Invoke nuget
praeclarum Aug 25, 2021
f8c26a0
Support the raw key data with explicit salt.
frednjira005 Feb 7, 2019
46a8eae
Merge branch 'frednjira005-master'
praeclarum Aug 25, 2021
2177a20
Add build number to nuget version
praeclarum Aug 25, 2021
936589e
Merge pull request #1058 from praeclarum/nuget-build-version
praeclarum Aug 25, 2021
09fb276
Add static to the solution
praeclarum Aug 25, 2021
65b2692
Remove Android as Google doesn't want you using the native lib
praeclarum Aug 25, 2021
758ad7a
Merge pull request #1057 from praeclarum/static
praeclarum Aug 25, 2021
38149ab
Fix for issue 1048 and Unit Tests
inforithmics Aug 31, 2021
539e3a7
remove unrelated change
inforithmics Aug 31, 2021
6cf5c05
move make generic method out of loop
inforithmics Aug 31, 2021
e1d4ce7
Only use MakeGenericMethod when it is necessary
inforithmics Aug 31, 2021
5940dc7
Update SQLite.cs
MaxFromDoqpal Sep 1, 2021
4479f31
Merge pull request #1061 from MaxFromDoqpal/Bugfix-Issue1060-Unknown-…
praeclarum Sep 2, 2021
56c06a4
Merge pull request #1059 from inforithmics/FastColumnArgumentException
praeclarum Sep 2, 2021
119d77d
Fix PackageIcon
praeclarum Sep 2, 2021
1bbdff4
Merge pull request #1062 from praeclarum/package-icon
praeclarum Sep 2, 2021
a262479
Only build when pushing to master
praeclarum Sep 2, 2021
df8a419
Merge pull request #1063 from praeclarum/ci-push
praeclarum Sep 2, 2021
0b23275
Release 1.8
praeclarum Sep 2, 2021
2aa6552
Adding package and asmdef for Sqlite-net.
skent-mz Nov 8, 2022
53b95b2
Merge pull request #1 from skent-mz/user/skent/adding-package
skent-mz Nov 8, 2022
917af40
Adding SQLitePCLRaw. Tweaked Sqlite to initialize SQLitePCLRaw for un…
skent-mz Nov 8, 2022
baf3b59
Removing .DS_Store folders.
skent-mz Nov 8, 2022
c1868aa
Merge pull request #2 from machinezone/user/skent/adding-sqlite-pcl
skent-mz Nov 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add async CreateTables and CreateIndex overloads
Working on praeclarum#480
  • Loading branch information
praeclarum committed Aug 2, 2017
commit 3db31a00c728382fcd0e53f60f91c897c5c31979
119 changes: 109 additions & 10 deletions src/SQLite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,103 @@ public int CreateTable(Type ty, CreateFlags createFlags = CreateFlags.None)
return count;
}

/// <summary>
/// Creates an index for the specified table and columns.
/// </summary>
/// <param name="indexName">Name of the index to create</param>
/// <param name="tableName">Name of the database table</param>
/// <param name="columnNames">An array of column names to index</param>
/// <param name="unique">Whether the index should be unique</param>
public int CreateIndex(string indexName, string tableName, string[] columnNames, bool unique = false)
/// <summary>
/// Executes a "create table if not exists" on the database for each type. It also
/// creates any specified indexes on the columns of the table. It uses
/// a schema automatically generated from the specified type. You can
/// later access this schema by calling GetMapping.
/// </summary>
/// <returns>
/// The number of entries added to the database schema for each type.
/// </returns>
public CreateTablesResult CreateTables<T, T2> (CreateFlags createFlags = CreateFlags.None)
where T : new()
where T2 : new()
{
return CreateTables (createFlags, typeof (T), typeof (T2));
}

/// <summary>
/// Executes a "create table if not exists" on the database for each type. It also
/// creates any specified indexes on the columns of the table. It uses
/// a schema automatically generated from the specified type. You can
/// later access this schema by calling GetMapping.
/// </summary>
/// <returns>
/// The number of entries added to the database schema for each type.
/// </returns>
public CreateTablesResult CreateTables<T, T2, T3> (CreateFlags createFlags = CreateFlags.None)
where T : new()
where T2 : new()
where T3 : new()
{
return CreateTables (createFlags, typeof (T), typeof (T2), typeof (T3));
}

/// <summary>
/// Executes a "create table if not exists" on the database for each type. It also
/// creates any specified indexes on the columns of the table. It uses
/// a schema automatically generated from the specified type. You can
/// later access this schema by calling GetMapping.
/// </summary>
/// <returns>
/// The number of entries added to the database schema for each type.
/// </returns>
public CreateTablesResult CreateTables<T, T2, T3, T4> (CreateFlags createFlags = CreateFlags.None)
where T : new()
where T2 : new()
where T3 : new()
where T4 : new()
{
return CreateTables (createFlags, typeof (T), typeof (T2), typeof (T3), typeof (T4));
}

/// <summary>
/// Executes a "create table if not exists" on the database for each type. It also
/// creates any specified indexes on the columns of the table. It uses
/// a schema automatically generated from the specified type. You can
/// later access this schema by calling GetMapping.
/// </summary>
/// <returns>
/// The number of entries added to the database schema for each type.
/// </returns>
public CreateTablesResult CreateTables<T, T2, T3, T4, T5> (CreateFlags createFlags = CreateFlags.None)
where T : new()
where T2 : new()
where T3 : new()
where T4 : new()
where T5 : new()
{
return CreateTables (createFlags, typeof (T), typeof (T2), typeof (T3), typeof (T4), typeof (T5));
}

/// <summary>
/// Executes a "create table if not exists" on the database for each type. It also
/// creates any specified indexes on the columns of the table. It uses
/// a schema automatically generated from the specified type. You can
/// later access this schema by calling GetMapping.
/// </summary>
/// <returns>
/// The number of entries added to the database schema for each type.
/// </returns>
public CreateTablesResult CreateTables (CreateFlags createFlags = CreateFlags.None, params Type[] types)
{
var result = new CreateTablesResult ();
foreach (Type type in types) {
int aResult = CreateTable (type, createFlags);
result.Results[type] = aResult;
}
return result;
}

/// <summary>
/// Creates an index for the specified table and columns.
/// </summary>
/// <param name="indexName">Name of the index to create</param>
/// <param name="tableName">Name of the database table</param>
/// <param name="columnNames">An array of column names to index</param>
/// <param name="unique">Whether the index should be unique</param>
public int CreateIndex(string indexName, string tableName, string[] columnNames, bool unique = false)
{
const string sqlFormat = "create {2} index if not exists \"{3}\" on \"{0}\"(\"{1}\")";
var sql = String.Format(sqlFormat, tableName, string.Join ("\", \"", columnNames), unique ? "unique" : "", indexName);
Expand Down Expand Up @@ -534,7 +623,7 @@ public int CreateIndex(string tableName, string[] columnNames, bool unique = fal
/// <typeparam name="T">Type to reflect to a database table.</typeparam>
/// <param name="property">Property to index</param>
/// <param name="unique">Whether the index should be unique</param>
public void CreateIndex<T>(Expression<Func<T, object>> property, bool unique = false)
public int CreateIndex<T>(Expression<Func<T, object>> property, bool unique = false)
{
MemberExpression mx;
if (property.Body.NodeType == ExpressionType.Convert)
Expand All @@ -556,7 +645,7 @@ public void CreateIndex<T>(Expression<Func<T, object>> property, bool unique = f
var map = GetMapping<T>();
var colName = map.FindColumnWithPropertyName(propName).Name;

CreateIndex(map.TableName, colName, unique);
return CreateIndex(map.TableName, colName, unique);
}

public class ColumnInfo
Expand Down Expand Up @@ -2724,6 +2813,16 @@ private void Dispose (bool disposing)
}
}

public class CreateTablesResult
{
public Dictionary<Type, int> Results { get; private set; }

public CreateTablesResult ()
{
Results = new Dictionary<Type, int> ();
}
}

public abstract class BaseTableQuery
{
protected class Ordering
Expand Down
85 changes: 68 additions & 17 deletions src/SQLiteAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,25 @@ public Task EnableLoadExtensionAsync (bool enabled)
});
}

public Task<CreateTablesResult> CreateTableAsync<T> (CreateFlags createFlags = CreateFlags.None)
public Task<int> CreateTableAsync<T> (CreateFlags createFlags = CreateFlags.None)
where T : new ()
{
return CreateTablesAsync (createFlags, typeof(T));
return Task.Factory.StartNew (() => {
var conn = GetConnection ();
using (conn.Lock ()) {
return conn.CreateTable<T> (createFlags);
}
});
}

public Task<int> CreateTableAsync (Type ty, CreateFlags createFlags = CreateFlags.None)
{
return Task.Factory.StartNew (() => {
var conn = GetConnection ();
using (conn.Lock ()) {
return conn.CreateTable (ty, createFlags);
}
});
}

public Task<CreateTablesResult> CreateTablesAsync<T, T2> (CreateFlags createFlags = CreateFlags.None)
Expand Down Expand Up @@ -143,12 +158,8 @@ public Task<CreateTablesResult> CreateTablesAsync (CreateFlags createFlags = Cre
CreateTablesResult result = new CreateTablesResult ();
var conn = GetConnection ();
using (conn.Lock ()) {
foreach (Type type in types) {
int aResult = conn.CreateTable (type, createFlags);
result.Results[type] = aResult;
}
return conn.CreateTables (createFlags, types);
}
return result;
});
}

Expand All @@ -173,6 +184,56 @@ public Task<int> DropTableAsync (TableMapping map)
});
}

public Task<int> CreateIndexAsync (string tableName, string columnName, bool unique = false)
{
return Task.Factory.StartNew (() => {
var conn = GetConnection ();
using (conn.Lock ()) {
return conn.CreateIndex (tableName, columnName, unique);
}
});
}

public Task<int> CreateIndexAsync (string indexName, string tableName, string columnName, bool unique = false)
{
return Task.Factory.StartNew (() => {
var conn = GetConnection ();
using (conn.Lock ()) {
return conn.CreateIndex (indexName, tableName, columnName, unique);
}
});
}

public Task<int> CreateIndexAsync (string tableName, string[] columnNames, bool unique = false)
{
return Task.Factory.StartNew (() => {
var conn = GetConnection ();
using (conn.Lock ()) {
return conn.CreateIndex (tableName, columnNames, unique);
}
});
}

public Task<int> CreateIndexAsync (string indexName, string tableName, string[] columnNames, bool unique = false)
{
return Task.Factory.StartNew (() => {
var conn = GetConnection ();
using (conn.Lock ()) {
return conn.CreateIndex (indexName, tableName, columnNames, unique);
}
});
}

public Task<int> CreateIndexAsync<T> (Expression<Func<T, object>> property, bool unique = false)
{
return Task.Factory.StartNew (() => {
var conn = GetConnection ();
using (conn.Lock ()) {
return conn.CreateIndex (property, unique);
}
});
}

public Task<int> InsertAsync (object obj)
{
return Task.Factory.StartNew (() => {
Expand Down Expand Up @@ -675,16 +736,6 @@ public Task<T> FirstOrDefaultAsync ()
}
}

public class CreateTablesResult
{
public Dictionary<Type, int> Results { get; private set; }

public CreateTablesResult ()
{
Results = new Dictionary<Type, int> ();
}
}

class SQLiteConnectionPool
{
class Entry
Expand Down
1 change: 1 addition & 0 deletions tests/ApiDiff/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public Apis (Type type, string nameSuffix = "")
.Where (x => x.MemberType != MemberTypes.NestedType)
.Where (x => !x.Name.StartsWith("get_") && !x.Name.StartsWith ("set_") && !x.Name.StartsWith ("remove_") && !x.Name.StartsWith ("add_"))
.Select (x => new Api(x, nameSuffix))
.OrderBy (x => x.Index)
.OrderBy (x => x.Name)
.ToList ();
}
Expand Down