connection

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultMaxRowsPerFetch = 0

DefaultMaxRowsPerFetch is the maximum number of rows to fetch in a single request. This can be configured via the DSN parameter "max_rows". A value of 0 means no limit.

View Source
const DefaultQueryTimeout = 0

DefaultQueryTimeout is the query timeout in seconds. This can be configured via the DSN parameter "query_timeout". A value of 0 means no timeout.

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 added in v0.2.1

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)

func (*Connection) SetMaxRowsPerFetch added in v0.3.0

func (c *Connection) SetMaxRowsPerFetch(rows int)

func (*Connection) SetQueryTimeout added in v0.3.0

func (c *Connection) SetQueryTimeout(timeout int)

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"

	// Stored procedure operations
	DIRECT_STORED_PROCEDURE         MessageType = "DS"
	PREPARE_STORED_PROCEDURE        MessageType = "SP"
	STORED_PROCEDURE_UPDATE_EXECUTE MessageType = "SU"
	STORED_PROCEDURE_QUERY_EXECUTE  MessageType = "SQ"
	STORED_PROCEDURE_FETCH_DATA     MessageType = "SF"

	// Stream operations
	GET_STREAM_SIZE        MessageType = "SS"
	RETRIEVE_STREAM        MessageType = "RS"
	OPEN_STREAM            MessageType = "OS"
	READ_STREAM            MessageType = "JS"
	READ_STREAM_ODBC       MessageType = "AS"
	STORE_BINARY_STREAM    MessageType = "SB"
	STORE_CHARACTER_STREAM MessageType = "SM"
	STREAM_GET_BYTES       MessageType = "GB"
	STREAM_SET_BYTES       MessageType = "SZ"
	STREAM_TRUNCATE        MessageType = "SX"
	STREAM_GET_POSITION    MessageType = "GP"
	CLOSE_STREAM           MessageType = "CS"

	// Transaction isolation levels
	READ_COMMITTED            MessageType = "RC"
	READ_UNCOMMITTED          MessageType = "RU"
	ISOLATION_LEVEL           MessageType = "IL"
	AUTOCOMMIT_OFF            MessageType = "AF"
	AUTOCOMMIT_ON             MessageType = "AN"
	TOGGLE_SYNCHRONOUS_COMMIT MessageType = "TS"

	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) ColumnTypeDatabaseTypeName added in v0.3.0

func (r *Rows) ColumnTypeDatabaseTypeName(index int) string

func (*Rows) ColumnTypeLength added in v0.3.0

func (r *Rows) ColumnTypeLength(index int) (length int64, ok bool)

func (*Rows) ColumnTypeNullable added in v0.3.0

func (r *Rows) ColumnTypeNullable(index int) (nullable, ok bool)

func (*Rows) ColumnTypePrecisionScale added in v0.3.0

func (r *Rows) ColumnTypePrecisionScale(index int) (precision, scale int64, ok bool)

func (*Rows) ColumnTypeScanType added in v0.3.0

func (r *Rows) ColumnTypeScanType(index int) reflect.Type

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