107 lines
4.7 KiB
Plaintext
107 lines
4.7 KiB
Plaintext
// Code generated by cmd/cgo; DO NOT EDIT.
|
|
|
|
//line /Users/win/go/pkg/mod/github.com/mattn/go-sqlite3@v1.14.15/sqlite3_context.go:1:1
|
|
// Copyright (C) 2019 Yasuhiro Matsumoto <mattn.jp@gmail.com>.
|
|
//
|
|
// Use of this source code is governed by an MIT-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package sqlite3
|
|
|
|
/*
|
|
|
|
#ifndef USE_LIBSQLITE3
|
|
#include "sqlite3-binding.h"
|
|
#else
|
|
#include <sqlite3.h>
|
|
#endif
|
|
#include <stdlib.h>
|
|
// These wrappers are necessary because SQLITE_TRANSIENT
|
|
// is a pointer constant, and cgo doesn't translate them correctly.
|
|
|
|
static inline void my_result_text(sqlite3_context *ctx, char *p, int np) {
|
|
sqlite3_result_text(ctx, p, np, SQLITE_TRANSIENT);
|
|
}
|
|
|
|
static inline void my_result_blob(sqlite3_context *ctx, void *p, int np) {
|
|
sqlite3_result_blob(ctx, p, np, SQLITE_TRANSIENT);
|
|
}
|
|
*/
|
|
import _ "unsafe"
|
|
|
|
import (
|
|
"math"
|
|
"reflect"
|
|
"unsafe"
|
|
)
|
|
|
|
const i64 = unsafe.Sizeof(int(0)) > 4
|
|
|
|
// SQLiteContext behave sqlite3_context
|
|
type SQLiteContext /*line :38:20*/_Ctype_sqlite3_context /*line :38:37*/
|
|
|
|
// ResultBool sets the result of an SQL function.
|
|
func (c *SQLiteContext) ResultBool(b bool) {
|
|
if b {
|
|
c.ResultInt(1)
|
|
} else {
|
|
c.ResultInt(0)
|
|
}
|
|
}
|
|
|
|
// ResultBlob sets the result of an SQL function.
|
|
// See: sqlite3_result_blob, http://sqlite.org/c3ref/result_blob.html
|
|
func (c *SQLiteContext) ResultBlob(b []byte) {
|
|
if i64 && len(b) > math.MaxInt32 {
|
|
func() { _cgo0 := /*line :53:33*/(*_Ctype_sqlite3_context /*line :53:52*/)(c); _cgoCheckPointer(_cgo0, nil); /*line :53:57*/_Cfunc_sqlite3_result_error_toobig(_cgo0); }()
|
|
return
|
|
}
|
|
var p *byte
|
|
if len(b) > 0 {
|
|
p = &b[0]
|
|
}
|
|
func() { _cgo0 := /*line :60:19*/(*_Ctype_sqlite3_context /*line :60:38*/)(c); _cgo1 := /*line :60:44*/unsafe.Pointer(p); var _cgo2 _Ctype_int = _Ctype_int /*line :60:68*/(len(b)); _cgoCheckPointer(_cgo0, nil); _cgoCheckPointer(_cgo1, nil); /*line :60:77*/_Cfunc_my_result_blob(_cgo0, _cgo1, _cgo2); }()
|
|
}
|
|
|
|
// ResultDouble sets the result of an SQL function.
|
|
// See: sqlite3_result_double, http://sqlite.org/c3ref/result_blob.html
|
|
func (c *SQLiteContext) ResultDouble(d float64) {
|
|
func() { _cgo0 := /*line :66:26*/(*_Ctype_sqlite3_context /*line :66:45*/)(c); var _cgo1 _Ctype_double = _Ctype_double /*line :66:59*/(d); _cgoCheckPointer(_cgo0, nil); /*line :66:63*/_Cfunc_sqlite3_result_double(_cgo0, _cgo1); }()
|
|
}
|
|
|
|
// ResultInt sets the result of an SQL function.
|
|
// See: sqlite3_result_int, http://sqlite.org/c3ref/result_blob.html
|
|
func (c *SQLiteContext) ResultInt(i int) {
|
|
if i64 && (i > math.MaxInt32 || i < math.MinInt32) {
|
|
func() { _cgo0 := /*line :73:26*/(*_Ctype_sqlite3_context /*line :73:45*/)(c); var _cgo1 _Ctype_sqlite3_int64 = _Ctype_sqlite3_int64 /*line :73:66*/(i); _cgoCheckPointer(_cgo0, nil); /*line :73:70*/_Cfunc_sqlite3_result_int64(_cgo0, _cgo1); }()
|
|
} else {
|
|
func() { _cgo0 := /*line :75:24*/(*_Ctype_sqlite3_context /*line :75:43*/)(c); var _cgo1 _Ctype_int = _Ctype_int /*line :75:54*/(i); _cgoCheckPointer(_cgo0, nil); /*line :75:58*/_Cfunc_sqlite3_result_int(_cgo0, _cgo1); }()
|
|
}
|
|
}
|
|
|
|
// ResultInt64 sets the result of an SQL function.
|
|
// See: sqlite3_result_int64, http://sqlite.org/c3ref/result_blob.html
|
|
func (c *SQLiteContext) ResultInt64(i int64) {
|
|
func() { _cgo0 := /*line :82:25*/(*_Ctype_sqlite3_context /*line :82:44*/)(c); var _cgo1 _Ctype_sqlite3_int64 = _Ctype_sqlite3_int64 /*line :82:65*/(i); _cgoCheckPointer(_cgo0, nil); /*line :82:69*/_Cfunc_sqlite3_result_int64(_cgo0, _cgo1); }()
|
|
}
|
|
|
|
// ResultNull sets the result of an SQL function.
|
|
// See: sqlite3_result_null, http://sqlite.org/c3ref/result_blob.html
|
|
func (c *SQLiteContext) ResultNull() {
|
|
func() { _cgo0 := /*line :88:24*/(*_Ctype_sqlite3_context /*line :88:43*/)(c); _cgoCheckPointer(_cgo0, nil); /*line :88:48*/_Cfunc_sqlite3_result_null(_cgo0); }()
|
|
}
|
|
|
|
// ResultText sets the result of an SQL function.
|
|
// See: sqlite3_result_text, http://sqlite.org/c3ref/result_blob.html
|
|
func (c *SQLiteContext) ResultText(s string) {
|
|
h := (*reflect.StringHeader)(unsafe.Pointer(&s))
|
|
cs, l := (* /*line :95:13*/_Ctype_char /*line :95:19*/)(unsafe.Pointer(h.Data)), /*line :95:46*/_Ctype_int /*line :95:51*/(h.Len)
|
|
func() { _cgo0 := /*line :96:19*/(*_Ctype_sqlite3_context /*line :96:38*/)(c); var _cgo1 *_Ctype_char = /*line :96:44*/cs; var _cgo2 _Ctype_int = /*line :96:48*/l; _cgoCheckPointer(_cgo0, nil); /*line :96:50*/_Cfunc_my_result_text(_cgo0, _cgo1, _cgo2); }()
|
|
}
|
|
|
|
// ResultZeroblob sets the result of an SQL function.
|
|
// See: sqlite3_result_zeroblob, http://sqlite.org/c3ref/result_blob.html
|
|
func (c *SQLiteContext) ResultZeroblob(n int) {
|
|
func() { _cgo0 := /*line :102:28*/(*_Ctype_sqlite3_context /*line :102:47*/)(c); var _cgo1 _Ctype_int = _Ctype_int /*line :102:58*/(n); _cgoCheckPointer(_cgo0, nil); /*line :102:62*/_Cfunc_sqlite3_result_zeroblob(_cgo0, _cgo1); }()
|
|
}
|