data

package
v0.0.0-...-41f8e05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRIMARY_AUTOINCREMENT = 1
	DEFAULT_MAX_LENGTH    = 40
	DEFAULT_SCHEMA_NAME   = "%%DEFAULTSCHEMA%%"
)
View Source
const (
	FOR_UPDATE_FLAG = 1
)
View Source
const NO_TRANSACTION = int64(0)

Variables

View Source
var ErrDoWaitForTra = errors.New("WaitforTra")
View Source
var ErrTraLockTimeout = errors.New("transaction Lock Timeout elapsed")
View Source
var ErrTraSerialization = errors.New("SerializationError")
View Source
var NULL_TUPLE = &SliceTuple{-1, nil}
View Source
var (
	Schemas = make(map[string]map[string]Table)
)
View Source
var (
	VersionedRecordId = "VersionedRecordIdentifier"
)

Functions

func DeleteTempTable

func DeleteTempTable(name string)

func EndStatement

func EndStatement(baseData *StatementBaseData) error

func EndTransaction

func EndTransaction(conn *GoSqlConnData, newState TransactionState) error

func InitTransaction

func InitTransaction(conn *GoSqlConnData)

func InitTransactionManager

func InitTransactionManager()

func NewTransactionManager

func NewTransactionManager() *transactionManagerType

func StartTransaction

func StartTransaction(c *GoSqlConnData) error

called during any change after transaction begin (or after last commit/rollback in case of autocommit)

Types

type BaseStatement

type BaseStatement struct {
	StatementBaseData
}

func NewStatementBaseData

func NewStatementBaseData() BaseStatement

func (*BaseStatement) BaseData

func (s *BaseStatement) BaseData() *StatementBaseData

type BaseTable

type BaseTable struct {
	SchemaName   string
	TableName    string
	TableColumns []GoSqlColumn
}

func (*BaseTable) Columns

func (t *BaseTable) Columns() []GoSqlColumn

func (BaseTable) FindColumn

func (t BaseTable) FindColumn(name string) (int, error)

func (*BaseTable) Name

func (t *BaseTable) Name() string

func (*BaseTable) Schema

func (t *BaseTable) Schema() string

type GoSqlColumn

type GoSqlColumn struct {
	Name       string
	ColType    int
	ParserType int
	Length     int
	Spec2      int
	Hidden     bool
}

type GoSqlConnData

type GoSqlConnData struct {
	Number                int64
	Transaction           *Transaction
	DoAutoCommit          bool
	DefaultIsolationLevel TransactionIsolationLevel
	CurrentSchema         string
}

type GoSqlIdentifier

type GoSqlIdentifier struct {
	Parts []string
}

func (GoSqlIdentifier) Name

func (i GoSqlIdentifier) Name() string

type GoSqlTable

type GoSqlTable struct {
	BaseTable

	NextTupleId atomic.Int64
	// contains filtered or unexported fields
}

func NewTable

func NewTable(name GoSqlIdentifier, columns []GoSqlColumn) *GoSqlTable

func (*GoSqlTable) Data

func (t *GoSqlTable) Data() *[][]driver.Value

func (*GoSqlTable) Delete

func (t *GoSqlTable) Delete(recordId int64, conn *GoSqlConnData) bool

func (*GoSqlTable) Increment

func (t *GoSqlTable) Increment(columnName string) int64

func (*GoSqlTable) Insert

func (t *GoSqlTable) Insert(recordValues []driver.Value, conn *GoSqlConnData) int64

func (*GoSqlTable) NewIterator

func (t *GoSqlTable) NewIterator(baseData *StatementBaseData, forChange bool) TableIterator

func (*GoSqlTable) Update

func (t *GoSqlTable) Update(recordId int64, recordValues Tuple, conn *GoSqlConnData) bool

type GoSqlTableIterator

type GoSqlTableIterator struct {
	Transaction *Transaction
	SnapShot    *SnapShot
	// contains filtered or unexported fields
}

func (*GoSqlTableIterator) GetTable

func (tIt *GoSqlTableIterator) GetTable() Table

func (*GoSqlTableIterator) Next

func (ti *GoSqlTableIterator) Next(check func(Tuple) (bool, error)) (Tuple, bool, error)

type SliceTuple

type SliceTuple struct {
	// contains filtered or unexported fields
}

func (*SliceTuple) Clone

func (t *SliceTuple) Clone() Tuple

func (*SliceTuple) Data

func (t *SliceTuple) Data(tableIx int, ix int) (driver.Value, error)

func (*SliceTuple) DataLen

func (t *SliceTuple) DataLen() int

func (*SliceTuple) Id

func (t *SliceTuple) Id() int64

func (*SliceTuple) SafeData

func (t *SliceTuple) SafeData(tableIx int, ix int) driver.Value

func (*SliceTuple) SetData

func (t *SliceTuple) SetData(tableIx int, ix int, val driver.Value) error

type SnapShot

type SnapShot struct {
	Cid int32
	// contains filtered or unexported fields
}

func GetSnapShot

func GetSnapShot(transaction *Transaction) *SnapShot

func (*SnapShot) RunningIds

func (s *SnapShot) RunningIds() []int64

func (*SnapShot) Xmax

func (s *SnapShot) Xmax() int64

func (*SnapShot) Xmin

func (s *SnapShot) Xmin() int64

type StatementBaseData

type StatementBaseData struct {
	Conn     *GoSqlConnData
	SnapShot *SnapShot
	State    StmtState
}

func (*StatementBaseData) Close

func (r *StatementBaseData) Close() error

func (*StatementBaseData) Exec

func (r *StatementBaseData) Exec(args []driver.Value) (driver.Result, error)

func (*StatementBaseData) NumInput

func (r *StatementBaseData) NumInput() int

func (*StatementBaseData) Query

func (r *StatementBaseData) Query(args []driver.Value) (driver.Rows, error)

type StatementInterface

type StatementInterface interface {
	driver.Stmt
	BaseData() *StatementBaseData
}

type StmtState

type StmtState int
const (
	Created StmtState = iota + 1
	Parsed
	Executing
	EndOfRows
	Closed
)

type Table

type Table interface {
	Schema() string
	Name() string
	Columns() []GoSqlColumn
	Data() *[][]driver.Value
	NewIterator(baseData *StatementBaseData, forChange bool) TableIterator
	FindColumn(name string) (int, error)
	Insert(recordValues []driver.Value, conn *GoSqlConnData) int64
	Update(recordId int64, recordValues Tuple, conn *GoSqlConnData) bool
	Delete(recordId int64, conn *GoSqlConnData) bool
}

func GetTable

func GetTable(stmt BaseStatement, id GoSqlIdentifier) (Table, bool)

func GetTempTable

func GetTempTable(name string) Table

func NewTempTable

func NewTempTable(columns []GoSqlColumn) Table

type TableIterator

type TableIterator interface {
	GetTable() Table
	Next(func(tuple Tuple) (bool, error)) (Tuple, bool, error)
}

type TempTable

type TempTable struct {
	BaseTable
	Tempdata [][]driver.Value
}

func (*TempTable) Data

func (t *TempTable) Data() *[][]driver.Value

func (*TempTable) Delete

func (t *TempTable) Delete(recordId int64, conn *GoSqlConnData) bool

func (*TempTable) Insert

func (t *TempTable) Insert(recordValues []driver.Value, conn *GoSqlConnData) int64

func (*TempTable) NewIterator

func (t *TempTable) NewIterator(baseData *StatementBaseData, forChange bool) TableIterator

func (*TempTable) Update

func (t *TempTable) Update(recordId int64, recordValues Tuple, conn *GoSqlConnData) bool

type TempTableData

type TempTableData struct {
	// contains filtered or unexported fields
}

type TempTableIterator

type TempTableIterator struct {
	// contains filtered or unexported fields
}

func (*TempTableIterator) GetTable

func (tIt *TempTableIterator) GetTable() Table

func (*TempTableIterator) Next

func (it *TempTableIterator) Next(check func(Tuple) (bool, error)) (Tuple, bool, error)

type Transaction

type Transaction struct {
	Xid             int64
	Cid             int32
	Started         int64
	Ended           int64
	ChangeCount     int64
	MaxLockTimeInMs int64
	SnapShot        *SnapShot
	State           TransactionState
	IsolationLevel  TransactionIsolationLevel
	Conn            *GoSqlConnData
}

func GetTransaction

func GetTransaction(xid int64) (*Transaction, error)

func (*Transaction) Commit

func (t *Transaction) Commit() error

func (*Transaction) IsStarted

func (t *Transaction) IsStarted() bool

func (*Transaction) Rollback

func (t *Transaction) Rollback() error

func (*Transaction) SetRollbackOnly

func (t *Transaction) SetRollbackOnly() error

type TransactionIsolationLevel

type TransactionIsolationLevel int8
const (
	UNCOMMITTED_READ TransactionIsolationLevel = iota + 1
	COMMITTED_READ
	REPEATABLE_READ
	SERIALIZABLE
)

type TransactionState

type TransactionState int8
const (
	INITED TransactionState = iota + 1
	STARTED
	ROLLBACKONLY
	COMMITTED
	ROLLEDBACK
)

type Tuple

type Tuple interface {
	Id() int64
	Data(tableIx int, ix int) (driver.Value, error)
	SafeData(tableIx int, ix int) driver.Value
	DataLen() int
	SetData(tableIx int, ix int, v driver.Value) error
	Clone() Tuple
}

func NewSliceTuple

func NewSliceTuple(i int64, data []driver.Value) Tuple

type TupleVersion

type TupleVersion struct {
	Data []driver.Value
	// contains filtered or unexported fields
}

type VersionedTuple

type VersionedTuple struct {
	Versions []TupleVersion
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL