Skip to content

Commit ec8ef8f

Browse files
committed
updates to the main README for the repo
1 parent 022b221 commit ec8ef8f

1 file changed

Lines changed: 99 additions & 65 deletions

File tree

README.md

Lines changed: 99 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,67 @@
11

22
# SQLitePCLRaw
33

4-
SQLitePCLRaw is a Portable Class Library (PCL) for low-level (raw)
5-
access to SQLite. License: Apache License v2.
4+
SQLitePCLRaw is a .NET Portable Class Library (PCL) for low-level (raw)
5+
access to SQLite.
66

7-
# How the packaging works
7+
This library is open source (Apache License v2) and has been downloaded
8+
hundreds of millions of times on nuget.org.
9+
10+
My name is Eric Sink. I am:
11+
12+
- the maintainer of this library
13+
- the founder of SourceGear, a small software company in Illinois
14+
- part of the SQLite core team
15+
16+
You can email me at either eric@sourcegear.com or eric@sqlite.org
17+
18+
# Technical Support
19+
20+
If you need help using SQLite with .NET, you can post a question
21+
here in this repo, and there is a chance that I or someone else
22+
will answer it.
23+
24+
If you are interested in private technical support with more structure,
25+
SourceGear provides technical support agreements at
26+
various levels. Contact me for a price quote.
27+
28+
# SQLite builds
29+
30+
The SQLitePCLRaw.lib.e_sqlite3 package is published publicly on nuget.org
31+
as part of this project. It contains builds of the native SQLite code library
32+
for server platforms and with the most commonly used features enabled.
33+
I update this package from time to time.
34+
35+
My company (SourceGear) operates a paid service at nuget.sourcegear.com
36+
which provides various native SQLite builds which are
37+
updated immediately after each SQLite release. These include regular
38+
SQLite builds, or various options with encryption support. We can also provide
39+
custom configurations.
40+
41+
If you are interested in SourceGear's SQLite build service, please
42+
contact me for a price quote.
43+
44+
# Encryption support
45+
46+
I no longer publish encryption-enabled SQLite builds without cost.
47+
48+
My recommended solution for encryption support is the SQLite Encryption Extension (SEE), which is the official implementation from the SQLite team:
49+
50+
https://sqlite.org/com/see.html
51+
52+
The SEE is not open source -- a paid license is required. SourceGear's SQLite build service
53+
provides SEE builds in the form of nuget packages.
54+
55+
The recommended way to use a crypto-enabled SQLite build is to name the shared library `e_sqlite3` and use the `SQLitePCLRaw.config.e_sqlite3` package.
56+
Using this approach, you can use open source alternatives to SEE, including:
57+
58+
- SQLCipher (builds available for purchase from Zetetic)
59+
- SQLite3 Multiple Ciphers (maintained by @utelle, builds available in SourceGear's SQLite build service)
60+
61+
# The structure of these packages
862

963
The main assembly is SQLitePCLRaw.core. A portable library project would
10-
need to only take a dep on this one. All the other packages
64+
need to only take a dependency on this one. All the other packages
1165
deal with initialization and the question of which instance
1266
of the native SQLite library is involved.
1367

@@ -45,11 +99,6 @@ the form SQLitePCLRaw.provider.\*.
4599

46100
# Provider names
47101

48-
There is a `dynamic` provider which does not use a hard-coded
49-
DllImport string. This one is the most difficult to use but offers
50-
the most control. It can be used to load a custom-built native
51-
SQLite library.
52-
53102
The DllImport-based providers are named for the exact string which is used
54103
for DllImport (pinvoke).
55104

@@ -70,13 +119,15 @@ So, a provider where all the DllImport attributes were
70119
using "foo", would have "foo" in its package id and
71120
in its class name.
72121

122+
There is also a `dynamic` provider which does not use a hard-coded
123+
DllImport string. This one is the most difficult to use but can
124+
support advanced use cases where the loading decision needs
125+
to be made at runtime.
126+
73127
# Included providers
74128

75129
SQLitePCLRaw includes several different providers. Examples:
76130

77-
- "dynamic" -- Uses dynamic loading of the native library
78-
instead of DllImport attributes.
79-
80131
- "e\_sqlite3" -- This is the name of all SQLite builds provided
81132
as part of this project.
82133

@@ -90,7 +141,11 @@ from Zetetic.
90141
- "winsqlite3" -- Matches the name of the library provided by
91142
recent builds of Windows.
92143

93-
# SQLitePCLRaw.lib.e\_sqlite3 packages
144+
- "dynamic" -- Uses dynamic loading of the native library
145+
instead of DllImport attributes. This can be used to support
146+
advanced use cases.
147+
148+
# SQLitePCLRaw.lib.e\_sqlite3
94149

95150
A provider is the bridge between the core assembly and the native
96151
code, but the provider does not contain the native code itself.
@@ -116,49 +171,52 @@ packages:
116171
- SQLitePCLRaw.core
117172
- SQLitePCLRaw.provider.whatever
118173

119-
And in many cases one of these as well:
174+
And in many cases, you also need a package containing the native SQLite library itself. For example:
120175

121-
- SQLitePCLRaw.lib.whatever
176+
- SQLitePCLRaw.lib.e_sqlite3
122177

123-
And in your platform-specific code, you need to call:
178+
Then, in your platform-specific code, you need to call:
124179

125180
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_whatever());
126181

127-
But the word "whatever" is different on each platform.
128-
For example, on Android, using e\_sqlite3, you need:
129-
130-
- SQLitePCLRaw.core
131-
- SQLitePCLRaw.provider.e\_sqlite3.android
132-
- SQLitePCLRaw.lib.e\_sqlite3.android
182+
But the word "whatever" can differ, depending on the platform or desired
183+
configuration.
133184

134-
and you need to call:
185+
In the most common cases, using DllImport to load a library named
186+
"e_sqlite3", the initialization call looks like this:
135187

136188
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_e_sqlite3());
137189

138-
# Bundles
190+
but some platforms are special, like iOS, for example.
139191

140-
To make things easier, SQLitePCLRaw includes "bundle" packages.
141-
These packages automatically bring in the right dependencies for
142-
each platform. They also provide a single Init() call that is the
143-
same for all platforms.
192+
For convenience, the "SQLitePCLRaw.config.e_sqlite3" package provides the
193+
right dependencies and initialization code for each platform to use
194+
any SQLite library named "e_sqlite3". Using this package, you
195+
can initialize things on any platform by calling:
144196

145-
Think of a bundle as way of giving a "batteries included" experience.
197+
SQLitePCL.Batteries_V2.Init();
146198

147-
So for example, SQLitePCLRaw.bundle\_e\_sqlite3 is a bundle that
148-
uses e\_sqlite3 in all cases. Just add this package, and call:
199+
But you still need to bring in a native SQLite library with
200+
"e_sqlite3" as the base name. The "SQLitePCLRaw.config.e_sqlite3" doesn't
201+
do that, because there are multiple possibilities, and it wants to defer
202+
the choice until later.
149203

150-
SQLitePCL.Batteries_V2.Init();
204+
If you want to use a plain SQLite library with the most commonly used
205+
features, just add the "SQLitePCLRaw.lib.e_sqlite3" package.
206+
207+
For backward compatibility with previous releases, the SQLitePCLRaw.bundle_e_sqlite3
208+
package continues to be available, but all it does is bring in two dependencies:
151209

152-
The purpose of the bundles is to make things easier by taking
153-
away flexibility and control. You don't have to use them.
210+
- SQLitePCLRaw.config.e_sqlite3
211+
- SQLitePCLRaw.lib.e_sqlite
154212

155-
## How do I build this?
213+
## How do I build SQLitePCLRaw?
156214

157215
#### Requirements
158216

159-
TODO need .NET SDK
217+
* Install the .NET SDK
160218
* Install the `t4` cli tool with `dotnet tool install --global dotnet-t4`
161-
* Make sure that the *Mobile development with.NET* workload [is installed](https://docs.microsoft.com/en-us/visualstudio/install/modify-visual-studio)
219+
* Install the workloads for iOS, Android, tvOS, and MacCatalyst
162220

163221
```
164222
cd build
@@ -213,39 +271,15 @@ The `sqlite-net-pcl` package uses SQLitePCLRaw:
213271
## How does this compare to System.Data.SQLite?
214272

215273
[System.Data.SQLite](http://system.data.sqlite.org) is an ADO.NET-style SQLite wrapper developed by the
216-
core SQLite team. It is very full-featured, supporting LINQ and Entity Framework. And for obvious reasons,
217-
it does a fantastic job of the SQLite side of things.
274+
core SQLite team.
218275

219276
In mid-2025, I joined the SQLite core team and became the maintainer of System.Data.SQLite,
220-
but System.Data.SQLite and SQLitePCLRaw are unrelated and likely to remain that way.
277+
but despite the fact that I maintain both, System.Data.SQLite and SQLitePCLRaw are unrelated and likely to remain that way.
221278

222279
## Why is this called SQLitePCLRaw?
223280

224281
[SQLitePCL](https://sqlitepcl.codeplex.com/) was a SQLite Portable Class Library released on Codeplex by MS Open Tech.
225282

226-
This library is a fork of that code. Sort of.
227-
228-
It is a fork in the 2007 sense of the word. I made significant use of the code. I preserved copyright notices.
229-
230-
However, this is not the the sort of fork which is created for the purpose of
231-
producing a pull request. The changes I've made are so extensive that I do not
232-
plan to submit a pull request unless one is requested. I plan to maintain this
233-
code going forward.
234-
235-
# Encryption support
236-
237-
My recommended solution for encryption support is the SQLite Encryption Extension (SEE), which is the official implementation from the SQLite team:
238-
239-
https://sqlite.org/com/see.html
240-
241-
The SEE is not open source -- a paid license is required.
242-
243-
SQLitePCLRaw.provider.e\_see supports native code builds with the base name `e_see`. TODO
244-
245-
SQLitePCLRaw also includes providers for two open source alternatives to the SEE:
246-
247-
- SQLCipher (from Zetetic)
248-
- SQLite3 Multiple Ciphers (from @utelle).
249-
250-
I no longer maintain and distribute encryption-enabled SQLite builds without cost.
283+
This library started as fork of that code, but I removed all the higher-level functionality, and what was
284+
left was "raw".
251285

0 commit comments

Comments
 (0)