We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
table: create table blob_sample( id integer, payload blob);
gopkg.in/rana/ora.v4
func fatal(err error){ if err !=nil{ log.Fatal(err) } }
func testOracle(){ db ,err := sql.Open("ora","user/pwd@//127.0.0.1:1521/orcltest") fatal(err) defer db.Close() err = db.Ping() fatal(err) //ora.Cfg().Stm ids := []int64{2,3,4} datas := []string{"123443",""," "} for i:=0;i<len(ids);i++{ err := insertBlobDataByByte(db,ids[i],[]byte(datas[i])) if err !=nil{ fmt.Printf("fail to insert id:%d,data:%s,err:%v\n",ids[i],datas[i],err) continue } data,err:=readBlobDataByByte(db,ids[i]) if err!=nil{ fmt.Printf("fail to get id:%d,err:%v\n",ids[i],err) }else{ fmt.Printf("id:%d,data:%s,len:%d\n",ids[i],data,len(data)) } } }
func insertBlobDataByByte(db *sql.DB,id int64,abc []byte)error{ _,err := db.Exec("insert into blob_sample(id,payload)values(:1,:2)",id,abc) return err }
do import oracle init. ab is not empty, id:2,data:123443,len:6 fail to insert id:3,data:,err:Stmt.exeC.func1 recovered: runtime error: index out of range goroutine 1 [running]: gopkg.in/rana/ora%2ev4.getStack(0x0, 0x0) /mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/util.go:188 +0x92 gopkg.in/rana/ora%2ev4.errR(0xc421205490, 0x1, 0x1, 0xc4212054d0, 0x456aee) /mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/util.go:198 +0xe5 /opt/go/src/runtime/panic.go:502 +0x229 gopkg.in/rana/ora%2ev4.(*bndBin).bind(0xc420200270, 0xc1abe0, 0x0, 0x0, 0x2, 0x0, 0x0, 0xc4200a4b40, 0x0, 0x0) /mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/bndBin.go:33 +0x24a gopkg.in/rana/ora%2ev4.(*Stmt).bind(0xc4200a4b40, 0xc4201f2200, 0x2, 0x2, 0xffffffffffffff00, 0x1, 0x0, 0x0) /mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/stmt.go:941 +0x44ce gopkg.in/rana/ora%2ev4.(*Stmt).exeC(0xc4200a4b40, 0x8419e0, 0xc4200120b0, 0xc4201f2200, 0x2, 0x2, 0x1000000, 0x0, 0x2, 0x0, ...) /mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/stmt.go:309 +0x342 gopkg.in/rana/ora%2ev4.(*DrvStmt).ExecContext(0xc420206018, 0x8419e0, 0xc4200120b0, 0xc42124c0a0, 0x2, 0x2, 0x8, 0x0, 0x0, 0xc4212078d0) /mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/drvStmt_go1_8.go:46 +0x304 database/sql.ctxDriverStmtExec(0x8419e0, 0xc4200120b0, 0x841c60, 0xc420206018, 0xc42124c0a0, 0x2, 0x2, 0x2, 0x2, 0x0, ...) /opt/go/src/database/sql/ctxutil.go:65 +0x214 database/sql.resultFromStatement(0x8419e0, 0xc4200120b0, 0x8413e0, 0xc420022600, 0xc421207a78, 0xc421207d90, 0x2, 0x2, 0x0, 0x0, ...) /opt/go/src/database/sql/sql.go:2272 +0x198 database/sql.(*DB).execDC(0xc4200a68c0, 0x8419e0, 0xc4200120b0, 0xc4200cc200, 0xc421207bf0, 0x80b931, 0x30, 0xc421207d90, 0x2, 0x2, ...) /opt/go/src/database/sql/sql.go:1410 +0x2bc database/sql.(*DB).exec(0xc4200a68c0, 0x8419e0, 0xc4200120b0, 0x80b931, 0x30, 0xc421207d90, 0x2, 0x2, 0xc4201f2101, 0x20, ...) /opt/go/src/database/sql/sql.go:1371 +0x131 database/sql.(*DB).ExecContext(0xc4200a68c0, 0x8419e0, 0xc4200120b0, 0x80b931, 0x30, 0xc421207d90, 0x2, 0x2, 0x20, 0x77ac40, ...) /opt/go/src/database/sql/sql.go:1349 +0xe1 database/sql.(*DB).Exec(0xc4200a68c0, 0x80b931, 0x30, 0xc421207d90, 0x2, 0x2, 0xc1abe0, 0x0, 0x83e820, 0xc421207db0) /opt/go/src/database/sql/sql.go:1363 +0x85 main.insertBlobDataByByte(0xc4200a68c0, 0x3, 0xc1abe0, 0x0, 0x0, 0x0, 0x0) /mnt/e/gosrc/jpush-src-go-64/src/2018/toracle/main.go:141 +0x117 main.testOracle() /mnt/e/gosrc/jpush-src-go-64/src/2018/toracle/main.go:119 +0x193 main.main() /mnt/e/gosrc/jpush-src-go-64/src/2018/toracle/main.go:29 +0x70
The text was updated successfully, but these errors were encountered:
use gopkg.in/goracle.v2
gopkg.in/goracle.v2
Sorry, something went wrong.
@tgulacsi thanks, it work well
No branches or pull requests
table:
create table blob_sample( id integer, payload blob);
gopkg.in/rana/ora.v4
func fatal(err error){
if err !=nil{
log.Fatal(err)
}
}
func testOracle(){
db ,err := sql.Open("ora","user/pwd@//127.0.0.1:1521/orcltest")
fatal(err)
defer db.Close()
err = db.Ping()
fatal(err)
//ora.Cfg().Stm
ids := []int64{2,3,4}
datas := []string{"123443",""," "}
for i:=0;i<len(ids);i++{
err := insertBlobDataByByte(db,ids[i],[]byte(datas[i]))
if err !=nil{
fmt.Printf("fail to insert id:%d,data:%s,err:%v\n",ids[i],datas[i],err)
continue
}
data,err:=readBlobDataByByte(db,ids[i])
if err!=nil{
fmt.Printf("fail to get id:%d,err:%v\n",ids[i],err)
}else{
fmt.Printf("id:%d,data:%s,len:%d\n",ids[i],data,len(data))
}
}
}
func insertBlobDataByByte(db *sql.DB,id int64,abc []byte)error{
_,err := db.Exec("insert into blob_sample(id,payload)values(:1,:2)",id,abc)
return err
}
do import oracle init.
ab is not empty,
id:2,data:123443,len:6
fail to insert id:3,data:,err:Stmt.exeC.func1 recovered: runtime error: index out of range
goroutine 1 [running]:
gopkg.in/rana/ora%2ev4.getStack(0x0, 0x0)
/mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/util.go:188 +0x92
gopkg.in/rana/ora%2ev4.errR(0xc421205490, 0x1, 0x1, 0xc4212054d0, 0x456aee)
/mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/util.go:198 +0xe5
/opt/go/src/runtime/panic.go:502 +0x229
gopkg.in/rana/ora%2ev4.(*bndBin).bind(0xc420200270, 0xc1abe0, 0x0, 0x0, 0x2, 0x0, 0x0, 0xc4200a4b40, 0x0, 0x0)
/mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/bndBin.go:33 +0x24a
gopkg.in/rana/ora%2ev4.(*Stmt).bind(0xc4200a4b40, 0xc4201f2200, 0x2, 0x2, 0xffffffffffffff00, 0x1, 0x0, 0x0)
/mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/stmt.go:941 +0x44ce
gopkg.in/rana/ora%2ev4.(*Stmt).exeC(0xc4200a4b40, 0x8419e0, 0xc4200120b0, 0xc4201f2200, 0x2, 0x2, 0x1000000, 0x0, 0x2, 0x0, ...)
/mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/stmt.go:309 +0x342
gopkg.in/rana/ora%2ev4.(*DrvStmt).ExecContext(0xc420206018, 0x8419e0, 0xc4200120b0, 0xc42124c0a0, 0x2, 0x2, 0x8, 0x0, 0x0, 0xc4212078d0)
/mnt/e/gosrc/jpush-src-go-64/src/gopkg.in/rana/ora.v4/drvStmt_go1_8.go:46 +0x304
database/sql.ctxDriverStmtExec(0x8419e0, 0xc4200120b0, 0x841c60, 0xc420206018, 0xc42124c0a0, 0x2, 0x2, 0x2, 0x2, 0x0, ...)
/opt/go/src/database/sql/ctxutil.go:65 +0x214
database/sql.resultFromStatement(0x8419e0, 0xc4200120b0, 0x8413e0, 0xc420022600, 0xc421207a78, 0xc421207d90, 0x2, 0x2, 0x0, 0x0, ...)
/opt/go/src/database/sql/sql.go:2272 +0x198
database/sql.(*DB).execDC(0xc4200a68c0, 0x8419e0, 0xc4200120b0, 0xc4200cc200, 0xc421207bf0, 0x80b931, 0x30, 0xc421207d90, 0x2, 0x2, ...)
/opt/go/src/database/sql/sql.go:1410 +0x2bc
database/sql.(*DB).exec(0xc4200a68c0, 0x8419e0, 0xc4200120b0, 0x80b931, 0x30, 0xc421207d90, 0x2, 0x2, 0xc4201f2101, 0x20, ...)
/opt/go/src/database/sql/sql.go:1371 +0x131
database/sql.(*DB).ExecContext(0xc4200a68c0, 0x8419e0, 0xc4200120b0, 0x80b931, 0x30, 0xc421207d90, 0x2, 0x2, 0x20, 0x77ac40, ...)
/opt/go/src/database/sql/sql.go:1349 +0xe1
database/sql.(*DB).Exec(0xc4200a68c0, 0x80b931, 0x30, 0xc421207d90, 0x2, 0x2, 0xc1abe0, 0x0, 0x83e820, 0xc421207db0)
/opt/go/src/database/sql/sql.go:1363 +0x85
main.insertBlobDataByByte(0xc4200a68c0, 0x3, 0xc1abe0, 0x0, 0x0, 0x0, 0x0)
/mnt/e/gosrc/jpush-src-go-64/src/2018/toracle/main.go:141 +0x117
main.testOracle()
/mnt/e/gosrc/jpush-src-go-64/src/2018/toracle/main.go:119 +0x193
main.main()
/mnt/e/gosrc/jpush-src-go-64/src/2018/toracle/main.go:29 +0x70
The text was updated successfully, but these errors were encountered: