Documentation ¶
Overview ¶
Package protocol implements the hdb command network protocol.
http://help.sap.com/hana/SAP_HANA_SQL_Command_Network_Protocol_Reference_en.pdf
Index ¶
- func LobWriteDescrToPointer(w *LobWriteDescr) int64
- type DataType
- type ErrorLevel
- type FieldSet
- func (f *FieldSet) DataType(idx int) DataType
- func (f *FieldSet) DatabaseTypeName(idx int) string
- func (f *FieldSet) NumInputField() int
- func (f *FieldSet) NumOutputField() int
- func (f *FieldSet) OutputNames(names []string) error
- func (f *FieldSet) String() string
- func (f *FieldSet) TypeLength(idx int) (int64, bool)
- func (f *FieldSet) TypeNullable(idx int) bool
- func (f *FieldSet) TypePrecisionScale(idx int) (int64, int64, bool)
- type FieldValues
- type LobReadDescr
- type LobWriteDescr
- type PartAttributes
- type QueryType
- type Session
- func (s *Session) BadErr() error
- func (s *Session) Call(id uint64, prmFieldSet *FieldSet, args []driver.Value) (*FieldValues, []*TableResult, error)
- func (s *Session) Close() error
- func (s *Session) CloseResultsetID(id uint64) error
- func (s *Session) Commit() error
- func (s *Session) DropStatementID(id uint64) error
- func (s *Session) Exec(id uint64, parameterFieldSet *FieldSet, args []driver.Value) (driver.Result, error)
- func (s *Session) ExecDirect(query string) (driver.Result, error)
- func (s *Session) FetchNext(id uint64, resultFieldSet *FieldSet) (*FieldValues, PartAttributes, error)
- func (s *Session) InTx() bool
- func (s *Session) IsBad() bool
- func (s *Session) Prepare(query string) (QueryType, uint64, *FieldSet, *FieldSet, error)
- func (s *Session) Query(stmtID uint64, parameterFieldSet *FieldSet, resultFieldSet *FieldSet, ...) (uint64, *FieldValues, PartAttributes, error)
- func (s *Session) QueryDirect(query string) (uint64, *FieldSet, *FieldValues, PartAttributes, error)
- func (s *Session) Rollback() error
- func (s *Session) SetInTx(v bool)
- type SessionPrm
- type Sniffer
- type TableResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LobWriteDescrToPointer ¶
func LobWriteDescrToPointer(w *LobWriteDescr) int64
LobWriteDescrToPointer returns a pointer to a LobWriteDescr compatible to sql/driver/Value (int64).
Types ¶
type DataType ¶
type DataType byte
DataType is the type definition for data types supported by this package.
type ErrorLevel ¶
type ErrorLevel int8
ErrorLevel send from database server.
const ( HdbWarning ErrorLevel = 0 HdbError ErrorLevel = 1 HdbFatalError ErrorLevel = 2 )
HDB error level constants.
func (ErrorLevel) String ¶
func (i ErrorLevel) String() string
type FieldSet ¶
type FieldSet struct {
// contains filtered or unexported fields
}
FieldSet contains database field metadata.
func (*FieldSet) DatabaseTypeName ¶ added in v0.9.4
DatabaseTypeName returns the type name of the field at index idx. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypeDatabaseTypeName
func (*FieldSet) NumInputField ¶
NumInputField returns the number of input fields in a database statement.
func (*FieldSet) NumOutputField ¶
NumOutputField returns the number of output fields of a query or stored procedure.
func (*FieldSet) OutputNames ¶
OutputNames fills the names parameter with field names of all output fields. The size of the names slice must be at least NumOutputField big.
func (*FieldSet) TypeLength ¶ added in v0.9.4
TypeLength returns the type length of the field at index idx. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypeLength
func (*FieldSet) TypeNullable ¶ added in v0.9.4
TypeNullable returns true if the column at index idx may be null, false otherwise. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypeNullable
func (*FieldSet) TypePrecisionScale ¶ added in v0.9.4
TypePrecisionScale returns the type precision and scale (decimal types) of the field at index idx. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypePrecisionScale
type FieldValues ¶
type FieldValues struct {
// contains filtered or unexported fields
}
FieldValues contains rows read from database.
func (*FieldValues) NumRow ¶
func (f *FieldValues) NumRow() int
NumRow returns the number of rows available in FieldValues.
func (*FieldValues) Row ¶
func (f *FieldValues) Row(idx int, dest []driver.Value)
Row fills the dest value slice with row data at index idx.
func (*FieldValues) String ¶
func (f *FieldValues) String() string
type LobReadDescr ¶
type LobReadDescr struct {
// contains filtered or unexported fields
}
LobReadDescr is the package internal representation of a lob field to be read from database.
func PointerToLobReadDescr ¶
func PointerToLobReadDescr(ptr int64) *LobReadDescr
PointerToLobReadDescr returns the address of a LobReadDescr from an sql/driver/Value (int64) compatible pointer.
type LobWriteDescr ¶
type LobWriteDescr struct {
// contains filtered or unexported fields
}
LobWriteDescr is the package internal representation of a lob field to be written to database.
func (*LobWriteDescr) SetReader ¶
func (d *LobWriteDescr) SetReader(r io.Reader)
SetReader sets the io.Reader source for a lob field to be written to database.
type PartAttributes ¶
PartAttributes is an interface defining methods for reading query resultset parts.
type QueryType ¶
type QueryType byte
QueryType is the type definition for query types supported by this package.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a HDB session.
func NewSession ¶
func NewSession(prm *SessionPrm) (*Session, error)
NewSession creates a new database session.
func (*Session) Call ¶
func (s *Session) Call(id uint64, prmFieldSet *FieldSet, args []driver.Value) (*FieldValues, []*TableResult, error)
Call executes a stored procedure.
func (*Session) CloseResultsetID ¶
CloseResultsetID releases the hdb resultset handle.
func (*Session) DropStatementID ¶
DropStatementID releases the hdb statement handle.
func (*Session) Exec ¶
func (s *Session) Exec(id uint64, parameterFieldSet *FieldSet, args []driver.Value) (driver.Result, error)
Exec executes a sql statement.
func (*Session) ExecDirect ¶
ExecDirect executes a sql statement without statement parameters.
func (*Session) FetchNext ¶
func (s *Session) FetchNext(id uint64, resultFieldSet *FieldSet) (*FieldValues, PartAttributes, error)
FetchNext fetches next chunk in query result set.
func (*Session) Query ¶
func (s *Session) Query(stmtID uint64, parameterFieldSet *FieldSet, resultFieldSet *FieldSet, args []driver.Value) (uint64, *FieldValues, PartAttributes, error)
Query executes a query.
func (*Session) QueryDirect ¶
func (s *Session) QueryDirect(query string) (uint64, *FieldSet, *FieldValues, PartAttributes, error)
QueryDirect executes a query without query parameters.
type SessionPrm ¶
type SessionPrm struct {
Host, Username, Password string
Locale string
BufferSize, FetchSize, Timeout int
}
func (*SessionPrm) String ¶
func (p *SessionPrm) String() string
type Sniffer ¶
type Sniffer struct {
// contains filtered or unexported fields
}
A Sniffer is a simple proxy for logging hdb protocol requests and responses.
func NewSniffer ¶
NewSniffer creates a new sniffer instance. The conn parameter is the net.Conn connection, where the Sniffer is listening for hdb protocol calls. The dbAddr is the hdb host port address in "host:port" format.
type TableResult ¶
type TableResult struct {
// contains filtered or unexported fields
}
TableResult is the package internal representation of a table like output parameter of a stored procedure.
func (*TableResult) Attrs ¶
func (r *TableResult) Attrs() PartAttributes
Attrs returns the PartAttributes interface of the fetched resultset part.
func (*TableResult) FieldSet ¶
func (r *TableResult) FieldSet() *FieldSet
FieldSet returns the field metadata of the table.
func (*TableResult) FieldValues ¶
func (r *TableResult) FieldValues() *FieldValues
FieldValues returns the field values (fetched resultset part) of the table.
Source Files ¶
- clientid.go
- command.go
- connectoption.go
- connectoption_string.go
- connectoptions.go
- datatype.go
- datatype_string.go
- doc.go
- endianess.go
- endianess_string.go
- error.go
- errorlevel.go
- errorlevel_string.go
- fetchsize.go
- field.go
- functioncode.go
- functioncode_string.go
- init.go
- littleendian.go
- lob.go
- message.go
- messagetype.go
- messagetype_string.go
- option.go
- parameter.go
- part.go
- partkind.go
- partkind_string.go
- querytype.go
- querytype_string.go
- result.go
- rowsaffected.go
- scramsha256.go
- segment.go
- segmentkind.go
- segmentkind_string.go
- session.go
- sessionprm.go
- sniffer.go
- statementcontext.go
- statementcontexttype.go
- statementcontexttype_string.go
- statementid.go
- tableresult.go
- time.go
- topology.go
- topologyoption.go
- topologyoption_string.go
- transactionflags.go
- transactionflagtype.go
- transactionflagtype_string.go
- typecode.go
- typecode_string.go
- unsafe.go