Skip to content

Commit

Permalink
update readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
sijms committed Sep 19, 2023
1 parent 6d2aef5 commit 159a50d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,51 @@ for rows.Next() {
```
complete code for mapping refcursor to sql.Rows is found in [example/refcursor_to_rows](https://github.com/sijms/go-ora/blob/master/examples/refcursor_to_rows/main.go)

* ### Connect to multiple database
* note that `sql.Open(...)` will use default driver so use it if you want to connect to one database
* to use multiple databse you should create a separate driver for each database (don't use default driver)
```golang
// Get a driver-specific connector.
connector, err := mysql.NewConnector(connStr)
if err != nil {
log.Fatal(err)
}

// Get a database handle.
db = sql.OpenDB(connector)
```

* ### Use Custom String encode/decode
* if your database charset is not supported you can create a custom object that implement IStringConverter interface and pass it to the driver as follow
```golang
db, err := sql.Open("oracle", connStr)
if err != nil {
// error handling
}

// call SetStringConverter before use db object
// charset and nCharset are custom object that implement
// IStringConverter interface
// if you pass nil for any of them then the driver will use
// default StringConverter
go_ora.SetStringConverter(db, charset, nCharset)

// rest of your code
```

[//]: # (### Go and Oracle type mapping + special types)

[//]: # ()
[//]: # (### Supported DBMS features)
### releases
<details>

### version 2.7.18
* Add 2 function `go_ora.NewDriver` and `go_ora.NewConnector`
* Add new function `go_ora.SetStringConverter` which accept custom converter for unsupported charset and nCharset
* `go_ora.SetStringConverter` accept `*sql.DB` as first parameter and IStringConveter interface object for charset and nCharset (you can pass nil to use default converter)
* Add support for charset ID 846

### version 2.7.17
* add `WrapRefCursor` which converts `*RefCursor` into `*sql.Rows`
* code:
Expand Down
1 change: 1 addition & 0 deletions v2/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ func (driver *OracleDriver) collectData(conn *Connection) {
driver.dataCollected = true
}
}

func (connector *OracleConnector) Driver() driver.Driver {
return connector.drv
}
Expand Down

0 comments on commit 159a50d

Please sign in to comment.