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 ¶
- type DataType
- type FieldValues
- type ParameterField
- func (f *ParameterField) In() bool
- func (f *ParameterField) Name() string
- func (f *ParameterField) Nullable() bool
- func (f *ParameterField) Out() bool
- func (f *ParameterField) SetLobReader(rd io.Reader) error
- func (f *ParameterField) String() string
- func (f *ParameterField) TypeCode() TypeCode
- func (f *ParameterField) TypeLength() (int64, bool)
- func (f *ParameterField) TypePrecisionScale() (int64, int64, bool)
- type ParameterFieldSet
- type PartAttributes
- type QueryType
- type ResultField
- type ResultFieldSet
- type Session
- func (s *Session) BadErr() error
- func (s *Session) Call(id uint64, prmFieldSet *ParameterFieldSet, args []driver.NamedValue) (*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, prmFieldSet *ParameterFieldSet, args []driver.NamedValue) (driver.Result, error)
- func (s *Session) ExecDirect(query string) (driver.Result, error)
- func (s *Session) FetchNext(id uint64, resultFieldSet *ResultFieldSet, fieldValues *FieldValues) (PartAttributes, error)
- func (s *Session) InTx() bool
- func (s *Session) IsBad() bool
- func (s *Session) Prepare(query string) (QueryType, uint64, *ParameterFieldSet, *ResultFieldSet, error)
- func (s *Session) Query(stmtID uint64, prmFieldSet *ParameterFieldSet, resultFieldSet *ResultFieldSet, ...) (uint64, *FieldValues, PartAttributes, error)
- func (s *Session) QueryDirect(query string) (uint64, *ResultFieldSet, *FieldValues, PartAttributes, error)
- func (s *Session) Rollback() error
- func (s *Session) SetInTx(v bool)
- type Sniffer
- type TableResult
- type TypeCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataType ¶
type DataType byte
DataType is the type definition for data types supported by this package.
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 ParameterField ¶ added in v0.11.3
type ParameterField struct {
// contains filtered or unexported fields
}
ParameterField contains database field attributes for parameters.
func (*ParameterField) In ¶ added in v0.11.3
func (f *ParameterField) In() bool
In returns true if the parameter field is an input field.
func (*ParameterField) Name ¶ added in v0.11.3
func (f *ParameterField) Name() string
Name returns the parameter field name.
func (*ParameterField) Nullable ¶ added in v0.11.3
func (f *ParameterField) Nullable() bool
Nullable returns true if the field may be null, false otherwise. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypeNullable
func (*ParameterField) Out ¶ added in v0.11.3
func (f *ParameterField) Out() bool
Out returns true if the parameter field is an output field.
func (*ParameterField) SetLobReader ¶ added in v0.11.3
func (f *ParameterField) SetLobReader(rd io.Reader) error
SetLobReader sets the io.Reader if a Lob parameter field.
func (*ParameterField) String ¶ added in v0.11.3
func (f *ParameterField) String() string
String implements the Stringer interface.
func (*ParameterField) TypeCode ¶ added in v0.11.3
func (f *ParameterField) TypeCode() TypeCode
TypeCode returns the type code of the field.
func (*ParameterField) TypeLength ¶ added in v0.11.3
func (f *ParameterField) TypeLength() (int64, bool)
TypeLength returns the type length of the field. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypeLength
func (*ParameterField) TypePrecisionScale ¶ added in v0.11.3
func (f *ParameterField) TypePrecisionScale() (int64, int64, bool)
TypePrecisionScale returns the type precision and scale (decimal types) of the field. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypePrecisionScale
type ParameterFieldSet ¶ added in v0.11.3
type ParameterFieldSet struct {
// contains filtered or unexported fields
}
ParameterFieldSet contains database field metadata for parameters.
func (*ParameterFieldSet) Field ¶ added in v0.11.3
func (f *ParameterFieldSet) Field(idx int) *ParameterField
Field returns the field at index idx.
func (*ParameterFieldSet) NumInputField ¶ added in v0.11.3
func (f *ParameterFieldSet) NumInputField() int
NumInputField returns the number of input fields in a database statement.
func (*ParameterFieldSet) NumOutputField ¶ added in v0.11.3
func (f *ParameterFieldSet) NumOutputField() int
NumOutputField returns the number of output fields of a query or stored procedure.
func (*ParameterFieldSet) OutputField ¶ added in v0.11.3
func (f *ParameterFieldSet) OutputField(idx int) *ParameterField
OutputField returns the output field at index idx.
func (*ParameterFieldSet) String ¶ added in v0.11.3
func (f *ParameterFieldSet) String() string
String implements the Stringer interface.
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 ResultField ¶ added in v0.11.3
type ResultField struct {
// contains filtered or unexported fields
}
ResultField contains database field attributes for result fields.
func (*ResultField) Name ¶ added in v0.11.3
func (f *ResultField) Name() string
Name returns the result field name.
func (*ResultField) Nullable ¶ added in v0.11.3
func (f *ResultField) Nullable() bool
Nullable returns true if the field may be null, false otherwise. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypeNullable
func (*ResultField) String ¶ added in v0.11.3
func (f *ResultField) String() string
String implements the Stringer interface.
func (*ResultField) TypeCode ¶ added in v0.11.3
func (f *ResultField) TypeCode() TypeCode
TypeCode returns the type code of the field.
func (*ResultField) TypeLength ¶ added in v0.11.3
func (f *ResultField) TypeLength() (int64, bool)
TypeLength returns the type length of the field. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypeLength
func (*ResultField) TypePrecisionScale ¶ added in v0.11.3
func (f *ResultField) TypePrecisionScale() (int64, int64, bool)
TypePrecisionScale returns the type precision and scale (decimal types) of the field. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypePrecisionScale
type ResultFieldSet ¶ added in v0.11.3
type ResultFieldSet struct {
// contains filtered or unexported fields
}
ResultFieldSet contains database field metadata for result fields.
func (*ResultFieldSet) Field ¶ added in v0.11.3
func (f *ResultFieldSet) Field(idx int) *ResultField
Field returns the field at index idx.
func (*ResultFieldSet) NumField ¶ added in v0.11.3
func (f *ResultFieldSet) NumField() int
NumField returns the number of fields of a query.
func (*ResultFieldSet) String ¶ added in v0.11.3
func (f *ResultFieldSet) String() string
String implements the Stringer interface.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a HDB session.
func NewSession ¶
NewSession creates a new database session.
func (*Session) Call ¶
func (s *Session) Call(id uint64, prmFieldSet *ParameterFieldSet, args []driver.NamedValue) (*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, prmFieldSet *ParameterFieldSet, args []driver.NamedValue) (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 *ResultFieldSet, fieldValues *FieldValues) (PartAttributes, error)
FetchNext fetches next chunk in query result set.
func (*Session) Prepare ¶
func (s *Session) Prepare(query string) (QueryType, uint64, *ParameterFieldSet, *ResultFieldSet, error)
Prepare prepares a sql statement.
func (*Session) Query ¶
func (s *Session) Query(stmtID uint64, prmFieldSet *ParameterFieldSet, resultFieldSet *ResultFieldSet, args []driver.NamedValue) (uint64, *FieldValues, PartAttributes, error)
Query executes a query.
func (*Session) QueryDirect ¶
func (s *Session) QueryDirect(query string) (uint64, *ResultFieldSet, *FieldValues, PartAttributes, error)
QueryDirect executes a query without query parameters.
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() *ResultFieldSet
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.
type TypeCode ¶ added in v0.11.1
type TypeCode byte
TypeCode identify the type of a field transferred to or from the database.
func (TypeCode) DataType ¶ added in v0.11.1
DataType converts a type code into one of the supported data types by the driver.
func (TypeCode) TypeName ¶ added in v0.11.1
TypeName returns the database type name. see https://golang.org/pkg/database/sql/driver/#RowsColumnTypeDatabaseTypeName
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
- fetchsize.go
- field.go
- functioncode.go
- functioncode_string.go
- init.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
- 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