go_ora

package module
v2.4.12 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 38 Imported by: 336

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildJDBC added in v2.4.7

func BuildJDBC(user, password, connStr string, options map[string]string) string

BuildJDBC create url from user, password and JDBC description string

func BuildUrl added in v2.2.5

func BuildUrl(server string, port int, service, user, password string, options map[string]string) string

BuildUrl create databaseURL from server, port, service, user, password, urlOptions this function help build a will formed databaseURL and accept any character as it convert special charters to corresponding values in URL

func NewWallet added in v2.1.24

func NewWallet(filePath string) (*wallet, error)

NewWallet create new wallet object from file path

func SetNTSAuth added in v2.3.3

func SetNTSAuth(newNTSManager advanced_nego.NTSAuthInterface)

func TZBytes

func TZBytes() []byte

Types

type AuthObject

type AuthObject struct {
	EServerSessKey string
	EClientSessKey string
	EPassword      string
	ESpeedyKey     string
	ServerSessKey  []byte
	ClientSessKey  []byte
	KeyHash        []byte
	Salt           string

	VerifierType int
	// contains filtered or unexported fields
}

E infront of the variable means encrypted

func (*AuthObject) Write

func (obj *AuthObject) Write(connOption *network.ConnectionOption, mode LogonMode, session *network.Session) error

write authentication data to network

type AuthType added in v2.3.3

type AuthType int
const (
	Normal AuthType = 0
	OS     AuthType = 1
)

type BFile added in v2.4.5

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

func NewBFile added in v2.4.5

func NewBFile(connection *Connection, dirName, fileName string) (*BFile, error)

func (*BFile) Close added in v2.4.5

func (file *BFile) Close() error

func (*BFile) Exists added in v2.4.5

func (file *BFile) Exists() (bool, error)

func (*BFile) GetLength added in v2.4.5

func (file *BFile) GetLength() (int64, error)

func (*BFile) IsOpen added in v2.4.5

func (file *BFile) IsOpen() bool

func (*BFile) Open added in v2.4.5

func (file *BFile) Open() error

func (*BFile) Read added in v2.4.5

func (file *BFile) Read() ([]byte, error)

func (*BFile) ReadBytesFromPos added in v2.4.5

func (file *BFile) ReadBytesFromPos(pos, count int64) ([]byte, error)

func (*BFile) ReadFromPos added in v2.4.5

func (file *BFile) ReadFromPos(pos int64) ([]byte, error)

type Blob added in v2.2.21

type Blob struct {
	Data  []byte
	Valid bool
	// contains filtered or unexported fields
}

type Clob added in v2.2.21

type Clob struct {
	String string
	Valid  bool
	// contains filtered or unexported fields
}

type Connection

type Connection struct {
	State     ConnectionState
	LogonMode LogonMode

	SessionProperties map[string]string

	NLSData NLSData
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(databaseUrl string) (*Connection, error)

NewConnection create a new connection from databaseURL string

func (*Connection) Begin

func (conn *Connection) Begin() (driver.Tx, error)

Begin called to begin a transaction

func (*Connection) BeginTx added in v2.4.2

func (conn *Connection) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

func (*Connection) BulkInsert added in v2.4.0

func (conn *Connection) BulkInsert(sqlText string, rowNum int, columns ...[]driver.Value) (*QueryResult, error)

all columns should pass as an array of values

func (*Connection) CheckNamedValue added in v2.4.2

func (conn *Connection) CheckNamedValue(named *driver.NamedValue) error

func (*Connection) Close

func (conn *Connection) Close() (err error)

Close the connection by disconnect network session

func (*Connection) Exec added in v2.2.23

func (conn *Connection) Exec(text string, args ...driver.Value) (driver.Result, error)

func (*Connection) ExecContext added in v2.4.1

func (conn *Connection) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)

func (*Connection) GetNLS

func (conn *Connection) GetNLS() (*NLSData, error)

GetNLS return NLS properties of the connection. this function is left from v1. but v2 is using another method

func (*Connection) Open

func (conn *Connection) Open() error

Open open the connection = bring it online

func (*Connection) OpenWithContext added in v2.4.2

func (conn *Connection) OpenWithContext(ctx context.Context) error

OpenWithContext open the connection with timeout context

func (*Connection) Ping

func (conn *Connection) Ping(ctx context.Context) error

Ping test if connection is online

func (*Connection) Prepare

func (conn *Connection) Prepare(query string) (driver.Stmt, error)

Prepare take a query string and create a stmt object

func (*Connection) PrepareContext added in v2.4.1

func (conn *Connection) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)

func (*Connection) QueryContext added in v2.4.1

func (conn *Connection) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)

func (*Connection) RegisterType added in v2.2.6

func (conn *Connection) RegisterType(typeName string, typeObj interface{}) error

RegisterType register user defined type with owner equal to user id

func (*Connection) RegisterType2 added in v2.2.7

func (conn *Connection) RegisterType2(typeName string, typeObj interface{}) error

RegisterType2 same as RegisterType but get user defined type data with pl/sql package function: dbms_pickler.get_type_shape

DataType of UDT field that can be manipulated by this function are: NUMBER, VARCHAR2, NVARCHAR2, TIMESTAMP, DATE AND RAW

func (*Connection) RegisterTypeWithOwner added in v2.2.12

func (conn *Connection) RegisterTypeWithOwner(owner, typeName string, typeObj interface{}) error

RegisterTypeWithOwner take typename, owner and go type object and make an information structure that used to create a new type during query and store values in it

DataType of UDT field that can be manipulated by this function are: NUMBER, VARCHAR2, NVARCHAR2, TIMESTAMP, DATE AND RAW

func (*Connection) SetStringConverter added in v2.2.6

func (conn *Connection) SetStringConverter(converter converters.IStringConverter)

SetStringConverter this function is used to set a custom string converter interface that will used to encode and decode strings and bytearrays

type ConnectionState

type ConnectionState int
const (
	Closed ConnectionState = 0
	Opened ConnectionState = 1
)

type ConnectionString

type ConnectionString struct {
	DataSource   string
	Host         string
	Port         int
	DBAPrivilege DBAPrivilege

	Trace      string // Trace file
	WalletPath string
	// contains filtered or unexported fields
}

type DBAPrivilege

type DBAPrivilege int
const (
	NONE    DBAPrivilege = 0
	SYSDBA  DBAPrivilege = 0x20
	SYSOPER DBAPrivilege = 0x40
)

func DBAPrivilegeFromString

func DBAPrivilegeFromString(s string) DBAPrivilege

type DBVersion

type DBVersion struct {
	Info            string
	Text            string
	Number          uint16
	MajorVersion    int
	MinorVersion    int
	PatchsetVersion int
	// contains filtered or unexported fields
}

func GetDBVersion

func GetDBVersion(session *network.Session) (*DBVersion, error)

GetDBVersion write a request to get database version the read database version from network session

type DataSet

type DataSet struct {
	Cols []ParameterInfo
	// contains filtered or unexported fields
}

func (*DataSet) Close

func (dataSet *DataSet) Close() error

func (DataSet) ColumnTypeDatabaseTypeName

func (dataSet DataSet) ColumnTypeDatabaseTypeName(index int) string

ColumnTypeDatabaseTypeName return Col DataType name

func (DataSet) ColumnTypeLength

func (dataSet DataSet) ColumnTypeLength(index int) (length int64, ok bool)

ColumnTypeLength return length of column type

func (DataSet) ColumnTypeNullable

func (dataSet DataSet) ColumnTypeNullable(index int) (nullable, ok bool)

ColumnTypeNullable return if column allow null or not

func (*DataSet) Columns

func (dataSet *DataSet) Columns() []string

Columns return a string array that represent columns names

func (*DataSet) Err added in v2.2.12

func (dataSet *DataSet) Err() error

func (*DataSet) Next

func (dataSet *DataSet) Next(dest []driver.Value) error

Next implement method need for sql.Rows interface

func (*DataSet) Next_ added in v2.2.12

func (dataSet *DataSet) Next_() bool

Next_ act like Next in sql package return false if no other rows in dataset

func (*DataSet) Scan added in v2.2.12

func (dataSet *DataSet) Scan(dest ...interface{}) error

Scan act like scan in sql package return row values to dest variable pointers

func (DataSet) Trace

func (dataSet DataSet) Trace(t trace.Tracer)

type DataTypeNego

type DataTypeNego struct {
	MessageCode        uint8
	Server             *TCPNego
	TypeAndRep         []int16
	RuntimeTypeAndRep  []int16
	DataTypeRepFor1100 int16
	DataTypeRepFor1200 int16
	CompileTimeCaps    []byte
	RuntimeCap         []byte
	DBTimeZone         []byte
	// contains filtered or unexported fields
}

type Lob

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

func (*Lob) GetLobId added in v2.4.6

func (lob *Lob) GetLobId(locator []byte) []byte

type LogonMode

type LogonMode int
const (
	NoNewPass   LogonMode = 0x1
	WithNewPass LogonMode = 0x2
	SysDba      LogonMode = 0x20
	SysOper     LogonMode = 0x40
	UserAndPass LogonMode = 0x100
	PROXY       LogonMode = 0x400
)

type NClob added in v2.4.5

type NClob Clob

type NLSData

type NLSData struct {
	Calender        string
	Comp            string
	Language        string
	LengthSemantics string
	NCharConvExcep  string
	NCharConvImp    string
	DateLang        string
	Sort            string
	Currency        string
	DateFormat      string
	TimeFormat      string
	IsoCurrency     string
	NumericChars    string
	DualCurrency    string
	UnionCurrency   string
	Timestamp       string
	TimestampTZ     string
	TTimezoneFormat string
	NTimezoneFormat string
	Territory       string
	Charset         string
}

func (*NLSData) SaveNLSValue

func (nls *NLSData) SaveNLSValue(key, value string, code int)

SaveNLSValue a helper function that convert between nls key and code

type NVarChar added in v2.1.20

type NVarChar string

func (*NVarChar) EncodeValue added in v2.4.5

func (val *NVarChar) EncodeValue(param *ParameterInfo, connection *Connection) error

func (*NVarChar) Scan added in v2.4.5

func (val *NVarChar) Scan(value interface{}) error

func (*NVarChar) Value added in v2.1.20

func (val *NVarChar) Value() (driver.Value, error)

type NullNVarChar added in v2.3.0

type NullNVarChar struct {
	Valid    bool
	NVarChar NVarChar
}

func (*NullNVarChar) Scan added in v2.4.5

func (val *NullNVarChar) Scan(value interface{}) error

func (*NullNVarChar) Value added in v2.4.5

func (val *NullNVarChar) Value() (driver.Value, error)

type NullTimeStamp added in v2.3.0

type NullTimeStamp struct {
	Valid     bool
	TimeStamp TimeStamp
}

func (*NullTimeStamp) Scan added in v2.4.5

func (val *NullTimeStamp) Scan(value interface{}) error

func (*NullTimeStamp) Value added in v2.4.5

func (val *NullTimeStamp) Value() (driver.Value, error)

type OracleConnector added in v2.3.2

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

type OracleDriverContext struct { }

func (*OracleConnector) Connect added in v2.3.2

func (connector *OracleConnector) Connect(ctx context.Context) (driver.Conn, error)

func (*OracleConnector) Driver added in v2.3.2

func (connector *OracleConnector) Driver() driver.Driver

type OracleDriver added in v2.2.6

type OracleDriver struct {
}

func (*OracleDriver) Open added in v2.2.6

func (drv *OracleDriver) Open(name string) (driver.Conn, error)

Open return a new open connection

func (*OracleDriver) OpenConnector added in v2.4.2

func (drv *OracleDriver) OpenConnector(name string) (driver.Connector, error)

type OracleType

type OracleType int
const (
	NCHAR            OracleType = 1
	NUMBER           OracleType = 2
	SB1              OracleType = 3
	SB2              OracleType = 3
	SB4              OracleType = 3
	FLOAT            OracleType = 4
	NullStr          OracleType = 5
	VarNum           OracleType = 6
	LONG             OracleType = 8
	VARCHAR          OracleType = 9
	ROWID            OracleType = 11
	DATE             OracleType = 12
	VarRaw           OracleType = 15
	BFloat           OracleType = 21
	BDouble          OracleType = 22
	RAW              OracleType = 23
	LongRaw          OracleType = 24
	UINT             OracleType = 68
	LongVarChar      OracleType = 94
	LongVarRaw       OracleType = 95
	CHAR             OracleType = 96
	CHARZ            OracleType = 97
	IBFloat          OracleType = 100
	IBDouble         OracleType = 101
	REFCURSOR        OracleType = 102
	OCIXMLType       OracleType = 108
	XMLType          OracleType = 109
	OCIRef           OracleType = 110
	OCIClobLocator   OracleType = 112
	OCIBlobLocator   OracleType = 113
	OCIFileLocator   OracleType = 114
	ResultSet        OracleType = 116
	OCIString        OracleType = 155
	OCIDate          OracleType = 156
	TimeStampDTY     OracleType = 180
	TimeStampTZ_DTY  OracleType = 181
	IntervalYM_DTY   OracleType = 182
	IntervalDS_DTY   OracleType = 183
	TimeTZ           OracleType = 186
	TIMESTAMP        OracleType = 187
	TimeStampTZ      OracleType = 188
	IntervalYM       OracleType = 189
	IntervalDS       OracleType = 190
	UROWID           OracleType = 208
	TimeStampLTZ_DTY OracleType = 231
	TimeStampeLTZ    OracleType = 232
)

func (OracleType) String

func (i OracleType) String() string

type Out added in v2.2.23

type Out struct {
	Dest driver.Value
	Size int
}

type ParameterDirection

type ParameterDirection int
const (
	Input  ParameterDirection = 1
	Output ParameterDirection = 2
	InOut  ParameterDirection = 3
	RetVal ParameterDirection = 9
)

type ParameterInfo

type ParameterInfo struct {
	Name                 string
	TypeName             string
	Direction            ParameterDirection
	IsNull               bool
	AllowNull            bool
	ColAlias             string
	DataType             OracleType
	IsXmlType            bool
	Flag                 uint8
	Precision            uint8
	Scale                uint8
	MaxLen               int
	MaxCharLen           int
	MaxNoOfArrayElements int
	ContFlag             int
	ToID                 []byte
	Version              int
	CharsetID            int
	CharsetForm          int
	BValue               []byte
	Value                driver.Value
	OutputVarPtr         interface{}
	// contains filtered or unexported fields
}

type ParameterType

type ParameterType int
const (
	Number ParameterType = 1
	String ParameterType = 2
)

type PromotableTransaction

type PromotableTransaction int

type QueryResult

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

func (*QueryResult) LastInsertId

func (rs *QueryResult) LastInsertId() (int64, error)

func (*QueryResult) RowsAffected

func (rs *QueryResult) RowsAffected() (int64, error)

type RefCursor

type RefCursor struct {
	MaxRowSize int
	// contains filtered or unexported fields
}

func (RefCursor) CanAutoClose added in v2.4.12

func (stmt RefCursor) CanAutoClose() bool

func (*RefCursor) Close

func (stmt *RefCursor) Close() error

Close close stmt cursor in the server

func (*RefCursor) Query

func (cursor *RefCursor) Query() (*DataSet, error)

type Row

type Row []driver.Value

type Stmt

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

func NewStmt

func NewStmt(text string, conn *Connection) *Stmt

NewStmt create new stmt and set its connection properties

func (*Stmt) AddParam

func (stmt *Stmt) AddParam(name string, val driver.Value, size int, direction ParameterDirection) error

AddParam create new parameter and append it to stmt.Pars

func (*Stmt) AddRefCursorParam

func (stmt *Stmt) AddRefCursorParam(name string)

AddRefCursorParam add new output parameter of type REFCURSOR

note: better to use sql.Out structure see examples for more information

func (Stmt) CanAutoClose added in v2.4.12

func (stmt Stmt) CanAutoClose() bool

func (*Stmt) CheckNamedValue added in v2.1.20

func (stmt *Stmt) CheckNamedValue(named *driver.NamedValue) error

func (*Stmt) Close

func (stmt *Stmt) Close() error

Close close stmt cursor in the server

func (*Stmt) Exec

func (stmt *Stmt) Exec(args []driver.Value) (driver.Result, error)

Exec execute stmt (INSERT, UPDATE, DELETE, DML, PLSQL) and return driver.Result object

func (*Stmt) ExecContext added in v2.4.3

func (stmt *Stmt) ExecContext(ctx context.Context, namedArgs []driver.NamedValue) (driver.Result, error)

func (*Stmt) NewParam

func (stmt *Stmt) NewParam(name string, val driver.Value, size int, direction ParameterDirection) (*ParameterInfo, error)

func (*Stmt) NumInput

func (stmt *Stmt) NumInput() int

func (*Stmt) Query

func (stmt *Stmt) Query(args []driver.Value) (driver.Rows, error)

Query execute a query command and return dataset object in form of driver.Rows interface

args is an array of values that corresponding to parameters in sql

func (*Stmt) QueryContext added in v2.4.3

func (stmt *Stmt) QueryContext(ctx context.Context, namedArgs []driver.NamedValue) (driver.Rows, error)

func (*Stmt) Query_ added in v2.2.12

func (stmt *Stmt) Query_(args []driver.Value) (*DataSet, error)

Query_ execute a query command and return oracle dataset object

args is an array of values that corresponding to parameters in sql

type StmtInterface

type StmtInterface interface {
	Close() error
	CanAutoClose() bool
	// contains filtered or unexported methods
}

type StmtType

type StmtType int
const (
	SELECT StmtType = 1
	DML    StmtType = 2
	PLSQL  StmtType = 3
	OTHERS StmtType = 4
)

type TCPNego

type TCPNego struct {
	MessageCode           uint8
	ProtocolServerVersion uint8
	ProtocolServerString  string
	OracleVersion         int
	ServerCharset         int
	ServerFlags           uint8
	CharsetElem           int
	ServernCharset        int
	ServerCompileTimeCaps []byte
	ServerRuntimeCaps     []byte
}

type TimeStamp

type TimeStamp time.Time

func (*TimeStamp) EncodeValue added in v2.4.5

func (val *TimeStamp) EncodeValue(param *ParameterInfo, connection *Connection) error

func (*TimeStamp) Scan added in v2.4.5

func (val *TimeStamp) Scan(value interface{}) error

func (*TimeStamp) Value added in v2.4.5

func (val *TimeStamp) Value() (driver.Value, error)

type Transaction

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

func (*Transaction) Commit

func (tx *Transaction) Commit() error

func (*Transaction) Rollback

func (tx *Transaction) Rollback() error

type ValueEncoder added in v2.4.5

type ValueEncoder interface {
	EncodeValue(param *ParameterInfo, connection *Connection) error
}

Directories

Path Synopsis
ntlmssp
Package ntlmssp provides NTLM/Negotiate authentication over HTTP Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx, implementation hints from http://davenport.sourceforge.net/ntlm.html .
Package ntlmssp provides NTLM/Negotiate authentication over HTTP Protocol details from https://msdn.microsoft.com/en-us/library/cc236621.aspx, implementation hints from http://davenport.sourceforge.net/ntlm.html .
security/md4
Package md4 implements the MD4 hash algorithm as defined in RFC 1320.
Package md4 implements the MD4 hash algorithm as defined in RFC 1320.

Jump to

Keyboard shortcuts

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