mattn / go-oci8

Oracle driver for Go using database/sql
https://mattn.kaoriya.net/
MIT License
630 stars 212 forks source link

Change LastInsertId to unsuported #296

Closed MichaelS11 closed 5 years ago

MichaelS11 commented 5 years ago

@mattn

The Oracle rowid is 13 bytes but int64 is only 8 bits. I think we should change LastInsertId to unsupported. What do you think?

mattn commented 5 years ago

The Oracle rowid is 13 bytes but int64 is only 8 bits.

What do you mean? 64bit?

MichaelS11 commented 5 years ago

Meant to say 8 bytes. So the amount/size of the rowid data can not fit into int64 size of 8 bytes.

cjbj commented 5 years ago

FWIW the newer UROWID could take up to 4000 bytes in the DB, and may need up to 5267 bytes in the Oracle Client.

mattn commented 5 years ago

Value of LastInsertId from go-oci8 is a pointer to string not real value of Oracle rowid. So it is possible to hold 4000 bytes rowid. I did not think that go-oci 8 could handle the rowid of Oracle because type of LastInsertId is typed to int64. go-oci8 need to call two APIs to get real LastInsertId

https://github.com/mattn/go-oci8/blob/b0e38e039e839a22d147a8415fad2f4592fdd1d7/_example/lastinsertid/main.go#L63

MichaelS11 commented 5 years ago

Ah, got it. Thank you