Documentation ¶
Index ¶
- Variables
- func GetLastInsertId(id int64) string
- func NewConnector(hosts ...string) driver.Connector
- func QueryEscape(s string) string
- func QueryUnescape(s string) (string, error)
- type Conn
- func (conn *Conn) Begin() (driver.Tx, error)
- func (conn *Conn) BeginTx(ctx context.Context, txOptions driver.TxOptions) (driver.Tx, error)
- func (conn *Conn) Close() error
- func (conn *Conn) Ping(ctx context.Context) error
- func (conn *Conn) Prepare(query string) (driver.Stmt, error)
- func (conn *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- type Connector
- type DSN
- type DriverStruct
- type EscapeError
- type Result
- type Rows
- type Stmt
- func (stmt *Stmt) CheckNamedValue(namedValue *driver.NamedValue) error
- func (stmt *Stmt) Close() error
- func (stmt *Stmt) Exec(values []driver.Value) (driver.Result, error)
- func (stmt *Stmt) ExecContext(ctx context.Context, namedValues []driver.NamedValue) (driver.Result, error)
- func (stmt *Stmt) NumInput() int
- func (stmt *Stmt) Query(values []driver.Value) (driver.Rows, error)
- func (stmt *Stmt) QueryContext(ctx context.Context, namedValues []driver.NamedValue) (driver.Rows, error)
- type Tx
- type Values
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOCIInvalidHandle is OCI_INVALID_HANDLE ErrOCIInvalidHandle = errors.New("OCI_INVALID_HANDLE") // ErrOCISuccessWithInfo is OCI_SUCCESS_WITH_INFO ErrOCISuccessWithInfo = errors.New("OCI_SUCCESS_WITH_INFO") // ErrOCIReservedForIntUse is OCI_RESERVED_FOR_INT_USE ErrOCIReservedForIntUse = errors.New("OCI_RESERVED_FOR_INT_USE") // ErrOCINoData is OCI_NO_DATA ErrOCINoData = errors.New("OCI_NO_DATA") // ErrOCINeedData is OCI_NEED_DATA ErrOCINeedData = errors.New("OCI_NEED_DATA") // ErrOCIStillExecuting is OCI_STILL_EXECUTING ErrOCIStillExecuting = errors.New("OCI_STILL_EXECUTING") // ErrNoRowid is result has no rowid ErrNoRowid = errors.New("result has no rowid") // Driver is the sql driver Driver = &DriverStruct{ Logger: log.New(ioutil.Discard, "", 0), } )
Functions ¶
func GetLastInsertId ¶
GetLastInsertId returns rowid from LastInsertId
func NewConnector ¶
NewConnector returns a new database connector
func QueryEscape ¶
QueryEscape escapes the string so it can be safely placed inside a URL query.
func QueryUnescape ¶
QueryUnescape does the inverse transformation of QueryEscape, converting %AB into the byte 0xAB and '+' into ' ' (space). It returns an error if any % is not followed by two hexadecimal digits.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is Oracle connection
type Connector ¶
Connector is the sql driver connector
type DSN ¶
type DSN struct { Connect string Username string Password string // contains filtered or unexported fields }
DSN is Oracle Data Source Name
func ParseDSN ¶
ParseDSN parses a DSN used to connect to Oracle
It expects to receive a string in the form:
[username/[password]@]host[:port][/service_name][?param1=value1&...¶mN=valueN]
Connection timeout can be set in the Oracle files: sqlnet.ora as SQLNET.OUTBOUND_CONNECT_TIMEOUT or tnsnames.ora as CONNECT_TIMEOUT
Supported parameters are:
loc - the time location for reading timestamp (without time zone). Defaults to UTC Note that writing a timestamp (without time zone) just truncates the time zone.
isolation - the isolation level that can be set to: READONLY, SERIALIZABLE, or DEFAULT
prefetch_rows - the number of top level rows to be prefetched. Defaults to 0. A 0 means unlimited rows.
prefetch_memory - the max memory for top level rows to be prefetched. Defaults to 4096. A 0 means unlimited memory.
questionph - when true, enables question mark placeholders. Defaults to false. (uses strconv.ParseBool to check for true)
type DriverStruct ¶
type DriverStruct struct { // Logger is used to log connection ping errors, defaults to discard // To log set it to something like: log.New(os.Stderr, "oci8 ", log.Ldate|log.Ltime|log.LUTC|log.Lshortfile) Logger *log.Logger }
DriverStruct is Oracle driver struct
type EscapeError ¶
type EscapeError string
EscapeError for invalid escape
func (EscapeError) Error ¶
func (e EscapeError) Error() string
Error returns string for invalid URL escape
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result is Oracle result
func (*Result) LastInsertId ¶
LastInsertId returns last inserted ID
func (*Result) RowsAffected ¶
RowsAffected returns rows affected
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
Rows is Oracle rows
func (*Rows) ColumnTypeDatabaseTypeName ¶
ColumnTypeDatabaseTypeName implement RowsColumnTypeDatabaseTypeName.
func (*Rows) ColumnTypeLength ¶
ColumnTypeLength is returning OCI_ATTR_DATA_SIZE, which is max data size in bytes. Note this is not returing length of the column type, like the 20 in FLOAT(20), which is what is normally expected. TODO: Should / can it be changed to return length of the column type?
func (*Rows) ColumnTypeScanType ¶
ColumnTypeScanType implement RowsColumnTypeScanType.
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt is Oracle statement
func (*Stmt) CheckNamedValue ¶
func (stmt *Stmt) CheckNamedValue(namedValue *driver.NamedValue) error
CheckNamedValue checks a named value
func (*Stmt) ExecContext ¶
func (stmt *Stmt) ExecContext(ctx context.Context, namedValues []driver.NamedValue) (driver.Result, error)
ExecContext run a exec query with context
func (*Stmt) QueryContext ¶
func (stmt *Stmt) QueryContext(ctx context.Context, namedValues []driver.NamedValue) (driver.Rows, error)
QueryContext runs a query with context
type Values ¶
Values maps a string key to a list of values. It is typically used for query parameters and form values. Unlike in the http.Header map, the keys in a Values map are case-sensitive.
func ParseQuery ¶
ParseQuery parses the URL-encoded query string and returns a map listing the values specified for each key. ParseQuery always returns a non-nil map containing all the valid query parameters found; err describes the first decoding error encountered, if any.
func (Values) Add ¶
Add adds the value to key. It appends to any existing values associated with key.
func (Values) Encode ¶
Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") not sorted by key