Questions tagged [go-sqlite3]

37 questions
1
vote
1 answer

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 messages where id="17128ab240e7526e"; |Hey there In this…
poundifdef
  • 18,726
  • 23
  • 95
  • 134
1
vote
0 answers

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().UnixNano() msgsStatement.Exec(&msg.Username,…
mismaah
  • 344
  • 5
  • 21
1
vote
1 answer

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.com/mattn/go-sqlite3 SQLite3 driver, similar to the…
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
1
vote
1 answer

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()) } defer db.Close() …
Suren Raju
  • 3,012
  • 6
  • 26
  • 48
1
vote
1 answer

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 someFunction(){ .... gos := 5 proc := make(chan…
Prajval M
  • 2,298
  • 11
  • 32
1
vote
2 answers

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 doesn't accept CHARACTER SET and COLLATE keywords.…
Dan
  • 974
  • 8
  • 12
0
votes
0 answers

Grafana build from source error (go-sqlite)

I am trying to build grafana from source for Win-32 bit version according to the following grafana instructions. I am currently using golang 1.14 (instead of 1.20) as i had had previously several problems according to the following post and now i…
asimkon
  • 915
  • 1
  • 14
  • 21
0
votes
0 answers

Cleanest way to check if record in database exist, without caring about its contents (scan into nothing)?

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 is to try to Scan() it and see if it returned an…
vatuqemor
  • 9
  • 2
0
votes
1 answer

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 reading the official guide. First step is to use…
0
votes
2 answers

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" ( "token" TEXT NOT NULL UNIQUE, "expire" INTEGER NOT NULL, "login" …
xrfang
  • 1,754
  • 4
  • 18
  • 36
0
votes
0 answers

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 not show any CPU spikes at these times. iotop…
Pete
  • 1,241
  • 2
  • 9
  • 21
0
votes
0 answers

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 like .. SELECT DISTINCT tb_one.id as id,…
Hsn
  • 1,168
  • 2
  • 16
  • 39
0
votes
1 answer

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 which I want to pass to a function that will insert…
will.mendil
  • 752
  • 2
  • 6
  • 21
0
votes
1 answer

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"] and i want to insert these columns into a table without hardcoding them , using…
Nbbbb
  • 1
  • 1
0
votes
1 answer

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 inserts into Sqlite3 but Tkinter does not display the…