go-goracle / goracle

Go database/sql driver for connecting to Oracle Database, using the ODPI-C library
273 stars 43 forks source link

NULL comes back 0 true with sql.NullFloat64 #10

Closed fils closed 7 years ago

fils commented 9 years ago

I've been able to get everything working and even used the sqlx struct scan and the standard library "manual" approach of populating a struct. I'm having no issues except for one.

I keep getting results back from Oracle 12c that are nill via SQLDeveloper UI but come out a {0 true} in my code.

Has there been any reports or issues with nill values not coming back that way?

tgulacsi commented 9 years ago

Hmm, can you send a minimum reproduction (code with the select & Scan + the underlying table's type)? You can try to build with -tag=trace and inspect/attach the logs, too.

fils commented 9 years ago

I see we are in both issue threads.. but I thought I would post this here too

This is a reference to my code: https://gist.github.com/fils/ffb99e48bc3e994d54f1 I've tried to remove IP's and user/pass stuff

Please forgive the sloppy all over the place testing... :)

fils commented 9 years ago

It's ugly, but I think this is the table info you wanted...

[{'default': None, 'autoincrement': True, 'type': NUMBER(precision=5, scale=0, asdecimal=False), 'name': u'leg', 'nullable': False}, {'default': None, 'autoincrement': True, 'type': NUMBER(precision=6, scale=0, asdecimal=False), 'name': u'site', 'nullable': False}, {'default': None, 'autoincrement': True, 'type': VARCHAR(length=1), 'name': u'hole', 'nullable': False}, {'default': None, 'autoincrement': True, 'type': NUMBER(precision=5, scale=0, asdecimal=False), 'name': u'core', 'nullable': False}, {'default': None, 'autoincrement': True, 'type': VARCHAR(length=1), 'name': u'core_type', 'nullable': False}, {'default': None, 'autoincrement': True, 'type': NUMBER(precision=2, scale=0, asdecimal=False), 'name': u'section_number', 'nullable': False}, {'default': None, 'autoincrement': True, 'type': VARCHAR(length=2), 'name': u'section_type', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'top_cm', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'bot_cm', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'depth_mbsf', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'inor_c_wt_pct', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'caco3_wt_pct', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'tot_c_wt_pct', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'org_c_wt_pct', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'nit_wt_pct', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'sul_wt_pct', 'nullable': True}, {'default': None, 'autoincrement': True, 'type': NUMBER(asdecimal=False), 'name': u'h_wt_pct', 'nullable': True}] leg : int64 site : int64 hole : object core : int64 core_type : object section_number : int64 section_type : object top_cm : int64 bot_cm : int64 depth_mbsf : float64 inor_c_wt_pct : float64 caco3_wt_pct : float64 tot_c_wt_pct : float64 org_c_wt_pct : float64 nit_wt_pct : float64 sul_wt_pct : object h_wt_pct : object