sagiegurari / simple-oracledb

Extend capabilities of oracledb with simplified API for quicker development.
Apache License 2.0
36 stars 4 forks source link

is simple oracledb or oracledb delete null column result ? #9

Closed behroozshafiabadi closed 8 years ago

behroozshafiabadi commented 8 years ago

when i execute select query on table,some json object results have not property that are null in the table. this cause my app throw error...is that a way to avoid this accidence ? is this happen ?

sagiegurari commented 8 years ago

you sure the properties are missing and not there with value of type undefined? I have a test that inserts 2 rows and sets 4 columns for each row. but the table holds 6 columns. In the query output, i get all 6 columns where the other 2 are set to undefined. You can see the test code here: https://github.com/sagiegurari/simple-oracledb/blob/3516aa9f3eac3294fb18542d0611a49aa1816719/test/spec/integration-spec.js#L155-L194

behroozshafiabadi commented 8 years ago

yes it's my fault they are undefined. is that any way to return empty string instead of undefined ?

sagiegurari commented 8 years ago

oracle (and i'm not close to be an expert like the oracle team) has no concept of empty string. when you insert empty string, it pushes null. so when you query, you can't query by empty string, you query by is null. so when you pull data that is 'empty string' it is basically null. so in my layer, i always get undefined, no matter if you pushed empty string or null, because it is always stored in the db as null. one of those strange oracle behaviors.

behroozshafiabadi commented 8 years ago

thanks your says are very useful