mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-11 21:49:13 +00:00
Fixes.
This commit is contained in:
@@ -740,7 +740,7 @@ func (r *rows) ColumnTypeScanType(index int) (typ reflect.Type) {
|
|||||||
switch {
|
switch {
|
||||||
case scan == _TIME && val != _BLOB && val != _NULL:
|
case scan == _TIME && val != _BLOB && val != _NULL:
|
||||||
t := r.Stmt.ColumnTime(index, r.tmRead)
|
t := r.Stmt.ColumnTime(index, r.tmRead)
|
||||||
useValType = t == time.Time{}
|
useValType = t.IsZero()
|
||||||
case scan == _BOOL && val == _INT:
|
case scan == _BOOL && val == _INT:
|
||||||
i := r.Stmt.ColumnInt64(index)
|
i := r.Stmt.ColumnInt64(index)
|
||||||
useValType = i != 0 && i != 1
|
useValType = i != 0 && i != 1
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func Register(db *sqlite3.Conn) error {
|
|||||||
return RegisterFS(db, nil)
|
return RegisterFS(db, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register registers SQL functions readfile, lsmode,
|
// RegisterFS registers SQL functions readfile, lsmode,
|
||||||
// and the table-valued function fsdir;
|
// and the table-valued function fsdir;
|
||||||
// fsys will be used to read files and list directories.
|
// fsys will be used to read files and list directories.
|
||||||
func RegisterFS(db *sqlite3.Conn, fsys fs.FS) error {
|
func RegisterFS(db *sqlite3.Conn, fsys fs.FS) error {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import (
|
|||||||
"github.com/ncruces/go-sqlite3/internal/util"
|
"github.com/ncruces/go-sqlite3/internal/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Set RegisterLike to false to not register a Unicode aware LIKE operator.
|
// RegisterLike must be set to false to not register a Unicode aware LIKE operator.
|
||||||
// Overriding the built-in LIKE operator disables the [LIKE optimization].
|
// Overriding the built-in LIKE operator disables the [LIKE optimization].
|
||||||
//
|
//
|
||||||
// [LIKE optimization]: https://sqlite.org/optoverview.html#the_like_optimization
|
// [LIKE optimization]: https://sqlite.org/optoverview.html#the_like_optimization
|
||||||
|
|||||||
2
func.go
2
func.go
@@ -59,7 +59,7 @@ func (c *Conn) CreateCollation(name string, fn CollatingFunction) error {
|
|||||||
return c.error(rc)
|
return c.error(rc)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collating function is the type of a collation callback.
|
// CollatingFunction is the type of a collation callback.
|
||||||
// Implementations must not retain a or b.
|
// Implementations must not retain a or b.
|
||||||
type CollatingFunction func(a, b []byte) int
|
type CollatingFunction func(a, b []byte) int
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ type params struct {
|
|||||||
*sql.DB
|
*sql.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t params) mustExec(sql string, args ...interface{}) sql.Result {
|
func (t params) mustExec(sql string, args ...any) sql.Result {
|
||||||
res, err := t.DB.Exec(sql, args...)
|
res, err := t.DB.Exec(sql, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Error running %q: %v", sql, err)
|
t.Fatalf("Error running %q: %v", sql, err)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func (s *SeekingReaderAt) Size() (int64, error) {
|
|||||||
return s.r.Seek(0, io.SeekEnd)
|
return s.r.Seek(0, io.SeekEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadAt implements [io.Closer].
|
// Close implements [io.Closer].
|
||||||
func (s *SeekingReaderAt) Close() error {
|
func (s *SeekingReaderAt) Close() error {
|
||||||
s.l.Lock()
|
s.l.Lock()
|
||||||
defer s.l.Unlock()
|
defer s.l.Unlock()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func (FS) Open(name string) (fs.File, error) {
|
|||||||
return os.OpenFile(name, os.O_RDONLY, 0)
|
return os.OpenFile(name, os.O_RDONLY, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFileFS implements [fs.StatFS].
|
// Stat implements [fs.StatFS].
|
||||||
func (FS) Stat(name string) (fs.FileInfo, error) {
|
func (FS) Stat(name string) (fs.FileInfo, error) {
|
||||||
return os.Stat(name)
|
return os.Stat(name)
|
||||||
}
|
}
|
||||||
|
|||||||
6
value.go
6
value.go
@@ -31,9 +31,9 @@ func (v Value) Dup() *Value {
|
|||||||
// Close frees an SQL value previously obtained by [Value.Dup].
|
// Close frees an SQL value previously obtained by [Value.Dup].
|
||||||
//
|
//
|
||||||
// https://sqlite.org/c3ref/value_dup.html
|
// https://sqlite.org/c3ref/value_dup.html
|
||||||
func (dup *Value) Close() error {
|
func (v *Value) Close() error {
|
||||||
dup.c.call("sqlite3_value_free", stk_t(dup.handle))
|
v.c.call("sqlite3_value_free", stk_t(v.handle))
|
||||||
dup.handle = 0
|
v.handle = 0
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func (n *Filename) Journal() string {
|
|||||||
return n.path("sqlite3_filename_journal")
|
return n.path("sqlite3_filename_journal")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Journal returns the name of the corresponding WAL file.
|
// WAL returns the name of the corresponding WAL file.
|
||||||
//
|
//
|
||||||
// https://sqlite.org/c3ref/filename_database.html
|
// https://sqlite.org/c3ref/filename_database.html
|
||||||
func (n *Filename) WAL() string {
|
func (n *Filename) WAL() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user