Skip to content
New issue

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

CLOB and BLOB columns are not filled #4

Open
toao opened this issue Jan 21, 2022 · 3 comments
Open

CLOB and BLOB columns are not filled #4

toao opened this issue Jan 21, 2022 · 3 comments

Comments

@toao
Copy link

toao commented Jan 21, 2022

Hi @keeguon ,
it seems that CLOB and BLOB columns are currently not properly handled: instead of the actual data empty_clob() is passed instead which leads to empty entries.

I've put an example into the related issue in the main gem: zdennis/activerecord-import#637 (comment)

@keeguon
Copy link
Owner

keeguon commented Mar 8, 2022

@toao wow, totally missed that notification truly sorry, will take a look over the week.

@keeguon
Copy link
Owner

keeguon commented Mar 8, 2022

@toao I took a look and it seems it's coming from the adapter itself misbehaving when quoting values of *LOB columns as you can see here : https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb#L77-L92.

Apparently some people have reported this behavior in the past here : rsim/oracle-enhanced#1588 and have solved it by casting the value directly in the SQL statement but handling it in this "activerecord-import" extension seems it could have other consequences and could be costly cause we would have to iterate over the value set and check the type in the DB for each column to call the cast function which is kind of out of the scope of the original gem.

@toao
Copy link
Author

toao commented Mar 8, 2022

@keeguon thanks for the feedback and having a look. meanwhile we patched it ourselves and using a fork in our project. it's not pretty but it works 😉

There's also an additional problem with to_clob() not being able to handle any length/size of a string, so the data has to be split in chunks and afterwards joined again within the SQL statement.

here's what we changed: toao/oracle-enhanced@9da904a...toao:2db0fb62fefe34e70fee29583eeaf19face7ca44

I guess this issue can be closed then, as it has to be fixed directly in oracle-enhanced instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants