jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Douglass" <douglass.d...@gmail.com>
Subject Re: SQL equivalent of Node.hasProperty?
Date Thu, 24 Aug 2006 16:41:36 GMT
Replying for the benefit of others...

Appearantly the export/import of a document view breaks the sql IS NULL/IS
NOT NULL test for optional properties that never had a value assigned, at
least for STRING properties, I haven't tested other types. The Value in a
Row returned in a QueryResult is null, but trying to "SELECT ... WHERE
the:property IS NOT NULL" includes nodes where the:property equals null,
vice versa for IS NULL.

I'll be rethinking my use of document view export/import for setting up a
standard set of data for unit tests.

NOTE: This issue occurs with different persistence managers -- tested with
XMLPersistenceManager and DerbyPersistentManager.

On 8/24/06, Doug Douglass < douglass.doug@gmail.com> wrote:
>
> Thanks for the reply (and others) Marcel,
>
> I thought #1 should have worked also. I'll write up a test to inspect the
> Row and it's values and see what's actually in there.
>
> Note that the nodes in question are an exported document view that is
> imported during Junit TestCase.setUp and removed again in
> TestCase.tearDown -- sort of a poor mans dbunit for jcr.
>
> Doug
>
>
> On 8/24/06, Marcel Reutegger < marcel.reutegger@gmx.net> wrote:
> >
> > Doug Douglass wrote:
> > > I thought I knew the answer but I'm unable to get it right:
> > >
> > >  If a node type baz is defined as having an optional property foo:bar
> > > (STRING), and I want to find all such nodes without a foo:bar property
> > > actually stored (i.e., Node.hasProperty("foo:bar") == false), I would
> > > expect
> > > that one of the following would work:
> > >
> > >  1. SELECT * FROM baz WHERE foo:bar IS NULL;
> >
> > this one should work. there is a test case, which actually tests this
> > feature: SimpleQueryTest.testIsNull ()
> >
> > are you able to reproduce the error when using a predefined node type
> > like nt:unstructured?
> >
> > >  2. SELECT * FROM baz WHERE foo:bar = '';
> >
> > this will return baz nodes with a foo:bar property *set* to an empty
> > string. which is obviously not the same as nodes not having the
> > property at all.
> >
> > regards
> >   marcel
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message