aboutsummaryrefslogtreecommitdiff
path: root/internal/sqlutil/sqlite_native.go
blob: 3c545b659f2c828bb26db76db78b230e06322e7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//go:build !cgo
// +build !cgo

package sqlutil

import (
	"strings"
)

const SQLITE_DRIVER_NAME = "sqlite"

func sqliteDSNExtension(dsn string) string {
	// add query parameters to the dsn
	if strings.Contains(dsn, "?") {
		dsn += "&"
	} else {
		dsn += "?"
	}

	// wait some time before erroring if the db is locked
	// https://gitlab.com/cznic/sqlite/-/issues/106#note_1058094993
	dsn += "_pragma=busy_timeout%3d10000"
	return dsn
}