Commit Graph

47 Commits

Author SHA1 Message Date
Tim Van Baak
cff37b40bd Fix json example
Because of sqlite's flexible typing, even though the column was declared as jsonb, the values are stored as the TEXT-typed json because they're converted to strings by Value/Scan. If the table is strict with a BLOB column, the example fails because of the type mismatch. This can be fixed by using the `jsonb()` function to convert incoming string-typed json and the `json()` function to convert outgoing binary-typed jsonb. The example is expanded to show both of these approaches.

Note that both approaches use the same string-typed marshalling functions because the conversion to jsonb occurs within sqlite3, not within the Go code. SQLite docs state that the binary format is internal and applications shouldn't try to generate it: https://sqlite.org/json1.html#jsonb
2025-01-21 06:42:16 -08:00
Yasuhiro Matsumoto
64bbe6202c add example 2024-01-25 23:34:36 +09:00
Yasuhiro Matsumoto
c91bca4fb4 update go version to 1.19 2024-01-25 22:55:22 +09:00
Diego Becciolini
d9e2789502 temporary fix to make the job pass
use same workaround as https://github.com/authelia/authelia/pull/6404
before https://github.com/mattn/go-sqlite3/pull/1177 fixes the build
otherwise
2023-12-14 10:25:47 +09:00
Diego Becciolini
c260ecf7e4 use locally checked out lib in the docker job
see https://github.com/mattn/go-sqlite3/pull/1177
2023-12-14 10:25:47 +09:00
Andrew Zhang
edc3bb6955 Fix virtual table example. (#1149) 2023-04-05 22:46:26 -04:00
David Vassallo
4b8633cceb Updating vtable example, "BestIndex" method (#1099)
As it was, the vtable example will give an error when adding any kind of SQL constraint in the SQL statement. Updating the BestIndex method will ensure that adding SQL constraints will not result in errors

Signed-off-by: David Vassallo <davevassallo@gmail.com>

Signed-off-by: David Vassallo <davevassallo@gmail.com>
2022-10-18 19:04:52 -04:00
KiYugadgeter
7476442ed6 こんにちわ is wrong Japanse. The correct word is こんにちは 2022-09-04 18:00:08 +09:00
Kristóf Havasi
b819467576 Add error checking in simple example for tx.Commit
Based on https://golang.org/pkg/database/sql/#Tx.Commit this function returns an error type.
So why not check it.
2022-05-28 23:40:45 +09:00
mattn
43dcd3131f Update _example/simple/Dockerfile 2022-05-18 11:53:00 +09:00
KEINOS
c122302862 feat: simple example of Dockerfile w/ multi-stage build 2022-05-18 11:53:00 +09:00
Yasuhiro Matsumoto
671e666c2e Add example using driverName 2022-01-10 23:30:33 +09:00
Catena cyber
16175c1389 Adds a fuzz target (#908)
* Adds a fuzz target

* Fixes memory leak
2021-02-15 22:57:26 +09:00
Patrick DeVivo
92d23714a8 add support for defining an "eponymous only" virtual table (#885)
* add support for defining an "eponymous only" virtual table

As suggested here: https://github.com/mattn/go-sqlite3/issues/846#issuecomment-736206222

* add an example of an eponymous only vtab module

* add a test case for an eponymous only vtab module
2020-12-26 23:11:17 +09:00
ShanePerron
61ad8da9d6 Fix for early termination of returned rows (#805)
Once the regex encountered the first instance of a non-match, it would return without processing the rest of the rows in the statement. This change allows it to process the remaining, only setting the sqlite3_result_int to zero then continuing. This worked fine for the example as it only had one item to process.
2020-05-03 00:42:42 +09:00
rittneje
98a44bcf59 report actual error message if sqlite3_load_extension fails (#800)
* report actual error message if sqlite3_load_extension fails

* more fixes and test cases

Co-authored-by: Jesse Rittner <jrittner@lutron.com>
2020-04-16 14:45:59 +09:00
Sergey Bronnikov
d51eaf3b34 Fix typo (#763) 2020-01-09 18:43:04 +09:00
Yasuhiro Matsumoto
324c3f7deb fix type of event code
fixes #520
2018-01-29 11:15:57 +09:00
Tetsuya Morimoto
d785b8f812 support sqlite3_limit to get/set run time limit 2017-11-05 08:19:06 +09:00
Jason Abbott
59bd281a89 Incorporate original PR 271 from https://github.com/brokensandals 2017-07-03 12:51:48 -06:00
Yasuhiro Matsumoto
ecc5105e21 golint 2017-03-05 22:29:09 +09:00
Yasuhiro Matsumoto
f9e79c0a39 golint 2017-03-05 20:52:55 +09:00
Yasuhiro Matsumoto
a9d61d54c6 use pointer receiver 2017-03-05 20:49:45 +09:00
Yasuhiro Matsumoto
fca908b496 fix import path 2017-03-05 20:48:17 +09:00
Conor Branagan
9efa963d05 [vtable] Rename Context to SQLiteContext
To not conflict with core "context" package naming.
2017-03-04 18:37:04 -05:00
Conor Branagan
618e784627 [vtable] Add pure Go example of GitHub repo vtable. 2017-03-04 18:10:02 -05:00
mattn
c2ab9a4ac8 Merge pull request #279 from otoolep/src_dst_swapped
Source and destination are reversed
2017-03-01 15:57:43 +09:00
Yasuhiro Matsumoto
b59c804b1d dummy constants 2017-01-11 01:18:51 +09:00
Yasuhiro Matsumoto
efea85cb9a fixes #368 2017-01-10 00:40:58 +09:00
Graeme Connell
341bfcf7f1 Fix example import to point to mattn repo. 2016-11-11 09:50:05 -07:00
A.N
17a684694a Example program for the new SetTrace()
Does INSERT, then SELECT on the inserted rows (in-memory database).
The purpose of all these is to cause activity so there will be trace
messages to display. Trace message formatting is included
(a useful format, with explanations).
2016-09-07 23:48:36 +09:00
Stani
ed21175288 add missing error checking to simple example 2016-04-14 20:56:02 +02:00
Philip O'Toole
baa815b31d Fix reversed source and destination names 2016-02-28 11:51:49 -08:00
Philip O'Toole
960d6a342a Alphabetical imports 2016-02-28 11:51:49 -08:00
Yasuhiro Matsumoto
64bb935391 remove binary file 2015-09-16 10:47:42 +09:00
mattn
0bb7f1c676 Merge pull request #229 from danderson/master
Implement support for calling Go functions from SQLite
2015-09-16 10:46:17 +09:00
David Anderson
26917df7a6 Implement support for aggregation functions implemented in Go. 2015-09-15 18:05:49 -07:00
Marc Campbell
5532d1d5ac Fix example to check the correct error value 2015-08-24 17:19:04 -07:00
gmarik
94efba9292 remove duplicated Close
since there's one already at line 51
2015-08-16 16:39:53 -04:00
Stéphane Graber
3d6c6f9345 Rename sqlite3.{c,h} to sqlite3-binding.{c,h}
This fixes the problem where when building with gccgo, sqlite3.c is
overwritten, leading to a build failure.

An alternative would have been to move sqlite3*.{c,h} to a subdirectory,
but that seems to confuse the linker a fair bit and would just swap one
implementation-dependent issue for another.

Closes #20

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2015-03-11 16:19:50 -04:00
tonio3l
0cdea24bc7 Update simple.go (very small change)
Renaming the string "sql" into "sqlStmt" in order to prevent mixing with package types & functions sql.* in future edits or code reuse.
2014-07-29 11:46:30 -07:00
mattn
e52d4b08c1 Add backup. Close #104 2014-01-30 19:45:24 +09:00
mattn
79fb9332c1 Add example that query github repositories 2014-01-23 10:56:01 +09:00
mattn
1c16dbe609 rename 2013-09-12 09:40:57 +09:00
mattn
d4673cd31c Implements Execer 2013-09-09 10:44:44 +09:00
mattn
75ef7d6c67 Add Makefile 2013-08-30 22:28:22 +09:00
mattn
501b1ea772 mv 2013-08-28 14:50:02 +09:00