• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..19-Nov-2020-

.travis.ymlH A D19-Nov-2020994 4235

LICENSEH A D19-Nov-20201.1 KiB2217

README.mdH A D19-Nov-202023.4 KiB520345

backup.goH A D19-Nov-20202.1 KiB8648

callback.goH A D19-Nov-202010.7 KiB381304

doc.goH A D19-Nov-20203.1 KiB1131

error.goH A D19-Nov-20205.6 KiB136109

sqlite3-binding.cH A D19-Nov-20207.4 MiB219,524135,652

sqlite3-binding.hH A D19-Nov-2020541.5 KiB11,6751,646

sqlite3.goH A D19-Nov-202058.5 KiB2,0721,343

sqlite3_context.goH A D19-Nov-20203 KiB10451

sqlite3_func_crypt.goH A D19-Nov-20204 KiB12154

sqlite3_go18.goH A D19-Nov-20201.8 KiB7146

sqlite3_libsqlite3.goH A D19-Nov-2020411 182

sqlite3_load_extension.goH A D19-Nov-20201.6 KiB7145

sqlite3_load_extension_omit.goH A D19-Nov-2020587 2511

sqlite3_opt_allow_uri_authority.goH A D19-Nov-2020364 162

sqlite3_opt_app_armor.goH A D19-Nov-2020368 172

sqlite3_opt_foreign_keys.goH A D19-Nov-2020360 162

sqlite3_opt_fts5.goH A D19-Nov-2020286 152

sqlite3_opt_icu.goH A D19-Nov-2020428 182

sqlite3_opt_introspect.goH A D19-Nov-2020355 162

sqlite3_opt_json1.goH A D19-Nov-2020283 142

sqlite3_opt_secure_delete.goH A D19-Nov-2020354 162

sqlite3_opt_secure_delete_fast.goH A D19-Nov-2020362 162

sqlite3_opt_stat4.goH A D19-Nov-2020343 162

sqlite3_opt_unlock_notify.cH A D19-Nov-20201.7 KiB8670

sqlite3_opt_unlock_notify.goH A D19-Nov-20201.9 KiB9460

sqlite3_opt_userauth.goH A D19-Nov-20207.4 KiB290109

sqlite3_opt_userauth_omit.goH A D19-Nov-20204.3 KiB15334

sqlite3_opt_vacuum_full.goH A D19-Nov-2020357 162

sqlite3_opt_vacuum_incr.goH A D19-Nov-2020357 162

sqlite3_opt_vtable.goH A D19-Nov-202017.3 KiB651323

sqlite3_other.goH A D19-Nov-2020376 182

sqlite3_solaris.goH A D19-Nov-2020275 152

sqlite3_trace.goH A D19-Nov-20208.3 KiB289169

sqlite3_type.goH A D19-Nov-20201.4 KiB5833

sqlite3_usleep_windows.goH A D19-Nov-20201.1 KiB402

sqlite3_windows.goH A D19-Nov-2020419 192

sqlite3ext.hH A D19-Nov-202032.9 KiB628549

static_mock.goH A D19-Nov-2020395 2214

README.md

1go-sqlite3
2==========
3
4[![GoDoc Reference](https://godoc.org/github.com/mattn/go-sqlite3?status.svg)](http://godoc.org/github.com/mattn/go-sqlite3)
5[![Build Status](https://travis-ci.org/mattn/go-sqlite3.svg?branch=master)](https://travis-ci.org/mattn/go-sqlite3)
6[![Coverage Status](https://coveralls.io/repos/mattn/go-sqlite3/badge.svg?branch=master)](https://coveralls.io/r/mattn/go-sqlite3?branch=master)
7[![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-sqlite3)](https://goreportcard.com/report/github.com/mattn/go-sqlite3)
8
9# Description
10
11sqlite3 driver conforming to the built-in database/sql interface
12
13Supported Golang version:
14- 1.9.x
15- 1.10.x
16
17[This package follows the official Golang Release Policy.](https://golang.org/doc/devel/release.html#policy)
18
19### Overview
20
21- [Installation](#installation)
22- [API Reference](#api-reference)
23- [Connection String](#connection-string)
24- [Features](#features)
25- [Compilation](#compilation)
26  - [Android](#android)
27  - [ARM](#arm)
28  - [Cross Compile](#cross-compile)
29  - [Google Cloud Platform](#google-cloud-platform)
30  - [Linux](#linux)
31    - [Alpine](#alpine)
32    - [Fedora](#fedora)
33    - [Ubuntu](#ubuntu)
34  - [Mac OSX](#mac-osx)
35  - [Windows](#windows)
36  - [Errors](#errors)
37- [User Authentication](#user-authentication)
38  - [Compile](#compile)
39  - [Usage](#usage)
40- [Extensions](#extensions)
41  - [Spatialite](#spatialite)
42- [FAQ](#faq)
43- [License](#license)
44
45# Installation
46
47This package can be installed with the go get command:
48
49    go get github.com/mattn/go-sqlite3
50
51_go-sqlite3_ is *cgo* package.
52If you want to build your app using go-sqlite3, you need gcc.
53However, after you have built and installed _go-sqlite3_ with `go install github.com/mattn/go-sqlite3` (which requires gcc), you can build your app without relying on gcc in future.
54
55***Important: because this is a `CGO` enabled package you are required to set the environment variable `CGO_ENABLED=1` and have a `gcc` compile present within your path.***
56
57# API Reference
58
59API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite3
60
61Examples can be found under the [examples](./_example) directory
62
63# Connection String
64
65When creating a new SQLite database or connection to an existing one, with the file name additional options can be given.
66This is also known as a DSN string. (Data Source Name).
67
68Options are append after the filename of the SQLite database.
69The database filename and options are seperated by an `?` (Question Mark).
70Options should be URL-encoded (see [url.QueryEscape](https://golang.org/pkg/net/url/#QueryEscape)).
71
72This also applies when using an in-memory database instead of a file.
73
74Options can be given using the following format: `KEYWORD=VALUE` and multiple options can be combined with the `&` ampersand.
75
76This library supports dsn options of SQLite itself and provides additional options.
77
78Boolean values can be one of:
79* `0` `no` `false` `off`
80* `1` `yes` `true` `on`
81
82| Name | Key | Value(s) | Description |
83|------|-----|----------|-------------|
84| UA - Create | `_auth` | - | Create User Authentication, for more information see [User Authentication](#user-authentication) |
85| UA - Username | `_auth_user` | `string` | Username for User Authentication, for more information see [User Authentication](#user-authentication) |
86| UA - Password | `_auth_pass` | `string` | Password for User Authentication, for more information see [User Authentication](#user-authentication) |
87| UA - Crypt | `_auth_crypt` | <ul><li>SHA1</li><li>SSHA1</li><li>SHA256</li><li>SSHA256</li><li>SHA384</li><li>SSHA384</li><li>SHA512</li><li>SSHA512</li></ul> | Password encoder to use for User Authentication, for more information see [User Authentication](#user-authentication) |
88| UA - Salt | `_auth_salt` | `string` | Salt to use if the configure password encoder requires a salt, for User Authentication, for more information see [User Authentication](#user-authentication) |
89| Auto Vacuum | `_auto_vacuum` \| `_vacuum` | <ul><li>`0` \| `none`</li><li>`1` \| `full`</li><li>`2` \| `incremental`</li></ul> | For more information see [PRAGMA auto_vacuum](https://www.sqlite.org/pragma.html#pragma_auto_vacuum) |
90| Busy Timeout | `_busy_timeout` \| `_timeout` | `int` | Specify value for sqlite3_busy_timeout. For more information see [PRAGMA busy_timeout](https://www.sqlite.org/pragma.html#pragma_busy_timeout) |
91| Case Sensitive LIKE | `_case_sensitive_like` \| `_cslike` | `boolean` | For more information see [PRAGMA case_sensitive_like](https://www.sqlite.org/pragma.html#pragma_case_sensitive_like) |
92| Defer Foreign Keys | `_defer_foreign_keys` \| `_defer_fk` | `boolean` | For more information see [PRAGMA defer_foreign_keys](https://www.sqlite.org/pragma.html#pragma_defer_foreign_keys) |
93| Foreign Keys | `_foreign_keys` \| `_fk` | `boolean` | For more information see [PRAGMA foreign_keys](https://www.sqlite.org/pragma.html#pragma_foreign_keys) |
94| Ignore CHECK Constraints | `_ignore_check_constraints` | `boolean` | For more information see [PRAGMA ignore_check_constraints](https://www.sqlite.org/pragma.html#pragma_ignore_check_constraints) |
95| Immutable | `immutable` | `boolean` | For more information see [Immutable](https://www.sqlite.org/c3ref/open.html) |
96| Journal Mode | `_journal_mode` \| `_journal` | <ul><li>DELETE</li><li>TRUNCATE</li><li>PERSIST</li><li>MEMORY</li><li>WAL</li><li>OFF</li></ul> | For more information see [PRAGMA journal_mode](https://www.sqlite.org/pragma.html#pragma_journal_mode) |
97| Locking Mode | `_locking_mode` \| `_locking` | <ul><li>NORMAL</li><li>EXCLUSIVE</li></ul> | For more information see [PRAGMA locking_mode](https://www.sqlite.org/pragma.html#pragma_locking_mode) |
98| Mode | `mode` | <ul><li>ro</li><li>rw</li><li>rwc</li><li>memory</li></ul> | Access Mode of the database. For more information see [SQLite Open](https://www.sqlite.org/c3ref/open.html) |
99| Mutex Locking | `_mutex` | <ul><li>no</li><li>full</li></ul> | Specify mutex mode. |
100| Query Only | `_query_only` | `boolean` | For more information see [PRAGMA query_only](https://www.sqlite.org/pragma.html#pragma_query_only) |
101| Recursive Triggers | `_recursive_triggers` \| `_rt` | `boolean` | For more information see [PRAGMA recursive_triggers](https://www.sqlite.org/pragma.html#pragma_recursive_triggers) |
102| Secure Delete | `_secure_delete` | `boolean` \| `FAST` | For more information see [PRAGMA secure_delete](https://www.sqlite.org/pragma.html#pragma_secure_delete) |
103| Shared-Cache Mode | `cache` | <ul><li>shared</li><li>private</li></ul> | Set cache mode for more information see [sqlite.org](https://www.sqlite.org/sharedcache.html) |
104| Synchronous | `_synchronous` \| `_sync` | <ul><li>0 \| OFF</li><li>1 \| NORMAL</li><li>2 \| FULL</li><li>3 \| EXTRA</li></ul> | For more information see [PRAGMA synchronous](https://www.sqlite.org/pragma.html#pragma_synchronous) |
105| Time Zone Location | `_loc` | auto | Specify location of time format. |
106| Transaction Lock | `_txlock` | <ul><li>immediate</li><li>deferred</li><li>exclusive</li></ul> | Specify locking behavior for transactions. |
107| Writable Schema | `_writable_schema` | `Boolean` | When this pragma is on, the SQLITE_MASTER tables in which database can be changed using ordinary UPDATE, INSERT, and DELETE statements. Warning: misuse of this pragma can easily result in a corrupt database file. |
108
109## DSN Examples
110
111```
112file:test.db?cache=shared&mode=memory
113```
114
115# Features
116
117This package allows additional configuration of features available within SQLite3 to be enabled or disabled by golang build constraints also known as build `tags`.
118
119[Click here for more information about build tags / constraints.](https://golang.org/pkg/go/build/#hdr-Build_Constraints)
120
121### Usage
122
123If you wish to build this library with additional extensions / features.
124Use the following command.
125
126```bash
127go build --tags "<FEATURE>"
128```
129
130For available features see the extension list.
131When using multiple build tags, all the different tags should be space delimted.
132
133Example:
134
135```bash
136go build --tags "icu json1 fts5 secure_delete"
137```
138
139### Feature / Extension List
140
141| Extension | Build Tag | Description |
142|-----------|-----------|-------------|
143| Additional Statistics | sqlite_stat4 | This option adds additional logic to the ANALYZE command and to the query planner that can help SQLite to chose a better query plan under certain situations. The ANALYZE command is enhanced to collect histogram data from all columns of every index and store that data in the sqlite_stat4 table.<br><br>The query planner will then use the histogram data to help it make better index choices. The downside of this compile-time option is that it violates the query planner stability guarantee making it more difficult to ensure consistent performance in mass-produced applications.<br><br>SQLITE_ENABLE_STAT4 is an enhancement of SQLITE_ENABLE_STAT3. STAT3 only recorded histogram data for the left-most column of each index whereas the STAT4 enhancement records histogram data from all columns of each index.<br><br>The SQLITE_ENABLE_STAT3 compile-time option is a no-op and is ignored if the SQLITE_ENABLE_STAT4 compile-time option is used |
144| Allow URI Authority | sqlite_allow_uri_authority | URI filenames normally throws an error if the authority section is not either empty or "localhost".<br><br>However, if SQLite is compiled with the SQLITE_ALLOW_URI_AUTHORITY compile-time option, then the URI is converted into a Uniform Naming Convention (UNC) filename and passed down to the underlying operating system that way |
145| App Armor | sqlite_app_armor | When defined, this C-preprocessor macro activates extra code that attempts to detect misuse of the SQLite API, such as passing in NULL pointers to required parameters or using objects after they have been destroyed. <br><br>App Armor is not available under `Windows`. |
146| Disable Load Extensions | sqlite_omit_load_extension | Loading of external extensions is enabled by default.<br><br>To disable extension loading add the build tag `sqlite_omit_load_extension`. |
147| Foreign Keys | sqlite_foreign_keys | This macro determines whether enforcement of foreign key constraints is enabled or disabled by default for new database connections.<br><br>Each database connection can always turn enforcement of foreign key constraints on and off and run-time using the foreign_keys pragma.<br><br>Enforcement of foreign key constraints is normally off by default, but if this compile-time parameter is set to 1, enforcement of foreign key constraints will be on by default |
148| Full Auto Vacuum | sqlite_vacuum_full | Set the default auto vacuum to full |
149| Incremental Auto Vacuum | sqlite_vacuum_incr | Set the default auto vacuum to incremental |
150| Full Text Search Engine | sqlite_fts5 | When this option is defined in the amalgamation, versions 5 of the full-text search engine (fts5) is added to the build automatically |
151|  International Components for Unicode | sqlite_icu | This option causes the International Components for Unicode or "ICU" extension to SQLite to be added to the build |
152| Introspect PRAGMAS | sqlite_introspect | This option adds some extra PRAGMA statements. <ul><li>PRAGMA function_list</li><li>PRAGMA module_list</li><li>PRAGMA pragma_list</li></ul> |
153| JSON SQL Functions | sqlite_json | When this option is defined in the amalgamation, the JSON SQL functions are added to the build automatically |
154| Secure Delete | sqlite_secure_delete | This compile-time option changes the default setting of the secure_delete pragma.<br><br>When this option is not used, secure_delete defaults to off. When this option is present, secure_delete defaults to on.<br><br>The secure_delete setting causes deleted content to be overwritten with zeros. There is a small performance penalty since additional I/O must occur.<br><br>On the other hand, secure_delete can prevent fragments of sensitive information from lingering in unused parts of the database file after it has been deleted. See the documentation on the secure_delete pragma for additional information |
155| Secure Delete (FAST) | sqlite_secure_delete_fast | For more information see [PRAGMA secure_delete](https://www.sqlite.org/pragma.html#pragma_secure_delete) |
156| Tracing / Debug | sqlite_trace | Activate trace functions |
157| User Authentication | sqlite_userauth | SQLite User Authentication see [User Authentication](#user-authentication) for more information. |
158
159# Compilation
160
161This package requires `CGO_ENABLED=1` ennvironment variable if not set by default, and the presence of the `gcc` compiler.
162
163If you need to add additional CFLAGS or LDFLAGS to the build command, and do not want to modify this package. Then this can be achieved by  using the `CGO_CFLAGS` and `CGO_LDFLAGS` environment variables.
164
165## Android
166
167This package can be compiled for android.
168Compile with:
169
170```bash
171go build --tags "android"
172```
173
174For more information see [#201](https://github.com/mattn/go-sqlite3/issues/201)
175
176# ARM
177
178To compile for `ARM` use the following environment.
179
180```bash
181env CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ \
182    CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7 \
183    go build -v
184```
185
186Additional information:
187- [#242](https://github.com/mattn/go-sqlite3/issues/242)
188- [#504](https://github.com/mattn/go-sqlite3/issues/504)
189
190# Cross Compile
191
192This library can be cross-compiled.
193
194In some cases you are required to the `CC` environment variable with the cross compiler.
195
196Additional information:
197- [#491](https://github.com/mattn/go-sqlite3/issues/491)
198- [#560](https://github.com/mattn/go-sqlite3/issues/560)
199
200# Google Cloud Platform
201
202Building on GCP is not possible because Google Cloud Platform does not allow `gcc` to be executed.
203
204Please work only with compiled final binaries.
205
206## Linux
207
208To compile this package on Linux you must install the development tools for your linux distribution.
209
210To compile under linux use the build tag `linux`.
211
212```bash
213go build --tags "linux"
214```
215
216If you wish to link directly to libsqlite3 then you can use the `libsqlite3` build tag.
217
218```
219go build --tags "libsqlite3 linux"
220```
221
222### Alpine
223
224When building in an `alpine` container run the following command before building.
225
226```
227apk add --update gcc musl-dev
228```
229
230### Fedora
231
232```bash
233sudo yum groupinstall "Development Tools" "Development Libraries"
234```
235
236### Ubuntu
237
238```bash
239sudo apt-get install build-essential
240```
241
242## Mac OSX
243
244OSX should have all the tools present to compile this package, if not install XCode this will add all the developers tools.
245
246Required dependency
247
248```bash
249brew install sqlite3
250```
251
252For OSX there is an additional package install which is required if you whish to build the `icu` extension.
253
254This additional package can be installed with `homebrew`.
255
256```bash
257brew upgrade icu4c
258```
259
260To compile for Mac OSX.
261
262```bash
263go build --tags "darwin"
264```
265
266If you wish to link directly to libsqlite3 then you can use the `libsqlite3` build tag.
267
268```
269go build --tags "libsqlite3 darwin"
270```
271
272Additional information:
273- [#206](https://github.com/mattn/go-sqlite3/issues/206)
274- [#404](https://github.com/mattn/go-sqlite3/issues/404)
275
276## Windows
277
278To compile this package on Windows OS you must have the `gcc` compiler installed.
279
2801) Install a Windows `gcc` toolchain.
2812) Add the `bin` folders to the Windows path if the installer did not do this by default.
2823) Open a terminal for the TDM-GCC toolchain, can be found in the Windows Start menu.
2834) Navigate to your project folder and run the `go build ...` command for this package.
284
285For example the TDM-GCC Toolchain can be found [here](ttps://sourceforge.net/projects/tdm-gcc/).
286
287## Errors
288
289- Compile error: `can not be used when making a shared object; recompile with -fPIC`
290
291    When receiving a compile time error referencing recompile with `-FPIC` then you
292    are probably using a hardend system.
293
294    You can compile the library on a hardend system with the following command.
295
296    ```bash
297    go build -ldflags '-extldflags=-fno-PIC'
298    ```
299
300    More details see [#120](https://github.com/mattn/go-sqlite3/issues/120)
301
302- Can't build go-sqlite3 on windows 64bit.
303
304    > Probably, you are using go 1.0, go1.0 has a problem when it comes to compiling/linking on windows 64bit.
305    > See: [#27](https://github.com/mattn/go-sqlite3/issues/27)
306
307- `go get github.com/mattn/go-sqlite3` throws compilation error.
308
309    `gcc` throws: `internal compiler error`
310
311    Remove the download repository from your disk and try re-install with:
312
313    ```bash
314    go install github.com/mattn/go-sqlite3
315    ```
316
317# User Authentication
318
319This package supports the SQLite User Authentication module.
320
321## Compile
322
323To use the User authentication module the package has to be compiled with the tag `sqlite_userauth`. See [Features](#features).
324
325## Usage
326
327### Create protected database
328
329To create a database protected by user authentication provide the following argument to the connection string `_auth`.
330This will enable user authentication within the database. This option however requires two additional arguments:
331
332- `_auth_user`
333- `_auth_pass`
334
335When `_auth` is present on the connection string user authentication will be enabled and the provided user will be created
336as an `admin` user. After initial creation, the parameter `_auth` has no effect anymore and can be omitted from the connection string.
337
338Example connection string:
339
340Create an user authentication database with user `admin` and password `admin`.
341
342`file:test.s3db?_auth&_auth_user=admin&_auth_pass=admin`
343
344Create an user authentication database with user `admin` and password `admin` and use `SHA1` for the password encoding.
345
346`file:test.s3db?_auth&_auth_user=admin&_auth_pass=admin&_auth_crypt=sha1`
347
348### Password Encoding
349
350The passwords within the user authentication module of SQLite are encoded with the SQLite function `sqlite_cryp`.
351This function uses a ceasar-cypher which is quite insecure.
352This library provides several additional password encoders which can be configured through the connection string.
353
354The password cypher can be configured with the key `_auth_crypt`. And if the configured password encoder also requires an
355salt this can be configured with `_auth_salt`.
356
357#### Available Encoders
358
359- SHA1
360- SSHA1 (Salted SHA1)
361- SHA256
362- SSHA256 (salted SHA256)
363- SHA384
364- SSHA384 (salted SHA384)
365- SHA512
366- SSHA512 (salted SHA512)
367
368### Restrictions
369
370Operations on the database regarding to user management can only be preformed by an administrator user.
371
372### Support
373
374The user authentication supports two kinds of users
375
376- administrators
377- regular users
378
379### User Management
380
381User management can be done by directly using the `*SQLiteConn` or by SQL.
382
383#### SQL
384
385The following sql functions are available for user management.
386
387| Function | Arguments | Description |
388|----------|-----------|-------------|
389| `authenticate` | username `string`, password `string` | Will authenticate an user, this is done by the connection; and should not be used manually. |
390| `auth_user_add` | username `string`, password `string`, admin `int` | This function will add an user to the database.<br>if the database is not protected by user authentication it will enable it. Argument `admin` is an integer identifying if the added user should be an administrator. Only Administrators can add administrators. |
391| `auth_user_change` | username `string`, password `string`, admin `int` | Function to modify an user. Users can change their own password, but only an administrator can change the administrator flag. |
392| `authUserDelete` | username `string` | Delete an user from the database. Can only be used by an administrator. The current logged in administrator cannot be deleted. This is to make sure their is always an administrator remaining. |
393
394These functions will return an integer.
395
396- 0 (SQLITE_OK)
397- 23 (SQLITE_AUTH) Failed to perform due to authentication or insufficient privileges
398
399##### Examples
400
401```sql
402// Autheticate user
403// Create Admin User
404SELECT auth_user_add('admin2', 'admin2', 1);
405
406// Change password for user
407SELECT auth_user_change('user', 'userpassword', 0);
408
409// Delete user
410SELECT user_delete('user');
411```
412
413#### *SQLiteConn
414
415The following functions are available for User authentication from the `*SQLiteConn`.
416
417| Function | Description |
418|----------|-------------|
419| `Authenticate(username, password string) error` | Authenticate user |
420| `AuthUserAdd(username, password string, admin bool) error` | Add user |
421| `AuthUserChange(username, password string, admin bool) error` | Modify user |
422| `AuthUserDelete(username string) error` | Delete user |
423
424### Attached database
425
426When using attached databases. SQLite will use the authentication from the `main` database for the attached database(s).
427
428# Extensions
429
430If you want your own extension to be listed here or you want to add a reference to an extension; please submit an Issue for this.
431
432## Spatialite
433
434Spatialite is available as an extension to SQLite, and can be used in combination with this repository.
435For an example see [shaxbee/go-spatialite](https://github.com/shaxbee/go-spatialite).
436
437# FAQ
438
439- Getting insert error while query is opened.
440
441    > You can pass some arguments into the connection string, for example, a URI.
442    > See: [#39](https://github.com/mattn/go-sqlite3/issues/39)
443
444- Do you want to cross compile? mingw on Linux or Mac?
445
446    > See: [#106](https://github.com/mattn/go-sqlite3/issues/106)
447    > See also: http://www.limitlessfx.com/cross-compile-golang-app-for-windows-from-linux.html
448
449- Want to get time.Time with current locale
450
451    Use `_loc=auto` in SQLite3 filename schema like `file:foo.db?_loc=auto`.
452
453- Can I use this in multiple routines concurrently?
454
455    Yes for readonly. But, No for writable. See [#50](https://github.com/mattn/go-sqlite3/issues/50), [#51](https://github.com/mattn/go-sqlite3/issues/51), [#209](https://github.com/mattn/go-sqlite3/issues/209), [#274](https://github.com/mattn/go-sqlite3/issues/274).
456
457- Why I'm getting `no such table` error?
458
459    Why is it racy if I use a `sql.Open("sqlite3", ":memory:")` database?
460
461    Each connection to :memory: opens a brand new in-memory sql database, so if
462    the stdlib's sql engine happens to open another connection and you've only
463    specified ":memory:", that connection will see a brand new database. A
464    workaround is to use "file::memory:?mode=memory&cache=shared". Every
465    connection to this string will point to the same in-memory database.
466
467    For more information see
468    * [#204](https://github.com/mattn/go-sqlite3/issues/204)
469    * [#511](https://github.com/mattn/go-sqlite3/issues/511)
470
471- Reading from database with large amount of goroutines fails on OSX.
472
473    OS X limits OS-wide to not have more than 1000 files open simultaneously by default.
474
475    For more information see [#289](https://github.com/mattn/go-sqlite3/issues/289)
476
477- Trying to execute a `.` (dot) command throws an error.
478
479    Error: `Error: near ".": syntax error`
480    Dot command are part of SQLite3 CLI not of this library.
481
482    You need to implement the feature or call the sqlite3 cli.
483
484    More infomation see [#305](https://github.com/mattn/go-sqlite3/issues/305)
485
486- Error: `database is locked`
487
488    When you get an database is locked. Please use the following options.
489
490    Add to DSN: `cache=shared`
491
492    Example:
493    ```go
494    db, err := sql.Open("sqlite3", "file:locked.sqlite?cache=shared")
495    ```
496
497    Second please set the database connections of the SQL package to 1.
498
499    ```go
500    db.SetMaxOpenConn(1)
501    ```
502
503    More information see [#209](https://github.com/mattn/go-sqlite3/issues/209)
504
505# License
506
507MIT: http://mattn.mit-license.org/2018
508
509sqlite3-binding.c, sqlite3-binding.h, sqlite3ext.h
510
511The -binding suffix was added to avoid build failures under gccgo.
512
513In this repository, those files are an amalgamation of code that was copied from SQLite3. The license of that code is the same as the license of SQLite3.
514
515# Author
516
517Yasuhiro Matsumoto (a.k.a mattn)
518
519G.J.R. Timmer
520