Skip to content

Commit f8dc23e

Browse files
committed
1- re-code parameter encode.
2- add support for multiple result sets. 3- add connect timeout url parameter (default to 1 min). 4- modify default read timeout to be 0 (no timeout).
1 parent e3d57b3 commit f8dc23e

43 files changed

Lines changed: 2639 additions & 2290 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,31 +188,36 @@ urlOptions := map[string]string {
188188
"data integrity": "rejected",
189189
}
190190
```
191-
* ### Using Unix Socket
191+
* ### Unix Socket
192192
you can use this option if server and client on same linux machine by specify the following url option
193193
```golang
194194
urlOptions := map[string]string{
195195
// change the value according to your machine
196196
"unix socket": "/usr/tmp/.oracle/sEXTPROC1",
197197
}
198198
```
199-
* ### Using Timeout
200-
* activate global timeout value (default=10 minute and should be updated according to your network speed) to protect against block read/write if no or failed timeout context
201-
* timeout value should be numeric string which represent number of seconds that should pass before operation finish or canceled by the driver
199+
* ### Timeout
200+
* activate socket timeout value (default=0 no timeout)
201+
* timeout value should be numeric string which represent number of seconds the driver will wait on socket for read/write.
202202
* to disable this option pass 0 value start from v2.7.15
203203
```golang
204204
urlOptions := map[string]string {
205205
"TIMEOUT": "60",
206206
}
207207
```
208-
* ### Using Proxy user
208+
* ### Connect Timeout
209+
* define timeout for connection (default = 1 minute)
210+
* timeout value should be numeric string which represent number of seconds.
211+
* to disable this option pass 0 value start from v2.9.0
212+
213+
* ### Proxy user
209214
```golang
210215
urlOptions := map[string]string {
211216
"proxy client name": "schema_owner",
212217
}
213218
connStr := go_ora.BuildUrl("server", 1521, "service", "proxy_user", "proxy_password", urlOptions)
214219
```
215-
* ### Define DBA Privilege
220+
* ### DBA Privilege
216221
* define dba privilege of the connection
217222
* default value is `NONE`
218223
* using user `sys` automatically set its value to `SYSDBA`
@@ -221,7 +226,7 @@ urlOptions := map[string]string {
221226
"dba privilege" : "sysdba", // other values "SYSOPER"
222227
}
223228
```
224-
* ### Define Lob Fetching Mode
229+
* ### Lob Fetching Mode
225230
* this option define how lob data will be loaded
226231
* default value is `pre` or `inline` means lob data is send inline with other values
227232
* other value is `post` or `stream` means lob data will be loaded after finish loading other value through a separate network call
@@ -230,7 +235,7 @@ urlOptions := map[string]string {
230235
"lob fetch": "stream",
231236
}
232237
```
233-
* ### Define Client Charset
238+
* ### Client Charset
234239
* this option will allow controlling string encoding and decoding at client level
235240
* so using this option you can define a charset for the client that is different from the server
236241
* client charset will work in the following situation
@@ -698,6 +703,11 @@ db, err := sql.Open("oracle", "")
698703
// error handling
699704
}
700705
```
706+
707+
* ### Multiple ResultSets
708+
* the driver support multiple resultsets start from v2.9.0
709+
* example code can be reviewed [here](https://github.com/sijms/go-ora/blob/master/examples/multi_resultsets/main.go)
710+
701711
[//]: # (### Go and Oracle type mapping + special types)
702712

703713
[//]: # ()
@@ -724,6 +734,13 @@ go_ora.RegisterConfig(config)
724734
db, err := sql.Open("oracle", "")
725735
```
726736

737+
### version 2.9.0
738+
* modify parameter encoding to fix support for Valuer interface issue
739+
* add connect timeout url parameter (default=60 seconds)
740+
* change default timeout for socket to 0 (no-timeout)
741+
* add support for multiple result sets
742+
* fix issue related to using RefCursor without opening
743+
727744
### version 2.8.12
728745
* add 2 functions
729746
* ParseConfig

examples/arrays/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func insert(db *sql.DB) error {
6565
args[x].Date.Valid = false
6666
}
6767
}
68-
_, err := db.Exec(sqlText, args)
68+
_, err := db.Exec(sqlText, go_ora.NewBatch(args))
6969
if err != nil {
7070
return err
7171
}
@@ -223,7 +223,7 @@ func main() {
223223
)
224224
flag.StringVar(&server, "server", "", "Server's URL, oracle://user:pass@server/service_name")
225225
flag.Parse()
226-
server = os.Getenv("LOCAL_DSN")
226+
server = os.Getenv("DSN")
227227
connStr := os.ExpandEnv(server)
228228
if connStr == "" {
229229
fmt.Println("Missing -server option")

examples/bulk_copy/main.go

Lines changed: 0 additions & 176 deletions
This file was deleted.

examples/bulk_insert/main.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ func bulkInsert3(db *sql.DB, rowNum int) error {
113113

114114
}
115115
}
116-
_, err := db.Exec(sqlText, sql.Named("id", id),
117-
sql.Named("name", name),
118-
sql.Named("val", val),
119-
sql.Named("dat", date),
120-
sql.Named("major", major),
121-
sql.Named("data", data))
116+
_, err := db.Exec(sqlText, sql.Named("id", go_ora.NewBatch(id)),
117+
sql.Named("name", go_ora.NewBatch(name)),
118+
sql.Named("val", go_ora.NewBatch(val)),
119+
sql.Named("dat", go_ora.NewBatch(date)),
120+
sql.Named("major", go_ora.NewBatch(major)),
121+
sql.Named("data", go_ora.NewBatch(data)))
122122
if err != nil {
123123
return err
124124
}
@@ -162,12 +162,12 @@ func bulkInsert2(db *sql.DB, rowNum int) error {
162162

163163
}
164164
}
165-
_, err := db.Exec(sqlText, sql.Named("id", id),
166-
sql.Named("name", name),
167-
sql.Named("val", val),
168-
sql.Named("dat", date),
169-
sql.Named("major", major),
170-
sql.Named("data", data))
165+
_, err := db.Exec(sqlText, sql.Named("id", go_ora.NewBatch(id)),
166+
sql.Named("name", go_ora.NewBatch(name)),
167+
sql.Named("val", go_ora.NewBatch(val)),
168+
sql.Named("dat", go_ora.NewBatch(date)),
169+
sql.Named("major", go_ora.NewBatch(major)),
170+
sql.Named("data", go_ora.NewBatch(data)))
171171
if err != nil {
172172
return err
173173
}
@@ -274,32 +274,32 @@ func main() {
274274
return
275275
}
276276

277-
//err = createTable(conn)
278-
//if err != nil {
279-
// fmt.Println("Can't create table: ", err)
280-
// return
281-
//}
277+
err = createTable(conn)
278+
if err != nil {
279+
fmt.Println("Can't create table: ", err)
280+
return
281+
}
282282

283-
//defer func() {
284-
// err = dropTable(conn)
285-
// if err != nil {
286-
// fmt.Println("Can't drop table: ", err)
287-
// }
288-
//}()
283+
defer func() {
284+
err = dropTable(conn)
285+
if err != nil {
286+
fmt.Println("Can't drop table: ", err)
287+
}
288+
}()
289289

290290
//err = insertData(conn)
291291
//if err != nil {
292292
// fmt.Println("Can't insert data: ", err)
293293
// return
294294
//}
295295
//
296-
err = deleteData(conn)
297-
if err != nil {
298-
fmt.Println("Can't delete data: ", err)
299-
return
300-
}
296+
//err = deleteData(conn)
297+
//if err != nil {
298+
// fmt.Println("Can't delete data: ", err)
299+
// return
300+
//}
301301

302-
err = bulkInsert3(conn, 10)
302+
err = bulkInsert3(conn, 100000)
303303
if err != nil {
304304
fmt.Println("Can't insert: ", err)
305305
return

0 commit comments

Comments
 (0)