It's well know that Oracle#s state of the art database server can
rarely tell the difference between an empty string and a NULL
(I presume that's not changed recently, though I'd be very happy
to be told otherwise).

So people who don't want empty strings being stored as NULLs in
their fields tend to use some specific non-empty string insead,
a single space being very common.

The DBI has an attribute called ChopBlanks that, when set true,
enables the automatic removal of trailing spaces from fetched CHAR
field data (which Oracle has 'helpfully' padded out to the declared
fixed width).

I'm considering extending the definition of ChopBlanks to include
VARCHAR type fields. This has been requested several times over the
years by DBI users. The change would neatly hide the use of a space
to represent an empty string.

I'd like to get some feedback on this idea from DBD::Oracle users.

I'm especially interested in the risk of changing the behaviour of
existing code. That would _only_ happen if you explicitly set
ChopBlanks, and fetch VARCHAR data that has trailing spaces, and the
removal of those spaces would change the behaviour of your application.

An alternative approach would be to add a new private attribute
that just translates a single space value into an empty value.
That would be "safer" but less generically useful.

Tim

p.s. I've sent this to both [EMAIL PROTECTED] and [EMAIL PROTECTED]
Please delete at least one of these addresses when replying. Thanks.

p.p.s. A corresponding mechanism to optionally automatically treat
empty strings bound to placeholders as a single space will probably
also be added to DBD::Oracle and enabled via private attribute.

Reply via email to