tgulacsi / goracle

cx_Oracle translation for Oracle access
Other
47 stars 16 forks source link

Provide examples and test cases for lobvar insert/updates #25

Open qqiao opened 10 years ago

qqiao commented 10 years ago

We currently have example for lobvar reads: https://github.com/tgulacsi/goracle/blob/798cff6d604b0c9535d5d0a1077b3f8a6c849328/godrv/driver_test.go#L86

However, we don't have any examples or test cases for inserting/updating blob/clob columns, could these be added?

I hope I'm not missing anything obvious.

tgulacsi commented 10 years ago

Hi, just for heads up: I've noticed your request, but just don't have any free time these days. I'll try to create an example, as soon as possible.

tgulacsi commented 10 years ago

I've added clob insertion test - see godrv/table_test.go insertClob function. Sorry, but the shorter version (insert into ... () values() returning F_clob INTO :1) doesn't work for now - didn't have time to investigate whether it is Go's sql driver's limitation, or my fault.

qqiao commented 10 years ago

Thanks for the prompt reply.

The reason I raised this issue is because I was able to insert into CLOB columns using a normal string, for exmaple

CREATE TABLE temp ( c CLOB )

Then in Go code: s := "Some String" db.Exec("INSERT INTO temp (c) VALUES (?)", a)

The above snippet is actually functional, and when I looked at ExternalLobVar, it has all the Write* functions, which is what got me nervous, the direct insertion almost felt like a fluke and I was expecting to have to use ExternalLobVar

I have not looked too deeply into the code, otherwise I'd PR test cases to the project.