40 questions
-1
votes
2
answers
105
views
How can I handle a "no such table" error?
With an SQLite database in Go I got:
no such table: table_name
I know where it is coming from but how can I use this error message in Go to create that table, like:
_, err := getState(dbconn) // ...
0
votes
0
answers
245
views
How can I resolve the error "relative path not allowed in hardened program" when loading an SQLite3 extension in Go using the following code?
sql.Register("sqlite3_with_extensions",
&sqlite3.SQLiteDriver{
Extensions: []string{
"regex_match",
},
})
I am working on loading an SQLite3 extension in Go, ...
1
vote
0
answers
243
views
How to deploy a SQLite Database with a GO application
I have an application structured more or less like the following :
app
api
database
db.go
main.go
data
database
data.db
ui
I would like to connect as a ...
1
vote
0
answers
73
views
sqlite3 extension when load from go lang getting Exception 0xc0000005 0x8 0x7ffa905d4a00 0x7ffa905d4a00 PC=0x7ffa905d4a00
Have written sqlite3 extension in cpp trying to load it from go lang,it works properly but it does not clean exist it gives exception.
CPP code
#include <regex>
#include <string>
#include &...
2
votes
0
answers
268
views
Upgraded github.com/mattn/go-sqlite3, SQLite Version Not Reflecting in SQLite Browser
I recently upgraded the github.com/mattn/go-sqlite3 package in my Go project from version 1.14.16 to 1.14.20. Prior to the upgrade, the SQLite version reported by the sqlite_version() function was 3....
-1
votes
1
answer
476
views
Grafana Setup with Azure File as Storage
What happened:
After creating and starting a container group with one container, grafana/grafana:6.4.4, the container shuts down and goes into a reboot loop. I mounted one volume via Azure File Share ...
1
vote
1
answer
3k
views
Golang with GORM - sqlite Error when trying to migrate
I am working on a Bot. For this purposes I have decided to use the sqlite DB and GORM as ORM. Right now i am working on a simple "Connection" file, that should connect with sqlite db (which ...
2
votes
1
answer
906
views
Using prepared statement for SQL queries in Go errors
I am trying to use a prepared statement for querying a sqlite file. This worked fine before, but I change the code to make it more unit testable. To do this, I started using prepared statements. ...
1
vote
0
answers
103
views
Problems displaying image taken from sqlite3 database in vue.js
I'm building a social media-like web app, but I'm having trouble displaying images on the frontend.
For the realization I'm using openAPI , Golang for the backend, sqlte3 database, vue.js for the ...
1
vote
1
answer
402
views
Unable to save the data in two different table in golang using gorm
This is my code I'm not sure what went wrong the value which is in the user is getting updated in the user table properly but the address struct value is not storing the data in the address table
I ...
1
vote
1
answer
2k
views
Execute the sqlite3 connector with golang in vscode. Met below error: collect2: error: ld returned 1 exit status
package main
import (
"database/sql"
"fmt"
"log"
"os"
_ "github.com/mattn/go-sqlite3"
)
type Users struct {
UserId, ...
-1
votes
1
answer
2k
views
go run/build hanging [duplicate]
I have this simple go file called main.go:
package main
import (
"fmt"
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
func main() {
db, err := sql....
2
votes
1
answer
819
views
Golang test hanging
I modified my app recently and found that tests started hanging. This the stripped down test code:
package app_test
...
2
votes
1
answer
2k
views
Importing SQLite3 in GoLang
I want to import SQLite3 into my project:
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
But I get this error:
could not import github.com/mattn/go-sqlite3 (no ...
0
votes
0
answers
371
views
Cleanest way to check if record in database exist, without caring about its contents (scan into nothing)? [duplicate]
I have a piece of code that checks whether or not the requested key exists in the database. Its contents are therefore not important in that particular place.
The best way I know how to check for it ...
2
votes
2
answers
2k
views
How to fix "database is locked" when no concurrent threads are involved? golang, sqlite3
I'm running a list of sql files. The list of files comes from the same sqlite3 db that I'm going to execute sql against, hence there's only one db connection. If I don't kill the loop over sql files ...
3
votes
1
answer
424
views
How can I update my DB with a new version without interference with clients (golang / sqlite3)?
The database I am using is a global variable, initialized reading the file sql-repo.db:
const dbFile = "sql-repo.db"
var globalDB *LocalDB
type LocalDB struct {
Path string
...
0
votes
1
answer
3k
views
Using/setting up user authentication for sqlite3 in golang
I have to make my database password protected as a task in my school. For example if anyone tries to access my database it will ask the password.
I am trying to use go-sqlite3 package and I have tried ...
0
votes
2
answers
455
views
Why is sqlite3 memory database persisted to disk?
In my go program I does this to initialize my sqlite3 schema:
db.MustExec(`ATTACH DATABASE ":memory:" AS "mem"`)
db.MustExec(`CREATE TABLE IF NOT EXISTS "mem.token" (
...
0
votes
0
answers
102
views
How to diagnose erratic SQLite3 performance
I am using SQLite3 from Go on a Jetson NX running Ubuntu 18.04. The performance appears to be very erratic. A query that takes a few ms most of the time can sometimes take upwards of 10 sec. top does ...
1
vote
1
answer
2k
views
Cross compilation from windows 10 to raspberry pi CGO_ENABLED = 1
I wish to compile for a raspberry pi from my windows machine (much faster).
Everything works if I use this command:
env GOOS=linux GOARCH=arm GOARM=5 go build src/*.go
However, I am using go-sqlite3 ...
0
votes
0
answers
325
views
Construct a SQL query w.r.t optional query parameters
I am trying to construct a sql query with respect to optional query parameters from the endpoint.
e.g. I have a url http://localhost/api?one=1
Now form the above url I need to construct query somthing ...
1
vote
1
answer
2k
views
Pass struct interface to sqlite exec
In Go, I'm trying to pass an interface{} to the statement.Exec() function from go-sqlite3. I'm sure this is a solved problem, but I cannot figure it out.
Basically I have a struct with the row data ...
5
votes
1
answer
3k
views
sqlite3 in golang, foreign_keys pragma doesn't enforce keys
I have created an SQL file that loads into sqlite3 and creates a bunch of tables for me. In that sql file, I attempt to enforce foreign_keys with the pragma:
PRAGMA foreign_keys = on; -- also 1, true
...
0
votes
1
answer
324
views
Adding columns into sqlite3 table dynamically using list
I have been trying to insert column list into table but unable to do so here is what i want to do
Let say i have a list of column names column=["Email","Name","Salary"] ...
0
votes
1
answer
960
views
How do I get updated rows from Sqlite3 to display in Tkinter?
I am creating a program for me and my friends small shop. I am using Python, Sqlite3, and Tkinter. I am able to display records from Sqlite3 through Tkinter but when I insert new records/data, it ...
0
votes
1
answer
477
views
go-sqlcipher: failed to compile/run sample on Windows
I'm using Windows Server 2019 x64. Trying to leverage go-sqlcipher to manipulate sqlite database.
But it always fails when I try to run the sample.
# go run .\encrypto.go
# github.com/xeodou/go-...
1
vote
1
answer
553
views
SQLite row returned via shell but not in Go
I have a SQLite query which returns expected results in the shell. However, when I run the same query in my Go program, no values are scanned.
Here is my query:
sqlite> select html, text from ...
2
votes
1
answer
899
views
How can I track database changes made by another process?
I use go-sqlite3 and need to track changes another process makes to my database. For a Products table with name and id columns I want to get a notification after the name column has been changed. How ...
1
vote
0
answers
163
views
Why is this simple go sqlite statement sometimes taking 5 seconds?
This is a small chat app.
Here is the function:
var msgsStatement *sql.Stmt
func handleMessages() {
for {
msg := <-broadcast
log.Println(msg)
start := time.Now()....
1
vote
1
answer
3k
views
How to cross-compile a Go package using github.com/mattn/go-sqlite3 for a Google Cloud VM?
This question is the same as go-sqlite3 compiler arguments for cross compile OSX to linux, but since that one doesn't have an answer I'll try asking again. I have a Go package which uses the github....
0
votes
1
answer
2k
views
JSON1 support go-sqlite3 using gorm
In the following example I use json_extract(...) using the go-sqlite3 driver in Golang.
package main
import (
_ "github.com/mattn/go-sqlite3"
"github.com/jinzhu/gorm"
_ "github.com/...
-1
votes
1
answer
962
views
Not able to convert err into go-sqlite3.Error [closed]
I am trying to convert an err in Go to go-sqlite3.Error, but it fails always.
Above image represents the snapshot of my debug windows, which shows that the err is of type go-sqlite3.Error
I am using ...
4
votes
1
answer
8k
views
go-sqlite3 with journal_mode=WAL gives 'database is locked' error
In go, I open a sqlite3 database using the mattn/go-sqlite3 module. I set the database journalling mode to WAL immediately after opening using a PRAGMA journal_mode=WAL.
However, if I try to open the ...
0
votes
1
answer
445
views
Is there a way to see the result of applying arguments to a query in sqlite?
I'm using sqlite3 in Go and for debugging purposes would like to see the result of applying arguments to the query with the replacements, i.e., with ? replaced by the actual argument. Is this possible?...
1
vote
1
answer
2k
views
How to set fetch size in golang?
I am trying to load a huge data set from DB.
func main() {
db, err := sql.Open("mysql", "root:pass1@tcp(127.0.0.1:3306)/tuts")
if err != nil {
log.Print(err.Error())
...
1
vote
1
answer
369
views
Go routines not executing
The following is the code that is giving me problem. What i want to achieve is to create those many tables in parallel. After all the tables are created I want to exit the functions.
func ...
2
votes
1
answer
466
views
Load SQLite3 database from virtual filesystem (afero)
Setting:
1) SQLite3 database file gets uploaded to a fileserver
2) Files get stored into virtual filesystem
3) I want to execute sql queries on that database
Currently I am using go-sqlite3 with a ...
2
votes
2
answers
785
views
gorm: Database specific annotations
We're using gorm and I'd like to be able to specify database specific annotations. For convenience, in development/test we use an sqlite3 database, then MySQL in production.
Unfortunately sqlite3 ...
3
votes
1
answer
11k
views
JSON fields from sqlite3
I have a json field in a sqlite3 collection. My schema looks like:
CREATE Table Animals(
id int,
sounds json,
name string
)
I understand the go-sqlite interface does not support the json ...