[822] | 1 | // Copyright 2017 The Sqlite Authors. All rights reserved.
|
---|
| 2 | // Use of this source code is governed by a BSD-style
|
---|
| 3 | // license that can be found in the LICENSE file.
|
---|
| 4 |
|
---|
| 5 | // Package sqlite is a sql/database driver using a CGo-free port of the C
|
---|
| 6 | // SQLite3 library.
|
---|
| 7 | //
|
---|
| 8 | // SQLite is an in-process implementation of a self-contained, serverless,
|
---|
| 9 | // zero-configuration, transactional SQL database engine.
|
---|
| 10 | //
|
---|
| 11 | // Thanks
|
---|
| 12 | //
|
---|
| 13 | // This project is sponsored by Schleibinger Geräte Teubert u. Greim GmbH by
|
---|
| 14 | // allowing one of the maintainers to work on it also in office hours.
|
---|
| 15 | //
|
---|
| 16 | // Supported platforms and architectures
|
---|
| 17 | //
|
---|
| 18 | // These combinations of GOOS and GOARCH are currently supported
|
---|
| 19 | //
|
---|
| 20 | // OS Arch SQLite version
|
---|
| 21 | // ------------------------------
|
---|
| 22 | // darwin amd64 3.41.0
|
---|
| 23 | // darwin arm64 3.41.0
|
---|
| 24 | // freebsd amd64 3.41.0
|
---|
| 25 | // freebsd arm64 3.41.0
|
---|
| 26 | // linux 386 3.41.0
|
---|
| 27 | // linux amd64 3.41.0
|
---|
| 28 | // linux arm 3.41.0
|
---|
| 29 | // linux arm64 3.41.0
|
---|
| 30 | // linux ppc64le 3.41.0
|
---|
| 31 | // linux riscv64 3.41.0
|
---|
| 32 | // windows amd64 3.41.0
|
---|
| 33 | // windows arm64 3.41.0
|
---|
| 34 | //
|
---|
| 35 | // Builders
|
---|
| 36 | //
|
---|
| 37 | // Builder results available at
|
---|
| 38 | //
|
---|
| 39 | // https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2fsqlite
|
---|
| 40 | //
|
---|
| 41 | // Changelog
|
---|
| 42 | //
|
---|
| 43 | // 2023-02-23 v1.21.0:
|
---|
| 44 | //
|
---|
| 45 | // Upgrade to SQLite 3.41.0, release notes at https://sqlite.org/releaselog/3_41_0.html.
|
---|
| 46 | //
|
---|
| 47 | // 2022-11-28 v1.20.0
|
---|
| 48 | //
|
---|
| 49 | // Support linux/ppc64le.
|
---|
| 50 | //
|
---|
| 51 | // 2022-09-16 v1.19.0:
|
---|
| 52 | //
|
---|
| 53 | // Support frebsd/arm64.
|
---|
| 54 | //
|
---|
| 55 | // 2022-07-26 v1.18.0:
|
---|
| 56 | //
|
---|
| 57 | // Adds support for Go fs.FS based SQLite virtual filesystems, see function New
|
---|
| 58 | // in modernc.org/sqlite/vfs and/or TestVFS in all_test.go
|
---|
| 59 | //
|
---|
| 60 | // 2022-04-24 v1.17.0:
|
---|
| 61 | //
|
---|
| 62 | // Support windows/arm64.
|
---|
| 63 | //
|
---|
| 64 | // 2022-04-04 v1.16.0:
|
---|
| 65 | //
|
---|
| 66 | // Support scalar application defined functions written in Go.
|
---|
| 67 | //
|
---|
| 68 | // https://www.sqlite.org/appfunc.html
|
---|
| 69 | //
|
---|
| 70 | // 2022-03-13 v1.15.0:
|
---|
| 71 | //
|
---|
| 72 | // Support linux/riscv64.
|
---|
| 73 | //
|
---|
| 74 | // 2021-11-13 v1.14.0:
|
---|
| 75 | //
|
---|
| 76 | // Support windows/amd64. This target had previously only experimental status
|
---|
| 77 | // because of a now resolved memory leak.
|
---|
| 78 | //
|
---|
| 79 | // 2021-09-07 v1.13.0:
|
---|
| 80 | //
|
---|
| 81 | // Support freebsd/amd64.
|
---|
| 82 | //
|
---|
| 83 | // Changelog
|
---|
| 84 | //
|
---|
| 85 | // 2021-06-23 v1.11.0:
|
---|
| 86 | //
|
---|
| 87 | // Upgrade to use sqlite 3.36.0, release notes at https://www.sqlite.org/releaselog/3_36_0.html.
|
---|
| 88 | //
|
---|
| 89 | // 2021-05-06 v1.10.6:
|
---|
| 90 | //
|
---|
| 91 | // Fixes a memory corruption issue
|
---|
| 92 | // (https://gitlab.com/cznic/sqlite/-/issues/53). Versions since v1.8.6 were
|
---|
| 93 | // affected and should be updated to v1.10.6.
|
---|
| 94 | //
|
---|
| 95 | // 2021-03-14 v1.10.0:
|
---|
| 96 | //
|
---|
| 97 | // Update to use sqlite 3.35.0, release notes at https://www.sqlite.org/releaselog/3_35_0.html.
|
---|
| 98 | //
|
---|
| 99 | // 2021-03-11 v1.9.0:
|
---|
| 100 | //
|
---|
| 101 | // Support darwin/arm64.
|
---|
| 102 | //
|
---|
| 103 | // 2021-01-08 v1.8.0:
|
---|
| 104 | //
|
---|
| 105 | // Support darwin/amd64.
|
---|
| 106 | //
|
---|
| 107 | // 2020-09-13 v1.7.0:
|
---|
| 108 | //
|
---|
| 109 | // Support linux/arm and linux/arm64.
|
---|
| 110 | //
|
---|
| 111 | // 2020-09-08 v1.6.0:
|
---|
| 112 | //
|
---|
| 113 | // Support linux/386.
|
---|
| 114 | //
|
---|
| 115 | // 2020-09-03 v1.5.0:
|
---|
| 116 | //
|
---|
| 117 | // This project is now completely CGo-free, including the Tcl tests.
|
---|
| 118 | //
|
---|
| 119 | // 2020-08-26 v1.4.0:
|
---|
| 120 | //
|
---|
| 121 | // First stable release for linux/amd64. The database/sql driver and its tests
|
---|
| 122 | // are CGo free. Tests of the translated sqlite3.c library still require CGo.
|
---|
| 123 | //
|
---|
| 124 | // $ make full
|
---|
| 125 | //
|
---|
| 126 | // ...
|
---|
| 127 | //
|
---|
| 128 | // SQLite 2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
|
---|
| 129 | // 0 errors out of 928271 tests on 3900x Linux 64-bit little-endian
|
---|
| 130 | // WARNING: Multi-threaded tests skipped: Linked against a non-threadsafe Tcl build
|
---|
| 131 | // All memory allocations freed - no leaks
|
---|
| 132 | // Maximum memory usage: 9156360 bytes
|
---|
| 133 | // Current memory usage: 0 bytes
|
---|
| 134 | // Number of malloc() : -1 calls
|
---|
| 135 | // --- PASS: TestTclTest (1785.04s)
|
---|
| 136 | // PASS
|
---|
| 137 | // ok modernc.org/sqlite 1785.041s
|
---|
| 138 | // $
|
---|
| 139 | //
|
---|
| 140 | // 2020-07-26 v1.4.0-beta1:
|
---|
| 141 | //
|
---|
| 142 | // The project has reached beta status while supporting linux/amd64 only at the
|
---|
| 143 | // moment. The 'extraquick' Tcl testsuite reports
|
---|
| 144 | //
|
---|
| 145 | // 630 errors out of 200177 tests on Linux 64-bit little-endian
|
---|
| 146 | //
|
---|
| 147 | // and some memory leaks
|
---|
| 148 | //
|
---|
| 149 | // Unfreed memory: 698816 bytes in 322 allocations
|
---|
| 150 | //
|
---|
| 151 | // 2019-12-28 v1.2.0-alpha.3: Third alpha fixes issue #19.
|
---|
| 152 | //
|
---|
| 153 | // It also bumps the minor version as the repository was wrongly already tagged
|
---|
| 154 | // with v1.1.0 before. Even though the tag was deleted there are proxies that
|
---|
| 155 | // cached that tag. Thanks /u/garaktailor for detecting the problem and
|
---|
| 156 | // suggesting this solution.
|
---|
| 157 | //
|
---|
| 158 | // 2019-12-26 v1.1.0-alpha.2: Second alpha release adds support for accessing a
|
---|
| 159 | // database concurrently by multiple goroutines and/or processes. v1.1.0 is now
|
---|
| 160 | // considered feature-complete. Next planed release should be a beta with a
|
---|
| 161 | // proper test suite.
|
---|
| 162 | //
|
---|
| 163 | // 2019-12-18 v1.1.0-alpha.1: First alpha release using the new cc/v3, gocc,
|
---|
| 164 | // qbe toolchain. Some primitive tests pass on linux_{amd64,386}. Not yet safe
|
---|
| 165 | // for concurrent access by multiple goroutines. Next alpha release is planed
|
---|
| 166 | // to arrive before the end of this year.
|
---|
| 167 | //
|
---|
| 168 | // 2017-06-10 Windows/Intel no more uses the VM (thanks Steffen Butzer).
|
---|
| 169 | //
|
---|
| 170 | // 2017-06-05 Linux/Intel no more uses the VM (cznic/virtual).
|
---|
| 171 | //
|
---|
| 172 | // Connecting to a database
|
---|
| 173 | //
|
---|
| 174 | // To access a Sqlite database do something like
|
---|
| 175 | //
|
---|
| 176 | // import (
|
---|
| 177 | // "database/sql"
|
---|
| 178 | //
|
---|
| 179 | // _ "modernc.org/sqlite"
|
---|
| 180 | // )
|
---|
| 181 | //
|
---|
| 182 | // ...
|
---|
| 183 | //
|
---|
| 184 | //
|
---|
| 185 | // db, err := sql.Open("sqlite", dsnURI)
|
---|
| 186 | //
|
---|
| 187 | // ...
|
---|
| 188 | //
|
---|
| 189 | // Debug and development versions
|
---|
| 190 | //
|
---|
| 191 | // A comma separated list of options can be passed to `go generate` via the
|
---|
| 192 | // environment variable GO_GENERATE. Some useful options include for example:
|
---|
| 193 | //
|
---|
| 194 | // -DSQLITE_DEBUG
|
---|
| 195 | // -DSQLITE_MEM_DEBUG
|
---|
| 196 | // -ccgo-verify-structs
|
---|
| 197 | //
|
---|
| 198 | // To create a debug/development version, issue for example:
|
---|
| 199 | //
|
---|
| 200 | // $ GO_GENERATE=-DSQLITE_DEBUG,-DSQLITE_MEM_DEBUG go generate
|
---|
| 201 | //
|
---|
| 202 | // Note: To run `go generate` you need to have modernc.org/ccgo/v3 installed.
|
---|
| 203 | //
|
---|
| 204 | // Sqlite documentation
|
---|
| 205 | //
|
---|
| 206 | // See https://sqlite.org/docs.html
|
---|
| 207 | package sqlite // import "modernc.org/sqlite"
|
---|