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
~~**NOTE:** The increase to v2 was an accident. There were no major changes or features.~~
13
13
14
14
# Description
15
15
16
-
sqlite3 driver conforming to the built-in database/sql interface
16
+
A sqlite3 driver that conforms to the built-in database/sql interface.
17
17
18
-
Supported Golang version: See [.github/workflows/go.yaml](./.github/workflows/go.yaml)
18
+
Supported Golang version: See [.github/workflows/go.yaml](./.github/workflows/go.yaml).
19
19
20
-
[This package follows the official Golang Release Policy.](https://golang.org/doc/devel/release.html#policy)
20
+
This package follows the official [Golang Release Policy](https://golang.org/doc/devel/release.html#policy).
21
21
22
22
### Overview
23
23
@@ -64,36 +64,36 @@ Supported Golang version: See [.github/workflows/go.yaml](./.github/workflows/go
64
64
65
65
# Installation
66
66
67
-
This package can be installed with the go get command:
67
+
This package can be installed with the `go get` command:
68
68
69
69
go get github.com/mattn/go-sqlite3
70
70
71
71
_go-sqlite3_ is *cgo* package.
72
72
If you want to build your app using go-sqlite3, you need gcc.
73
73
However, 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.
74
74
75
-
***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.***
75
+
***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.***
76
76
77
77
# API Reference
78
78
79
-
API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite3
79
+
API documentation can be found [here](http://godoc.org/github.com/mattn/go-sqlite3).
80
80
81
-
Examples can be found under the [examples](./_example) directory
81
+
Examples can be found under the [examples](./_example) directory.
82
82
83
83
# Connection String
84
84
85
85
When creating a new SQLite database or connection to an existing one, with the file name additional options can be given.
86
-
This is also known as a DSN string. (Data Source Name).
86
+
This is also known as a DSN (Data Source Name) string.
87
87
88
88
Options are append after the filename of the SQLite database.
89
-
The database filename and options are seperated by an `?` (Question Mark).
89
+
The database filename and options are separated by an `?` (Question Mark).
90
90
Options should be URL-encoded (see [url.QueryEscape](https://golang.org/pkg/net/url/#QueryEscape)).
91
91
92
92
This also applies when using an in-memory database instead of a file.
93
93
94
94
Options can be given using the following format: `KEYWORD=VALUE` and multiple options can be combined with the `&` ampersand.
95
95
96
-
This library supports dsn options of SQLite itself and provides additional options.
96
+
This library supports DSN options of SQLite itself and provides additional options.
This package allows additional configuration of features available within SQLite3 to be enabled or disabled by golang build constraints also known as build `tags`.
140
140
141
-
[Click here for more information about build tags / constraints.](https://golang.org/pkg/go/build/#hdr-Build_Constraints)
141
+
Click [here](https://golang.org/pkg/go/build/#hdr-Build_Constraints) for more information about build tags / constraints.
142
142
143
143
### Usage
144
144
145
-
If you wish to build this library with additional extensions / features.
146
-
Use the following command.
145
+
If you wish to build this library with additional extensions / features, use the following command:
147
146
148
147
```bash
149
148
go build --tags "<FEATURE>"
150
149
```
151
150
152
-
For available features see the extension list.
153
-
When using multiple build tags, all the different tags should be space delimted.
151
+
For available features, see the extension list.
152
+
When using multiple build tags, all the different tags should be space delimited.
This package requires `CGO_ENABLED=1` ennvironment variable if not set by default, and the presence of the `gcc` compiler.
183
+
This package requires the `CGO_ENABLED=1` ennvironment variable if not set by default, and the presence of the `gcc` compiler.
185
184
186
-
If 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.
185
+
If 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.
187
186
188
187
## Android
189
188
@@ -198,7 +197,7 @@ For more information see [#201](https://github.com/mattn/go-sqlite3/issues/201)
198
197
199
198
# ARM
200
199
201
-
To compile for `ARM` use the following environment.
200
+
To compile for `ARM` use the following environment:
@@ -396,11 +395,11 @@ salt this can be configured with `_auth_salt`.
396
395
397
396
### Restrictions
398
397
399
-
Operations on the database regarding to user management can only be preformed by an administrator user.
398
+
Operations on the database regarding user management can only be preformed by an administrator user.
400
399
401
400
### Support
402
401
403
-
The user authentication supports two kinds of users
402
+
The user authentication supports two kinds of users:
404
403
405
404
- administrators
406
405
- regular users
@@ -411,7 +410,7 @@ User management can be done by directly using the `*SQLiteConn` or by SQL.
411
410
412
411
#### SQL
413
412
414
-
The following sql functions are available for user management.
413
+
The following sql functions are available for user management:
415
414
416
415
| Function | Arguments | Description |
417
416
|----------|-----------|-------------|
@@ -420,7 +419,7 @@ The following sql functions are available for user management.
420
419
| `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. |
421
420
| `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. |
422
421
423
-
These functions will return an integer.
422
+
These functions will return an integer:
424
423
425
424
- 0 (SQLITE_OK)
426
425
- 23 (SQLITE_AUTH) Failed to perform due to authentication or insufficient privileges
@@ -441,7 +440,7 @@ SELECT user_delete('user');
441
440
442
441
#### *SQLiteConn
443
442
444
-
The following functions are available for User authentication from the `*SQLiteConn`.
443
+
The following functions are available for User authentication from the `*SQLiteConn`:
445
444
446
445
| Function | Description |
447
446
|----------|-------------|
@@ -452,16 +451,16 @@ The following functions are available for User authentication from the `*SQLiteC
452
451
453
452
### Attached database
454
453
455
-
When using attached databases. SQLite will use the authentication from the `main` database for the attached database(s).
454
+
When using attached databases, SQLite will use the authentication from the `main` database for the attached database(s).
456
455
457
456
# Extensions
458
457
459
-
If 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.
458
+
If 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.
460
459
461
460
## Spatialite
462
461
463
462
Spatialite is available as an extension to SQLite, and can be used in combination with this repository.
464
-
For an example see [shaxbee/go-spatialite](https://github.com/shaxbee/go-spatialite).
463
+
For an example, see [shaxbee/go-spatialite](https://github.com/shaxbee/go-spatialite).
465
464
466
465
## extension-functions.c from SQLite3 Contrib
467
466
@@ -471,7 +470,7 @@ extension-functions.c is available as an extension to SQLite, and provides the f
For an example see [dinedal/go-sqlite3-extension-functions](https://github.com/dinedal/go-sqlite3-extension-functions).
473
+
For an example, see [dinedal/go-sqlite3-extension-functions](https://github.com/dinedal/go-sqlite3-extension-functions).
475
474
476
475
# FAQ
477
476
@@ -491,7 +490,7 @@ For an example see [dinedal/go-sqlite3-extension-functions](https://github.com/d
491
490
492
491
- Can I use this in multiple routines concurrently?
493
492
494
-
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).
493
+
Yes for readonly. But not 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).
495
494
496
495
- Why I'm getting `no such table` error?
497
496
@@ -505,7 +504,7 @@ For an example see [dinedal/go-sqlite3-extension-functions](https://github.com/d
505
504
506
505
Note that if the last database connection in the pool closes, the in-memory database is deleted. Make sure the [max idle connection limit](https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns) is > 0, and the [connection lifetime](https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime) is infinite.
0 commit comments