RE: Revisited: Oracle and the empty string

2010-10-04 Thread Greg Monroe
You might handle this by defining fields which allow null to be optional in 
your XML.  E.g., tag not in XML = NULL / tag exists and is empty = .  I think
the XML parsers can differentiate between these with some extra code.

FYI - You might want to take a look at:

http://torque-addons.sourceforge.net/XML-Import-Export/index.html

This is some code I wrote a while back to support import/export of data into
one of my systems.  I've also used it as a basis for some REST services I 
added.

 -Original Message-
 From: Thomas Fischer [mailto:fisc...@seitenbau.net]
 Sent: Friday, October 01, 2010 4:29 PM
 To: Apache Torque Users List
 Subject: Re: Revisited: Oracle and the empty string
 
 Thomas Vandahl t...@apache.org wrote:
  On 01.10.10 21:47, Thomas Fischer wrote:
   In my experience, it is no problem if you keep that fact in mind. It
 just
   makes the code non-portable to another database (you only query for
 not
   null and know it's also not empty in oracle, but not dor other
 databases).
   Is it a problem for yaou if  and null get mapped to the same value
 ?
 
  Unfortunately it is. The XML processing is different for these cases.
  Suggestions are welcome. Patch it in the template to some strange
 value?
  Other ideas?
 
 I do not understand the problem well enough (perhaps you can provide a
 little code example ?) but what you could do is to use the first characte
 of the String in the database as a flag: N for null and O for other
 (not null). You can overwrite the setters and getters such that they add
 and remove the flag automatically.
 
 You could use the template override mechanism in Torque4 to do this with
 minimum impact. There is a similar example in the torque4 test project
 (use
 the overrideConfigDir to override certain template settings). If you look
 at it and there is not enough documentation just open a jira issue.
 
 Thomas
 
 
 -
 To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
 For additional commands, e-mail: torque-user-h...@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@db.apache.org



RE: Revisited: Oracle and the empty string

2010-10-01 Thread Thomas Fischer
 just a question about a best-practice. We are trying to implement an
 XML-to-DB-mapper service on Oracle. The (existing) XSD defines some
 fields which distinguish between not set (null) and empty (). How
 do others handle this in Oracle? Especially within Torque?

In my experience, it is no problem if you keep that fact in mind. It just
makes the code non-portable to another database (you only query for not
null and know it's also not empty in oracle, but not dor other databases).
Is it a problem for yaou if  and null get mapped to the same value ?

an aside: Others (empire-db in the incubator) have tried to make this
portable by always mapping  to null for all databases, but I do not think
this is a good idea either. No ideal solution of this problem is known to
me.

Thomas


-
To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@db.apache.org



Re: Revisited: Oracle and the empty string

2010-10-01 Thread Thomas Vandahl
On 01.10.10 21:47, Thomas Fischer wrote:
 In my experience, it is no problem if you keep that fact in mind. It just
 makes the code non-portable to another database (you only query for not
 null and know it's also not empty in oracle, but not dor other databases).
 Is it a problem for yaou if  and null get mapped to the same value ?

Unfortunately it is. The XML processing is different for these cases.
Suggestions are welcome. Patch it in the template to some strange value?
Other ideas?

Bye, Thomas

-
To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@db.apache.org



Re: Revisited: Oracle and the empty string

2010-10-01 Thread Thomas Fischer
Thomas Vandahl t...@apache.org wrote:
 On 01.10.10 21:47, Thomas Fischer wrote:
  In my experience, it is no problem if you keep that fact in mind. It
just
  makes the code non-portable to another database (you only query for not
  null and know it's also not empty in oracle, but not dor other
databases).
  Is it a problem for yaou if  and null get mapped to the same value ?

 Unfortunately it is. The XML processing is different for these cases.
 Suggestions are welcome. Patch it in the template to some strange value?
 Other ideas?

I do not understand the problem well enough (perhaps you can provide a
little code example ?) but what you could do is to use the first characte
of the String in the database as a flag: N for null and O for other
(not null). You can overwrite the setters and getters such that they add
and remove the flag automatically.

You could use the template override mechanism in Torque4 to do this with
minimum impact. There is a similar example in the torque4 test project (use
the overrideConfigDir to override certain template settings). If you look
at it and there is not enough documentation just open a jira issue.

Thomas


-
To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
For additional commands, e-mail: torque-user-h...@db.apache.org