Skip to content

v0.1.0

Choose a tag to compare

@kenshaw kenshaw released this 02 Nov 02:37
· 9 commits to main since this release

The first release of github.com/xo/oracle, a pure Go Oracle Database
driver for database/sql. It is a fork of the v3 code of sijms/go-ora,
rewritten. A v0 version means that the API can still change (D36).

go get github.com/xo/oracle@v0.1.0

The driver needs Go 1.27.1 or later. It is tested on Oracle 11g, 18c, 19c,
21c, 23ai and 26ai, on a server that requires native network encryption, and
on the Autonomous Database, 19c and 26ai.

What changed from go-ora

  • The package is oracle, and the DSN is a URL with lower case keys, such as
    oracle://user:pass@host/service?sslmode=verify-full. The DSN of go-ora
    does not parse. The README lists each key.
  • A Connector holds the state of one database: the registered types, the
    session parameters and the fast login cookies. The package holds no state.
  • Each call takes a context. A context that ends breaks the call with an
    Oracle Net break, and the connection stays usable.
  • A NUMBER scans as an int64 or an *apd.Decimal, by the type of its
    column, so no digit is lost. A DATE and a TIMESTAMP are in UTC.
  • A nullable value is sql.Null[T]. JSON uses encoding/json/v2.
  • VECTOR maps to []float32, []float64, []int8, []byte and
    SparseVector. A bool binds as a BOOLEAN.
  • New options of one statement: WithTimeout, WithPrefetch,
    WithLobFetch, WithBatchErrors and WithRowCounts.
  • A LOB reads in pieces through NewReader. DBMS_OUTPUT reads through
    EnableOutput and ReadOutput.
  • RegisterType takes the records and collections of a PL/SQL package, and
    the record of a row as TABLE%ROWTYPE.
  • An error from the server is a *ServerError. errors.Is matches it to
    the sentinel errors, and AuthenticationRefused says when a new password
    can help.
  • A build of a program that imports the driver is 12.5 MB, where it was
    22.6 MB, because the charsets are a compressed blob.

The rewrite fixes many open issues of sijms/go-ora. docs/UPSTREAM.md
names each, with its test. The tests of python-oracledb that apply to this
driver are written again in integration.

Known limits

  • No statement cache, DRCP, pipelining, scrollable cursors or Application
    Continuity. docs/DRIVERS.md compares the drivers.
  • docs/BACKLOG.md lists the work that is known and not done.