connection

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const VERSION_PROTOCOL uint16 = 69

Variables

View Source
var (
	ErrCouldNotDetectUsername = errors.New("intersystems: Could not detect default username. Please provide one explicitly")
)

Functions

func FormatQuery

func FormatQuery(sqlText string, args ...interface{}) (string, int, []interface{})

Types

type AnyType

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

func (*AnyType) Int

func (v *AnyType) Int() int

type Column

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

func (Column) Name

func (c Column) Name() string

type Connection

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

func Connect

func Connect(addr string, namespace, login, password string) (connection Connection, err error)

func (*Connection) BeginTx

func (c *Connection) BeginTx(opts driver.TxOptions) (driver.Tx, error)

func (*Connection) ClassMethod

func (c *Connection) ClassMethod(class, method string, result interface{}, args ...interface{}) (err error)

func (*Connection) ClassMethodVoid

func (c *Connection) ClassMethodVoid(class, method string, args ...interface{}) (err error)

func (*Connection) Commit

func (c *Connection) Commit() (err error)

func (*Connection) DirectQuery

func (c *Connection) DirectQuery(sqlText string, args ...interface{}) (*ResultSet, error)

func (*Connection) DirectUpdate

func (c *Connection) DirectUpdate(sqlText string, args ...interface{}) (*Result, error)

func (*Connection) Disconnect

func (c *Connection) Disconnect()

func (*Connection) Exec

func (c *Connection) Exec(sqlText string, args ...interface{}) (res *Result, err error)

func (*Connection) GlobalGet

func (c *Connection) GlobalGet(global string, result interface{}, subs ...interface{}) (err error)

func (*Connection) GlobalIsDefined

func (c *Connection) GlobalIsDefined(global string, subs ...interface{}) (bool, bool)

func (*Connection) GlobalKill

func (c *Connection) GlobalKill(global string, subs ...interface{}) (err error)

func (*Connection) GlobalNext

func (c *Connection) GlobalNext(global string, ind *string, subs ...interface{}) (hasNext bool, err error)

func (*Connection) GlobalPrev

func (c *Connection) GlobalPrev(global string, ind *string, subs ...interface{}) (hasNext bool, err error)

func (*Connection) GlobalSet

func (c *Connection) GlobalSet(global string, value interface{}, subs ...interface{}) (err error)

func (*Connection) IsOptionFastInsert

func (c *Connection) IsOptionFastInsert() bool

func (*Connection) IsOptionFastSelect

func (c *Connection) IsOptionFastSelect() bool

func (*Connection) Method

func (c *Connection) Method(obj iris.Oref, method string, result interface{}, args ...interface{}) (err error)

func (*Connection) MethodVoid

func (c *Connection) MethodVoid(obj, method string, args ...interface{}) (err error)

func (*Connection) Prepare

func (c *Connection) Prepare(query string) (*Stmt, error)

func (*Connection) PropertyGet

func (c *Connection) PropertyGet(obj iris.Oref, property string, result interface{}) (err error)

func (*Connection) Query

func (c *Connection) Query(sqlText string, args ...interface{}) (rs *ResultSet, err error)

func (*Connection) Rollback

func (c *Connection) Rollback() (err error)

func (*Connection) ServerVersion

func (c *Connection) ServerVersion() (result string, err error)

type FeatureOption

type FeatureOption uint
const (
	OptionNone                FeatureOption = 0
	OptionFastSelect          FeatureOption = 1
	OptionFastInsert          FeatureOption = 2
	OptionFastSelectAndInsert FeatureOption = 3
	OptionDurableTransactions FeatureOption = 4
	OptionNotNullable         FeatureOption = 8
	OptionRedirectOutput      FeatureOption = 32
)

type Message

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

func NewMessage

func NewMessage(messageType MessageType) Message

func ReadMessage

func ReadMessage(conn *net.TCPConn) (msg Message, err error)

func (*Message) AddRaw

func (m *Message) AddRaw(value interface{})

func (*Message) Dump

func (m *Message) Dump(count uint32) []byte

func (*Message) Get

func (m *Message) Get(value interface{}) error

func (*Message) GetAny

func (m *Message) GetAny() AnyType

func (*Message) GetRaw

func (m *Message) GetRaw(value interface{}) error

func (*Message) GetStatus

func (m *Message) GetStatus() uint16

func (*Message) Set

func (m *Message) Set(value interface{}) error

func (*Message) SetSQLText

func (m *Message) SetSQLText(sqlText string) error

type MessageHeader

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

func NewMessageHeader

func NewMessageHeader(messageType MessageType) MessageHeader

func (MessageHeader) GetLength

func (mh MessageHeader) GetLength() uint32

func (*MessageHeader) GetStatus

func (mh *MessageHeader) GetStatus() uint16

func (*MessageHeader) SetCount

func (mh *MessageHeader) SetCount(cnt uint32)

func (*MessageHeader) SetLength

func (mh *MessageHeader) SetLength(length uint32)

func (*MessageHeader) SetStatementId

func (mh *MessageHeader) SetStatementId(statementId uint32)

type MessageType

type MessageType string
const (
	CONNECT    MessageType = "\x43\x4e"
	HANDSHAKE  MessageType = "\x48\x53"
	DISCONNECT MessageType = "\x44\x43"

	GLOBAL_GET   MessageType = "\x41\xc2"
	GLOBAL_SET   MessageType = "\x42\xc2"
	GLOBAL_KILL  MessageType = "\x43\xc2"
	GLOBAL_ORDER MessageType = "\x45\xc2"
	GLOBAL_DATA  MessageType = "\x49\xc2"

	CLASSMETHOD_VALUE MessageType = "\x4b\xc2"
	CLASSMETHOD_VOID  MessageType = "\x4c\xc2"

	METHOD_VALUE MessageType = "\x5b\xc2"
	METHOD_VOID  MessageType = "\x5c\xc2"

	PROPERTY_GET MessageType = "\x5d\xc2"
	PROPERTY_SET MessageType = "\x5e\xc2"

	DIRECT_QUERY            MessageType = "DQ"
	PREPARED_QUERY          MessageType = "PQ"
	DIRECT_UPDATE           MessageType = "DU"
	PREPARED_UPDATE         MessageType = "PU"
	PREPARE                 MessageType = "PP"
	GET_AUTO_GENERATED_KEYS MessageType = "GG"

	COMMIT   MessageType = "TC"
	ROLLBACK MessageType = "TR"

	MULTIPLE_RESULT_SETS_FETCH_DATA MessageType = "MD"
	GET_MORE_RESULTS                MessageType = "MR"
	FETCH_DATA                      MessageType = "FD"
	GET_SERVER_ERROR                MessageType = "OE"
)

type Result

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

func (Result) LastInsertId

func (r Result) LastInsertId() (lastId int64, err error)

func (Result) RowsAffected

func (r Result) RowsAffected() (int64, error)

type ResultSet

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

func (ResultSet) Columns

func (rs ResultSet) Columns() []Column

func (*ResultSet) Next

func (rs *ResultSet) Next() ([]Value, error)

type Rows

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

func (*Rows) Close

func (r *Rows) Close() error

func (*Rows) Columns

func (r *Rows) Columns() []string

func (*Rows) Next

func (r *Rows) Next(dest []driver.Value) (err error)

type SQLError

type SQLError struct {
	SQLCode int16
	Message string
}

func (*SQLError) Error

func (e *SQLError) Error() string

type SQLTYPE

type SQLTYPE int16
const (
	GUID            SQLTYPE = -11
	WLONGVARCHAR    SQLTYPE = -10
	WVARCHAR        SQLTYPE = -9
	WCHAR           SQLTYPE = -8
	BIT             SQLTYPE = -7
	TINYINT         SQLTYPE = -6
	BIGINT          SQLTYPE = -5
	LONGVARBINARY   SQLTYPE = -4
	VARBINARY       SQLTYPE = -3
	BINARY          SQLTYPE = -2
	LONGVARCHAR     SQLTYPE = -1
	CHAR            SQLTYPE = 1
	NUMERIC         SQLTYPE = 2
	DECIMAL         SQLTYPE = 3
	INTEGER         SQLTYPE = 4
	SMALLINT        SQLTYPE = 5
	FLOAT           SQLTYPE = 6
	REAL            SQLTYPE = 7
	DOUBLE          SQLTYPE = 8
	DATE            SQLTYPE = 9
	TIME            SQLTYPE = 10
	TIMESTAMP       SQLTYPE = 11
	VARCHAR         SQLTYPE = 12
	TYPE_DATE       SQLTYPE = 91
	TYPE_TIME       SQLTYPE = 92
	TYPE_TIMESTAMP  SQLTYPE = 93
	DATE_HOROLOG    SQLTYPE = 1091
	TIME_HOROLOG    SQLTYPE = 1092
	TIMESTAMP_POSIX SQLTYPE = 1093
)

type StatementFeature

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

type Stmt

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

func (*Stmt) Close

func (st *Stmt) Close() (err error)

func (*Stmt) Exec

func (st *Stmt) Exec(args []driver.Value) (res driver.Result, err error)

func (*Stmt) NumInput

func (st *Stmt) NumInput() int

func (*Stmt) Query

func (st *Stmt) Query(args []driver.Value) (rows driver.Rows, err error)

type Value

type Value interface{}

Jump to

Keyboard shortcuts

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