You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Required**: add ONLY ONE of the followin packages to your common project:
8
+
**Required**: add ONLY ONE of the following packages to your common project:
9
9
-[SQLitePCLRaw.bundle_e_sqlite3](https://www.nuget.org/packages/SQLitePCLRaw.bundle_e_sqlite3) for a normal database file
10
10
-[SQLitePCLRaw.bundle_e_sqlcipher](https://www.nuget.org/packages/SQLitePCLRaw.bundle_e_sqlcipher) for an encrypted database file
11
11
@@ -49,7 +49,7 @@ For a key/value store based on sqlite, or a drop-in replacement (alternative) to
49
49
Usage: `ExecuteSimpleQuery<string>("select 'drop table ' || name || ';' from sqlite_master where type = 'table'")`
50
50
51
51
* No asynchronous API. Use Task.Run() if you want asynchronous calls.
52
-
Note that while SQLitePCLRaw states that the database can be accessed by mutiple threads simultaneously, experience proves that you should always prevent multithread access, otherwise rare random crash occur. You can use `SemaphoreSlim` to serialize calls.
52
+
Note that while SQLitePCLRaw states that the database can be accessed by multiple threads simultaneously, experience proves that you should always prevent multithreaded access, otherwise rare random crash occur. You can use `SemaphoreSlim` to serialize calls.
53
53
54
54
* Another trick
55
55
Use transactions! In sqlite they speed up all queries a lot.
@@ -192,3 +192,33 @@ if (String.IsNullOrWhiteSpace(cipherVer))
192
192
thrownewException("This build is not using SQL CIPHER");
193
193
```
194
194
195
+
## Using transactions
196
+
197
+
Warning: all transactions methods create a state in this connection (the transaction depth).
198
+
Be sure to not share the connection with other simultaneous threads.
199
+
200
+
Especially these methods create by default an implicit transaction:
201
+
`InsertAll(), InsertOrUpdateAll(), ReplaceAll()`
202
+
They all have a boolean parameter to disable the implicit transaction (beware of performances).
203
+
204
+
Standard transaction:
205
+
```c#
206
+
BeginTransaction();
207
+
...
208
+
Commit();
209
+
//or
210
+
Rollback();
211
+
```
212
+
213
+
Nested transactions:
214
+
```c#
215
+
varsavepoint=SaveTransactionPoint();
216
+
...
217
+
Release(savepoint);
218
+
//or
219
+
RollbackTo(savepoint);
220
+
```
221
+
222
+
## Limitations
223
+
224
+
Most databases (except SQLServer) store DateTimeOffset as UTC, forgetting the offset part. SQlite is not an exception.
0 commit comments