[freetds] cast to void?
James K. Lowden
jklowden at freetds.org
Tue Dec 4 11:38:32 EST 2007
HI Freddy,
ZIGLIO, Frediano, VF-IT wrote:
> > Next time, I think I'll compile first and post second.
> >
>
> Personally I like the distinction made in C++ that use
> const_cast instead of C style casts...
Me too.
> I also don't understand why we need to allocate some memory in order to
> return NULLs... dbgetnull is called only by _set_null_value. Perhaps
> _set_null_value should do all the job without allocation stuff?? But...
> bindval should not be always initialized?? to_free is used only to pass
> data from dbgetnull to _set_null_value, perhaps merging dbgetnull and
> _set_null_value we can remove this field.
Yes, I think we should merge them. We allocate the memory only to copy it
to the rowbuffer. Not very smart. We can write blanks/zeros to the
rowbuffer directly instead.
The code evolved as I understood what to do. It's not quite done. ;-)
> I noted also that we defined a new NULLREP structure with a field
> (capability) that we don't use at all.
We can remove it, now that we we know it's not needed.
> Why we need a initialize_default_null_representations if
> default_null_representations can be initialized statically (and be
> const)?
Only because it's hard to get right statically. The array is 19 long with
some gaps. I didn't want to accidentally set the default null
representation of, say, TINYBIND to be the one that belongs to
DATETIMEBIND.
> Is correct dbsetnull for VARYBINBIND/VARYCHARBIND?? Perhaps we should
> copy the entire structure??
I don't know.
> I think we don't even support these stranges types...
Not very well. It's not something I have much use for personally. Every
time I look into it, I get lost in the rowbuffer code and stop.
One of these days, I'm going to write bcp_moretext() -- which will mean
yet another slash through the bcp code. bcp 'IN' should be written in
terms of bcp_bind() and bcp_moretext(), and bcp 'OUT' should use dbbind()
and dbreadtext().
To get that working, VARYBINBIND will have to work. All in good time.
Regards,
--jkl
More information about the FreeTDS
mailing list