Documentation
¶
Overview ¶
Package goracle is a database/sql/driver for Oracle DB.
The connection string for the sql.Open("goracle", connString) call can be the simple
loin/password@sid [AS SYSDBA|AS SYSOPER]
type (with sid being the sexp returned by tnsping), or in the form of
ora://login:password@sid/? \ sysdba=0& \ sysoper=0& \ poolMinSessions=1& \ poolMaxSessions=1000& \ poolIncrement=1& \ connectionClass=POOLED
These are the defaults. Many advocate that a static session pool (min=max, incr=0) is better, with 1-10 sessions per CPU thread. See http://docs.oracle.com/cd/E82638_01/JJUCP/optimizing-real-world-performance.htm#JJUCP-GUID-BC09F045-5D80-4AF5-93F5-FEF0531E0E1D
If you specify connectionClass, that'll reuse the same session pool without the connectionClass, but will specify it on each session acquire. Thus you can cluster the session pool with classes, or ose POOLED for DRCP.
Index ¶
- Constants
- Variables
- func EnableDbmsOutput(ctx context.Context, conn execer) error
- func ParseConnString(connString string) (connectionParams, error)
- func ReadDbmsOutput(ctx context.Context, w io.Writer, conn preparer) error
- type Column
- type CompileError
- type DirectLob
- type Lob
- type Number
- type Option
- type QueryColumn
- type ServerVersion
Constants ¶
const ( // DpiMajorVersion is the wanted major version of the underlying ODPI-C library. DpiMajorVersion = 2 // DpiMinorVersion is the wanted minor version of the underlying ODPI-C library. DpiMinorVersion = 0 // DriverName is set on the connection to be seen in the DB DriverName = "gopkg.in/rana/ora.v5 : " + Version // DefaultPoolMinSessions specifies the default value for minSessions for pool creation. DefaultPoolMinSessions = 1 // DefaultPoolMaxSessions specifies the default value for maxSessions for pool creation. DefaultPoolMaxSessions = 1000 // DefaultPoolInrement specifies the default value for increment for pool creation. DefaultPoolIncrement = 1 // DefaultConnectionClass is the defailt connectionClass DefaultConnectionClass = "POOLED" )
const CheckLOBWrite = true
const PlSQLArrays = Option(1)
PlSQLArrays is to signal that the slices given in arguments of Exec to be left as is - the default is to treat them as arguments for ExecMany.
const Version = "v5.0.0"
Version of this driver
Variables ¶
var Log = func(...interface{}) error { return nil }
Log function
Functions ¶
func EnableDbmsOutput ¶
EnableDbmsOutput enables DBMS_OUTPUT buffering on the given connection. This is required if you want to retrieve the output with ReadDbmsOutput later.
func ParseConnString ¶
ParseConnString parses the given connection string into a struct.
Types ¶
type Column ¶
type Column struct { Name string OracleType C.dpiOracleTypeNum NativeType C.dpiNativeTypeNum Size C.uint32_t Precision C.int16_t Scale C.int8_t Nullable bool ObjectType *C.dpiObjectType }
Column holds the info from a column.
type CompileError ¶
type CompileError struct {
Owner, Name, Type string
Line, Position, Code int64
Text string
Warning bool
}
CompileError represents a compile-time error as in user_errors view.
func GetCompileErrors ¶
func GetCompileErrors(queryer queryer, all bool) ([]CompileError, error)
GetCompileErrors returns the slice of the errors in user_errors.
If all is false, only errors are returned; otherwise, warnings, too.
func (CompileError) Error ¶
func (ce CompileError) Error() string
type QueryColumn ¶
type QueryColumn struct {
Schema, Name string
Type, Length, Precision, Scale int
Nullable bool
CharsetID, CharsetForm int
}
QueryColumn is the described column.
func DescribeQuery ¶
func DescribeQuery(ctx context.Context, db execer, qry string) ([]QueryColumn, error)
DescribeQuery describes the columns in the qry string, using DBMS_SQL.PARSE + DBMS_SQL.DESCRIBE_COLUMNS2.
This can help using unknown-at-compile-time, a.k.a. dynamic queries.
type ServerVersion ¶
type ServerVersion struct {
// major.maintenance.application-server.component-specific.platform-specific
Major, Maintenance, AppServer, Component, Platform int8
}
ServerVersion data.
func GetServerVersion ¶
func GetServerVersion(db queryRower) (ServerVersion, error)
GetServerVersion returns the Oracle product version.