Documentation
¶
Overview ¶
Package sqlite3 provides bindings for sqlite 3.
Please see https://github.com/mutablelogic/go-sqlite/blob/master/sys/sqlite3/README.md for information on this package.
Index ¶
- Constants
- func GetMemoryUsed() (int64, int64)
- func IsComplete(v string) bool
- func KeywordCheck(v string) bool
- func KeywordCount() int
- func KeywordName(index int) string
- func ResetMemoryUsed()
- func Sleep(d time.Duration)
- func Version() (string, int, string)
- type AuthorizerHookFunc
- type Backup
- type Blob
- type BlobEx
- func (b *BlobEx) Close() error
- func (b *BlobEx) Read(data []byte) (int, error)
- func (b *BlobEx) ReadAt(data []byte, offset int64) (int, error)
- func (b *BlobEx) Reopen(rowid int64) error
- func (b *BlobEx) Seek(offset int64, whence int) (int64, error)
- func (b *BlobEx) String() string
- func (b *BlobEx) Write(data []byte) (int, error)
- func (b *BlobEx) WriteAt(data []byte, offset int64) (int, error)
- type BusyHandlerFunc
- type CommitHookFunc
- type Conn
- func (c *Conn) Autocommit() bool
- func (c *Conn) CacheFlush() error
- func (c *Conn) Changes() int
- func (c *Conn) Close() error
- func (c *Conn) Filename(schema string) string
- func (c *Conn) GetLimit(key SQLimit) int
- func (c *Conn) GetStatus(v StatusType) (int, int, error)
- func (c *Conn) Interrupt()
- func (c *Conn) LastInsertId() int64
- func (c *Conn) NextStatement(s *Statement) *Statement
- func (c *Conn) OpenBackup(dest *Conn, destSchema, sourceSchema string) (*Backup, error)
- func (c *Conn) OpenBlob(schema, table, column string, rowid int64, flags OpenFlags) (*Blob, error)
- func (c *Conn) OpenBlobEx(schema, table, column string, rowid int64, flags OpenFlags) (*BlobEx, error)
- func (c *Conn) Prepare(query string) (*Statement, string, error)
- func (c *Conn) Readonly(schema string) bool
- func (c *Conn) ReleaseMemory() error
- func (c *Conn) ResetStatus(v StatusType) error
- func (c *Conn) SetExtendedResultCodes(v bool) error
- func (c *Conn) SetLastInsertId(v int64)
- func (c *Conn) SetLimit(key SQLimit, v int) int
- func (c *Conn) String() string
- type ConnEx
- func (c *ConnEx) Begin(t SQTransaction) error
- func (c *ConnEx) Close() error
- func (c *ConnEx) Commit() error
- func (c *ConnEx) CreateScalarFunction(name string, nargs int, deterministic bool, fn StepFunc) error
- func (c *ConnEx) Exec(q string, fn ExecFunc) error
- func (c *ConnEx) ExecEx(q string, fn ExecFunc, v ...interface{}) error
- func (c *ConnEx) Prepare(q string) (*StatementEx, error)
- func (c *ConnEx) Rollback() error
- func (c *ConnEx) SetAuthorizerHook(fn AuthorizerHookFunc) error
- func (c *ConnEx) SetBusyHandler(fn BusyHandlerFunc) error
- func (c *ConnEx) SetBusyTimeout(t time.Duration) error
- func (c *ConnEx) SetCommitHook(fn CommitHookFunc) error
- func (c *ConnEx) SetProgressHandler(n uint, fn ProgressHandlerFunc) error
- func (c *ConnEx) SetRollbackHook(fn RollbackHookFunc) error
- func (c *ConnEx) SetTraceHook(fn TraceFunc, flags TraceType) error
- func (c *ConnEx) SetUpdateHook(fn UpdateHookFunc) error
- type Context
- func (ctx *Context) Err(v string)
- func (ctx *Context) ErrCode(e SQError)
- func (ctx *Context) ErrNoMem()
- func (ctx *Context) ErrTooBig()
- func (ctx *Context) ResultBlob(data []byte)
- func (ctx *Context) ResultDouble(v float64)
- func (ctx *Context) ResultInt32(v int32)
- func (ctx *Context) ResultInt64(v int64)
- func (ctx *Context) ResultInterface(v interface{}) error
- func (ctx *Context) ResultNull()
- func (ctx *Context) ResultText(v string)
- func (ctx *Context) ResultValue(v *Value)
- func (ctx *Context) String() string
- func (ctx *Context) UserData() unsafe.Pointer
- type ExecFunc
- type FinalFunc
- type OpenFlags
- type ProgressHandlerFunc
- type Results
- func (r *Results) ColumnCount() int
- func (r *Results) ColumnDatabaseName(i int) string
- func (r *Results) ColumnDeclType(i int) string
- func (r *Results) ColumnName(i int) string
- func (r *Results) ColumnOriginName(i int) string
- func (r *Results) ColumnTableName(i int) string
- func (r *Results) ColumnType(i int) Type
- func (r *Results) ExpandedSQL() string
- func (r *Results) LastInsertId() int64
- func (r *Results) Next(t ...reflect.Type) ([]interface{}, error)
- func (r *Results) RowsAffected() int
- func (r *Results) String() string
- type RollbackHookFunc
- type SQAction
- type SQAuth
- type SQError
- type SQLimit
- type SQTransaction
- type Statement
- func (s *Statement) Bind(v ...interface{}) error
- func (s *Statement) BindBlob(index int, v []byte) error
- func (s *Statement) BindDouble(index int, v float64) error
- func (s *Statement) BindInt32(index int, v int32) error
- func (s *Statement) BindInt64(index int, v int64) error
- func (s *Statement) BindInterface(index int, value interface{}) error
- func (s *Statement) BindNamedInterface(name string, value interface{}) error
- func (s *Statement) BindNull(index int) error
- func (s *Statement) BindPointer(index int, p unsafe.Pointer, t string) error
- func (s *Statement) BindText(index int, v string) error
- func (s *Statement) BindZeroBlob(index int, len int) error
- func (s *Statement) BindZeroBlob64(index int, len uint64) error
- func (s *Statement) ClearBindings() error
- func (s *Statement) ColumnBlob(index int) []byte
- func (s *Statement) ColumnBytes(index int) int
- func (s *Statement) ColumnCount() int
- func (s *Statement) ColumnDatabaseName(index int) string
- func (s *Statement) ColumnDeclType(index int) string
- func (s *Statement) ColumnDouble(index int) float64
- func (s *Statement) ColumnInt32(index int) int32
- func (s *Statement) ColumnInt64(index int) int64
- func (s *Statement) ColumnInterface(index int) interface{}
- func (s *Statement) ColumnName(index int) string
- func (s *Statement) ColumnOriginName(index int) string
- func (s *Statement) ColumnTableName(index int) string
- func (s *Statement) ColumnText(index int) string
- func (s *Statement) ColumnType(index int) Type
- func (s *Statement) Conn() *Conn
- func (s *Statement) DataCount() int
- func (s *Statement) ExpandedSQL() string
- func (s *Statement) Finalize() error
- func (s *Statement) IsBusy() bool
- func (s *Statement) IsReadonly() bool
- func (s *Statement) NumParams() int
- func (s *Statement) ParamIndex(name string) int
- func (s *Statement) ParamName(index int) string
- func (s *Statement) Reset() error
- func (s *Statement) SQL() string
- func (s *Statement) Step() error
- func (s *Statement) String() string
- type StatementEx
- type StatusType
- type StepFunc
- type TraceFunc
- type TraceType
- type Type
- type UpdateHookFunc
- type Value
- func (v *Value) Blob() []byte
- func (v *Value) Bytes() int
- func (v *Value) Copy() *Value
- func (v *Value) Double() float64
- func (v *Value) Free()
- func (v *Value) Int32() int32
- func (v *Value) Int64() int64
- func (v *Value) Interface() interface{}
- func (v *Value) NoChange() bool
- func (v *Value) String() string
- func (v *Value) Text() string
- func (v *Value) Type() Type
Constants ¶
const ( DefaultSchema = "main" DefaultMemory = ":memory:" DefaultFlags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE )
Variables ¶
This section is empty.
Functions ¶
func GetMemoryUsed ¶
func ResetMemoryUsed ¶
func ResetMemoryUsed()
Types ¶
type AuthorizerHookFunc ¶
AuthorizerHookFunc is invoked as SQL statements are being compiled by sqlite3_prepare the arguments are dependent on the action required, and the return value should be SQLITE_ALLOW, SQLITE_DENY or SQLITE_IGNORE
type Backup ¶
type Backup C.sqlite3_backup
func (*Backup) PageCount ¶
PageCount returns the total number of pages in the source database at the conclusion of the most recent Step call
func (*Backup) Remaining ¶
Remaining returns the number of pages still to be backed up at the conclusion of the most recent Step call
type Blob ¶
type Blob C.sqlite3_blob
func (*Blob) ReadAt ¶
ReadAt reads data from a blob, starting at a specific byte offset within the blob
type BlobEx ¶
type BlobEx struct { io.ReadWriteSeeker io.ReaderAt io.WriterAt io.Closer *Blob // contains filtered or unexported fields }
type BusyHandlerFunc ¶
BusyHandlerFunc is invoked with the number of times that the busy handler has been invoked previously for the same locking event. If the busy callback returns false, then no additional attempts are made to access the database and error SQLITE_BUSY is returned to the application. If the callback returns true then another attempt is made to access the database and the cycle repeats.
type CommitHookFunc ¶
type CommitHookFunc func() bool
CommitHookFunc is invoked on commit. When it returns false, the COMMIT operation is allowed to continue normally or else the COMMIT is converted into a ROLLBACK
type Conn ¶
func (*Conn) NextStatement ¶
Return next prepared statement, or first is nil
func (*Conn) OpenBackup ¶
func (*Conn) OpenBlob ¶
OpenBlob handle with specified schema, table, column and rowid. If called with flag SQLITE_OPEN_READWRITE then the blob handle is opened for read/write access, otherwise for read-only access.
func (*Conn) OpenBlobEx ¶
func (c *Conn) OpenBlobEx(schema, table, column string, rowid int64, flags OpenFlags) (*BlobEx, error)
OpenBlobEx with specified schema, table, column and rowid. If called with flag SQLITE_OPEN_READWRITE then the blob handle is opened for read/write access, otherwise for read-only access.
func (*Conn) ResetStatus ¶
func (c *Conn) ResetStatus(v StatusType) error
func (*Conn) SetExtendedResultCodes ¶
Set extended result codes
type ConnEx ¶
type ConnEx struct { *Conn // Callback functions BusyHandlerFunc ProgressHandlerFunc CommitHookFunc RollbackHookFunc UpdateHookFunc AuthorizerHookFunc ExecFunc TraceFunc // contains filtered or unexported fields }
func OpenPathEx ¶
Open Path (with busy and progress handlers)
func (*ConnEx) Begin ¶
func (c *ConnEx) Begin(t SQTransaction) error
func (*ConnEx) CreateScalarFunction ¶
func (c *ConnEx) CreateScalarFunction(name string, nargs int, deterministic bool, fn StepFunc) error
Create a custom function
func (*ConnEx) Exec ¶
Exec runs statements without preparing or accepting bind arguments. If you call with fn as nil then the statement is executed without a callback, otherwise return true from the callback to abort the transaction.
func (*ConnEx) ExecEx ¶
ExecEx runs statements without preparing. If you call with fn as nil then the statement is executed without a callback, otherwise callback is invoked for each row of data returned, otherwise return true from the callback to abort the transaction.
func (*ConnEx) Prepare ¶
func (c *ConnEx) Prepare(q string) (*StatementEx, error)
Prepare query string and return prepared statements
func (*ConnEx) SetAuthorizerHook ¶
func (c *ConnEx) SetAuthorizerHook(fn AuthorizerHookFunc) error
SetAuthorizerHook sets the callback for the authorizer hook, use nil to remove the handler.
func (*ConnEx) SetBusyHandler ¶
func (c *ConnEx) SetBusyHandler(fn BusyHandlerFunc) error
Set Busy Handler, use nil to remove the handler
func (*ConnEx) SetBusyTimeout ¶
Set Busy Timeout
func (*ConnEx) SetCommitHook ¶
func (c *ConnEx) SetCommitHook(fn CommitHookFunc) error
SetCommitHook sets the callback for the commit hook, use nil to remove the handler.
func (*ConnEx) SetProgressHandler ¶
func (c *ConnEx) SetProgressHandler(n uint, fn ProgressHandlerFunc) error
Set Progress Handler, use nil to remove the handler. The parameter n is the approximate number of virtual machine instructions that are evaluated between successive invocations of the callback
func (*ConnEx) SetRollbackHook ¶
func (c *ConnEx) SetRollbackHook(fn RollbackHookFunc) error
SetRollbackHook sets the callback for the rollback hook, use nil to remove the handler.
func (*ConnEx) SetTraceHook ¶
SetTraceHook sets the callback for the trace hook, use nil to remove the handler.
func (*ConnEx) SetUpdateHook ¶
func (c *ConnEx) SetUpdateHook(fn UpdateHookFunc) error
SetUpdateHook sets the callback for the update hook, use nil to remove the handler.
type Context ¶
type Context C.sqlite3_context
func (*Context) ErrNoMem ¶
func (ctx *Context) ErrNoMem()
Set error to indicate that a memory allocation failed
func (*Context) ErrTooBig ¶
func (ctx *Context) ErrTooBig()
Set error as too big, indicating that a string or BLOB is too long to represent
func (*Context) ResultDouble ¶
Set result as a double value
func (*Context) ResultInterface ¶
Set result as a interface value, return any errors from casting
type ExecFunc ¶
ExecFunc is invoked during an Exec call with row text values and column names. If an sqlite3_exec() callback returns true, the sqlite3_exec() routine returns SQLITE_ABORT without invoking the callback again and without running any subsequent SQL statements.
type OpenFlags ¶
const ( SQLITE_OPEN_NONE OpenFlags = 0 SQLITE_OPEN_READONLY OpenFlags = C.SQLITE_OPEN_READONLY // The database is opened in read-only mode. If the database does not already exist, an error is returned. SQLITE_OPEN_READWRITE OpenFlags = C.SQLITE_OPEN_READWRITE // The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned. SQLITE_OPEN_CREATE OpenFlags = C.SQLITE_OPEN_CREATE // The database is created if it does not already exist SQLITE_OPEN_URI OpenFlags = C.SQLITE_OPEN_URI // The filename can be interpreted as a URI if this flag is set. SQLITE_OPEN_MEMORY OpenFlags = C.SQLITE_OPEN_MEMORY // The database will be opened as an in-memory database. The database is named by the "filename" argument for the purposes of cache-sharing, if shared cache mode is enabled, but the "filename" is otherwise ignored. SQLITE_OPEN_NOMUTEX OpenFlags = C.SQLITE_OPEN_NOMUTEX // The new database connection will use the "multi-thread" threading mode. This means that separate threads are allowed to use SQLite at the same time, as long as each thread is using a different database connection. SQLITE_OPEN_FULLMUTEX OpenFlags = C.SQLITE_OPEN_FULLMUTEX // The new database connection will use the "serialized" threading mode. This means the multiple threads can safely attempt to use the same database connection at the same time. (Mutexes will block any actual concurrency, but in this mode there is no harm in trying.) SQLITE_OPEN_SHAREDCACHE OpenFlags = C.SQLITE_OPEN_SHAREDCACHE // The database is opened shared cache enabled, overriding the default shared cache setting provided by sqlite3_enable_shared_cache(). SQLITE_OPEN_PRIVATECACHE OpenFlags = C.SQLITE_OPEN_PRIVATECACHE // The database is opened shared cache disabled, overriding the default shared cache setting provided by sqlite3_enable_shared_cache(). // SQLITE_OPEN_NOFOLLOW OpenFlags = C.SQLITE_OPEN_NOFOLLOW // The database filename is not allowed to be a symbolic link SQLITE_OPEN_MIN = SQLITE_OPEN_READONLY SQLITE_OPEN_MAX = SQLITE_OPEN_PRIVATECACHE )
func (OpenFlags) StringFlag ¶
type ProgressHandlerFunc ¶
type ProgressHandlerFunc func() bool
ProgressHandlerFunc is invoked periodically during long running calls. If the progress callback returns true, the operation is interrupted
type Results ¶
type Results struct {
// contains filtered or unexported fields
}
func (*Results) ColumnDatabaseName ¶
Return the source database schema name
func (*Results) ColumnDeclType ¶
Return column decltype
func (*Results) ColumnOriginName ¶
Return the origin
func (*Results) ColumnTableName ¶
Return the source table name
func (*Results) ExpandedSQL ¶
Return the expanded SQL statement
func (*Results) LastInsertId ¶
func (*Results) Next ¶
Return next row of values, or (nil, io.EOF) if there are no more rows. If arguments t are provided, then the values will be cast to the types in t if that is possible, or else an error will occur
func (*Results) RowsAffected ¶
type RollbackHookFunc ¶
type RollbackHookFunc func()
RollbackHookFunc is invoked whenever a transaction is rolled back
type SQAction ¶
const ( SQLITE_CREATE_INDEX SQAction = C.SQLITE_CREATE_INDEX SQLITE_CREATE_TABLE SQAction = C.SQLITE_CREATE_TABLE SQLITE_CREATE_TEMP_INDEX SQAction = C.SQLITE_CREATE_TEMP_INDEX SQLITE_CREATE_TEMP_TABLE SQAction = C.SQLITE_CREATE_TEMP_TABLE SQLITE_CREATE_TEMP_TRIGGER SQAction = C.SQLITE_CREATE_TEMP_TRIGGER SQLITE_CREATE_TEMP_VIEW SQAction = C.SQLITE_CREATE_TEMP_VIEW SQLITE_CREATE_TRIGGER SQAction = C.SQLITE_CREATE_TRIGGER SQLITE_CREATE_VIEW SQAction = C.SQLITE_CREATE_VIEW SQLITE_DELETE SQAction = C.SQLITE_DELETE SQLITE_DROP_INDEX SQAction = C.SQLITE_DROP_INDEX SQLITE_DROP_TABLE SQAction = C.SQLITE_DROP_TABLE SQLITE_DROP_TEMP_INDEX SQAction = C.SQLITE_DROP_TEMP_INDEX SQLITE_DROP_TEMP_TABLE SQAction = C.SQLITE_DROP_TEMP_TABLE SQLITE_DROP_TEMP_TRIGGER SQAction = C.SQLITE_DROP_TEMP_TRIGGER SQLITE_DROP_TEMP_VIEW SQAction = C.SQLITE_DROP_TEMP_VIEW SQLITE_DROP_TRIGGER SQAction = C.SQLITE_DROP_TRIGGER SQLITE_DROP_VIEW SQAction = C.SQLITE_DROP_VIEW SQLITE_INSERT SQAction = C.SQLITE_INSERT SQLITE_PRAGMA SQAction = C.SQLITE_PRAGMA SQLITE_READ SQAction = C.SQLITE_READ SQLITE_SELECT SQAction = C.SQLITE_SELECT SQLITE_TRANSACTION SQAction = C.SQLITE_TRANSACTION SQLITE_UPDATE SQAction = C.SQLITE_UPDATE SQLITE_ATTACH SQAction = C.SQLITE_ATTACH SQLITE_DETACH SQAction = C.SQLITE_DETACH SQLITE_ALTER_TABLE SQAction = C.SQLITE_ALTER_TABLE SQLITE_REINDEX SQAction = C.SQLITE_REINDEX SQLITE_ANALYZE SQAction = C.SQLITE_ANALYZE SQLITE_CREATE_VTABLE SQAction = C.SQLITE_CREATE_VTABLE SQLITE_DROP_VTABLE SQAction = C.SQLITE_DROP_VTABLE SQLITE_FUNCTION SQAction = C.SQLITE_FUNCTION SQLITE_SAVEPOINT SQAction = C.SQLITE_SAVEPOINT SQLITE_COPY SQAction = C.SQLITE_COPY SQLITE_RECURSIVE SQAction = C.SQLITE_RECURSIVE SQLITE_ACTION_MIN = SQLITE_CREATE_INDEX SQLITE_ACTION_MAX = SQLITE_RECURSIVE )
type SQAuth ¶
const ( SQLITE_ALLOW SQAuth = SQAuth(SQLITE_OK) /* Operation requested is ok */ SQLITE_DENY SQAuth = C.SQLITE_DENY /* Abort the SQL statement with an error */ SQLITE_IGNORE SQAuth = C.SQLITE_IGNORE /* Don't allow access, but don't generate an error */ )
type SQError ¶
const ( SQLITE_OK SQError = C.SQLITE_OK /* Successful result */ SQLITE_ERROR SQError = C.SQLITE_ERROR /* Generic error */ SQLITE_INTERNAL SQError = C.SQLITE_INTERNAL /* Internal logic error in SQLite */ SQLITE_PERM SQError = C.SQLITE_PERM /* Access permission denied */ SQLITE_ABORT SQError = C.SQLITE_ABORT /* Callback routine requested an abort */ SQLITE_BUSY SQError = C.SQLITE_BUSY /* The database file is locked */ SQLITE_LOCKED SQError = C.SQLITE_LOCKED /* A table in the database is locked */ SQLITE_NOMEM SQError = C.SQLITE_NOMEM /* A malloc() failed */ SQLITE_READONLY SQError = C.SQLITE_READONLY /* Attempt to write a readonly database */ SQLITE_INTERRUPT SQError = C.SQLITE_INTERRUPT /* Operation terminated by sqlite3_interrupt()*/ SQLITE_IOERR SQError = C.SQLITE_IOERR /* Some kind of disk I/O error occurred */ SQLITE_CORRUPT SQError = C.SQLITE_CORRUPT /* The database disk image is malformed */ SQLITE_NOTFOUND SQError = C.SQLITE_NOTFOUND /* Unknown opcode in sqlite3_file_control() */ SQLITE_FULL SQError = C.SQLITE_FULL /* Insertion failed because database is full */ SQLITE_CANTOPEN SQError = C.SQLITE_CANTOPEN /* Unable to open the database file */ SQLITE_PROTOCOL SQError = C.SQLITE_PROTOCOL /* Database lock protocol error */ SQLITE_EMPTY SQError = C.SQLITE_EMPTY /* Internal use only */ SQLITE_SCHEMA SQError = C.SQLITE_SCHEMA /* The database schema changed */ SQLITE_TOOBIG SQError = C.SQLITE_TOOBIG /* String or BLOB exceeds size limit */ SQLITE_CONSTRAINT SQError = C.SQLITE_CONSTRAINT /* Abort due to constraint violation */ SQLITE_MISMATCH SQError = C.SQLITE_MISMATCH /* Data type mismatch */ SQLITE_MISUSE SQError = C.SQLITE_MISUSE /* Library used incorrectly */ SQLITE_NOLFS SQError = C.SQLITE_NOLFS /* Uses OS features not supported on host */ SQLITE_AUTH SQError = C.SQLITE_AUTH /* Authorization denied */ SQLITE_FORMAT SQError = C.SQLITE_FORMAT /* Not used */ SQLITE_RANGE SQError = C.SQLITE_RANGE /* 2nd parameter to sqlite3_bind out of range */ SQLITE_NOTADB SQError = C.SQLITE_NOTADB /* File opened that is not a database file */ SQLITE_NOTICE SQError = C.SQLITE_NOTICE /* Notifications from sqlite3_log() */ SQLITE_WARNING SQError = C.SQLITE_WARNING /* Warnings from sqlite3_log() */ SQLITE_ROW SQError = C.SQLITE_ROW /* sqlite3_step() has another row ready */ SQLITE_DONE SQError = C.SQLITE_DONE /* sqlite3_step() has finished executing */ )
type SQLimit ¶
const ( SQLITE_LIMIT_LENGTH SQLimit = C.SQLITE_LIMIT_LENGTH // The maximum size of any string or BLOB or table row, in bytes. SQLITE_LIMIT_SQL_LENGTH SQLimit = C.SQLITE_LIMIT_SQL_LENGTH // The maximum length of an SQL statement, in bytes. SQLITE_LIMIT_COLUMN SQLimit = C.SQLITE_LIMIT_COLUMN // The maximum number of columns in a table definition or in the result set of a SELECT or the maximum number of columns in an index or in an ORDER BY or GROUP BY clause. SQLITE_LIMIT_EXPR_DEPTH SQLimit = C.SQLITE_LIMIT_EXPR_DEPTH // The maximum depth of the parse tree on any expression. SQLITE_LIMIT_COMPOUND_SELECT SQLimit = C.SQLITE_LIMIT_COMPOUND_SELECT // The maximum number of terms in a compound SELECT statement. SQLITE_LIMIT_VDBE_OP SQLimit = C.SQLITE_LIMIT_VDBE_OP // The maximum number of instructions in a virtual machine program used to implement an SQL statement. If sqlite3_prepare_v2() or the equivalent tries to allocate space for more than this many opcodes in a single prepared statement, an SQLITE_NOMEM error is returned. SQLITE_LIMIT_FUNCTION_ARG SQLimit = C.SQLITE_LIMIT_FUNCTION_ARG // The maximum number of arguments on a function. SQLITE_LIMIT_ATTACHED SQLimit = C.SQLITE_LIMIT_ATTACHED // The maximum number of attached databases. SQLITE_LIMIT_LIKE_PATTERN_LENGTH SQLimit = C.SQLITE_LIMIT_LIKE_PATTERN_LENGTH // The maximum length of the pattern argument to the LIKE or GLOB operators. SQLITE_LIMIT_VARIABLE_NUMBER SQLimit = C.SQLITE_LIMIT_VARIABLE_NUMBER // The maximum index number of any parameter in an SQL statement. SQLITE_LIMIT_TRIGGER_DEPTH SQLimit = C.SQLITE_LIMIT_TRIGGER_DEPTH // The maximum depth of recursion for triggers. SQLITE_LIMIT_WORKER_THREADS SQLimit = C.SQLITE_LIMIT_WORKER_THREADS // The maximum number of auxiliary worker threads that a single prepared statement may start. SQLITE_LIMIT_MIN = SQLITE_LIMIT_LENGTH SQLITE_LIMIT_MAX = SQLITE_LIMIT_WORKER_THREADS )
type SQTransaction ¶
type SQTransaction string
Transaction type
const ( SQLITE_TXN_DEFAULT SQTransaction = "DEFERRED" SQLITE_TXN_IMMEDIATE SQTransaction = "IMMEDIATE" SQLITE_TXN_EXCLUSIVE SQTransaction = "EXCLUSIVE" )
type Statement ¶
type Statement C.sqlite3_stmt
func (*Statement) BindDouble ¶
Bind double
func (*Statement) BindInterface ¶
Bind int, uint, float, bool, string, []byte, time.Time or nil to a statement, return any errors TODO: Also accept custom types with Marshal and Unmarshal
func (*Statement) BindNamedInterface ¶
Bind int, uint, float, bool, string, []byte, or nil to a statement with a named parameter, return any errors
func (*Statement) BindPointer ¶
Bind pointer
func (*Statement) BindZeroBlob ¶
Bind zero-length-blob
func (*Statement) BindZeroBlob64 ¶
Bind zero-length-blob (uint64)
func (*Statement) ColumnDatabaseName ¶
Return database name
func (*Statement) ColumnDeclType ¶
Return declared type
func (*Statement) ColumnInterface ¶
Return column as interface
func (*Statement) ColumnOriginName ¶
Return origin name
func (*Statement) ColumnTableName ¶
Return table name
func (*Statement) ExpandedSQL ¶
Returns SQL associated with a statement, expanded with bound parameters
func (*Statement) IsReadonly ¶
IsReadonly returns true if the statement makes no direct changes to the content of the database file.
func (*Statement) ParamIndex ¶
Returns parameter index for a name, or zero
type StatementEx ¶
func (*StatementEx) Count ¶
func (s *StatementEx) Count() uint32
Returns current count. Used to count the frequency of calls for caching purposes.
func (*StatementEx) Exec ¶
func (s *StatementEx) Exec(n uint, v ...interface{}) (*Results, error)
Execute prepared statement n, when called with arguments, this calls Bind() first
func (*StatementEx) Inc ¶
func (s *StatementEx) Inc(n uint32)
Increment adds n to the statement counter and updates the timestamp
func (*StatementEx) String ¶
func (s *StatementEx) String() string
func (*StatementEx) Timestamp ¶
func (s *StatementEx) Timestamp() int64
Returns last accessed timestamp for caching purposes as an int64
type StatusType ¶
type StatusType int
const ( SQLITE_DBSTATUS_LOOKASIDE_USED StatusType = C.SQLITE_DBSTATUS_LOOKASIDE_USED SQLITE_DBSTATUS_CACHE_USED StatusType = C.SQLITE_DBSTATUS_CACHE_USED SQLITE_DBSTATUS_SCHEMA_USED StatusType = C.SQLITE_DBSTATUS_SCHEMA_USED SQLITE_DBSTATUS_STMT_USED StatusType = C.SQLITE_DBSTATUS_STMT_USED SQLITE_DBSTATUS_LOOKASIDE_HIT StatusType = C.SQLITE_DBSTATUS_LOOKASIDE_HIT SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE StatusType = C.SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL StatusType = C.SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL SQLITE_DBSTATUS_CACHE_HIT StatusType = C.SQLITE_DBSTATUS_CACHE_HIT SQLITE_DBSTATUS_CACHE_MISS StatusType = C.SQLITE_DBSTATUS_CACHE_MISS SQLITE_DBSTATUS_CACHE_WRITE StatusType = C.SQLITE_DBSTATUS_CACHE_WRITE SQLITE_DBSTATUS_DEFERRED_FKS StatusType = C.SQLITE_DBSTATUS_DEFERRED_FKS SQLITE_DBSTATUS_CACHE_USED_SHARED StatusType = C.SQLITE_DBSTATUS_CACHE_USED_SHARED SQLITE_DBSTATUS_CACHE_SPILL StatusType = C.SQLITE_DBSTATUS_CACHE_SPILL SQLITE_DBSTATUS_MIN = SQLITE_DBSTATUS_LOOKASIDE_USED SQLITE_DBSTATUS_MAX StatusType = C.SQLITE_DBSTATUS_MAX )
func (StatusType) String ¶
func (s StatusType) String() string
type TraceType ¶
type TraceType uint
const ( SQLITE_TRACE_STMT TraceType = C.SQLITE_TRACE_STMT SQLITE_TRACE_PROFILE TraceType = C.SQLITE_TRACE_PROFILE SQLITE_TRACE_ROW TraceType = C.SQLITE_TRACE_ROW SQLITE_TRACE_CLOSE TraceType = C.SQLITE_TRACE_CLOSE SQLITE_TRACE_MIN = SQLITE_TRACE_STMT SQLITE_TRACE_MAX = SQLITE_TRACE_CLOSE SQLITE_TRACE_NONE TraceType = 0 )
func (TraceType) StringFlag ¶
type Type ¶
type Type int
const ( SQLITE_INTEGER Type = C.SQLITE_INTEGER SQLITE_FLOAT Type = C.SQLITE_FLOAT SQLITE_TEXT Type = C.SQLITE_TEXT SQLITE_BLOB Type = C.SQLITE_BLOB SQLITE_NULL Type = C.SQLITE_NULL )
type UpdateHookFunc ¶
UpdateHookFunc is invoked whenever a row is updated, inserted or deleted SQOperation will be one of SQLITE_INSERT, SQLITE_DELETE, or SQLITE_UPDATE. The other arguments are database name, table name and the rowid of the row. In the case of an update, this is the rowid after the update takes place.
type Value ¶
type Value C.sqlite3_value
func (*Value) Interface ¶
func (v *Value) Interface() interface{}
Interface returns a go value from a sqlite value