Skip to content

Releases

v0.4.2

Choose a tag to compare

@kenshaw kenshaw released this 01 Dec 21:56

A query of a VECTOR column works on Oracle 23.26.4.

go get github.com/xo/[email protected]

Fixed

  • A query of a VECTOR column failed on Oracle 23.26.4 with
    TTC error: received code N during response reading, or with
    invalid size for ReadInt64. 23.26.4 sends the scale of a VECTOR
    column as a number with a length byte, as it does for a NUMBER. The
    driver read it as one byte, so it read each later field of the column
    from the wrong place. Earlier releases send a scale of 0, which is the
    same byte either way.

The API of v0.4.1 is unchanged.

v0.4.1

Choose a tag to compare

@kenshaw kenshaw released this 08 Nov 02:12

ErrVerbose writes an error as psql's \errverbose does.

go get github.com/xo/[email protected]

Changed

  • The method ErrVerbose(query string) string of a *ServerError now
    writes the form of psql, so that usql's \errverbose shows the errors of
    each database the same way. v0.4.0 wrote the form of SQL*Plus.

    ERROR:  ORA-06550: line 2, column 3:
    LINE 2:   nosuch;
              ^
    DETAIL:  PLS-00201: identifier 'NOSUCH' must be declared
    DETAIL:  ORA-06550: line 2, column 3:
    DETAIL:  PL/SQL: Statement ignored
    

    The first line is ERROR: and the first error of the stack. A position
    gives LINE n: with the line of the statement, and a ^ under the
    character. An ORA-06512 line of the PL/SQL call stack goes in CONTEXT,
    a Help: line of 23ai and later in HINT, and any other line in
    DETAIL. The server gives the position 0 to an error with none, such as
    an error of PL/SQL at run time, so 0 gives no LINE. The method now
    always returns the form, where v0.4.0 returned "" for an error with no
    position.

The API of v0.4.0 is unchanged.

v0.4.0

Choose a tag to compare

@kenshaw kenshaw released this 08 Nov 01:51

A server error writes itself as SQL*Plus does, for usql's \errverbose.

go get github.com/xo/[email protected]

New

  • A *ServerError has the method ErrVerbose(query string) string. It
    writes the line of the statement that holds the position of the error, a
    * under the position, ERROR at line N:, and the message with each line
    of its stack, such as the ORA-06512 lines of PL/SQL:

      nosuch;
      *
    ERROR at line 2:
    ORA-06550: line 2, column 3:
    PLS-00201: identifier 'NOSUCH' must be declared
    ORA-06550: line 2, column 3:
    PL/SQL: Statement ignored
    

    usql finds the method with errors.As for \errverbose. An error with no
    statement or no position gives "", and usql prints the message. The
    position is right for a database in AL32UTF8 or UTF8.

The API of v0.3.0 is unchanged, apart from the new method.

v0.3.0

Choose a tag to compare

@kenshaw kenshaw released this 04 Nov 05:05

A RAW reports its length, and a decimal of another package binds and scans.

go get github.com/xo/[email protected]

New

  • sql.ColumnType.Length() gives the declared length of a RAW in bytes,
    so SYS_GUID() and a RAW(16) column give 16. A caller can tell a
    RAW(16), which holds a GUID, from another RAW. A VARCHAR2,
    NVARCHAR2, CHAR and NCHAR give their length in characters. A
    LONG, LONG RAW, CLOB, NCLOB, BLOB and BFILE give
    math.MaxInt64, as database/sql asks for a type with no limit.
    NUMBER, DATE and the other types of fixed length give none. v0.2.0
    gave a length for the string types only.
  • A decimal of another package binds as a NUMBER, and scans from one with
    every digit, when it has the Decompose and Compose methods that
    database/sql uses to pass a decimal as its parts. This holds for an
    argument, an attribute of an object, and an OUT or IN OUT of PL/SQL. A
    nil one binds as a NULL. v0.2.0 failed to bind such a decimal with "no
    parameter coder registered", and failed to scan into one.

The API of v0.2.0 is unchanged.

v0.2.0

Choose a tag to compare

@kenshaw kenshaw released this 03 Nov 22:50

A UUID binds as a RAW(16), and a CLOB or a BLOB with an IS JSON check reads.

go get github.com/xo/[email protected]

New

  • A uuid.UUID of the standard library binds as a RAW(16), which is how
    Oracle stores a UUID. So do a *uuid.UUID and a sql.Null[uuid.UUID],
    and a nil pointer or a NULL binds as a NULL RAW. A []uuid.UUID binds
    as a batch. An OUT into a uuid.UUID needs no size. v0.1.x refused a
    uuid.UUID with ORA-01484.
  • A RAW(16) scans into a *uuid.UUID, and into *any as a []byte, as
    every RAW does. D37 in docs/PLAN.md says why.

Fixed

  • A CLOB or a BLOB with an IS JSON check failed to read in the default
    inline LOB mode, with TTC error: received code 0. It now reads as any
    other CLOB or BLOB. With lob_fetch=stream it worked already.

The API of v0.1.1 is unchanged.

v0.1.1

Choose a tag to compare

@kenshaw kenshaw released this 02 Nov 04:00

A fix of the break that a context sends.

go get github.com/xo/[email protected]

When a context ends a call, the driver sends the break of Oracle Net and
marks it pending until the server answers. v0.1.0 marked the break after it
wrote it. When the server answered at once, as on a fast machine, the answer
came first and the flag stayed set. The next call on that connection then
waited 10 seconds for an answer that had come already, and failed with
driver.ErrBadConn. The driver now marks the break pending before it sends
it. TestBreakAnsweredAtOnce holds it.

Every user of v0.1.0 that ends calls with a context needs this release.

v0.1.0

Choose a tag to compare

@kenshaw kenshaw released this 02 Nov 02:37

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/[email protected]

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.