RE: [xwiki-users] SQL hair-pulling
by THOMAS, BRIAN M (SBCSI)
Frank:
Thanks. Now, to refine the question a bit: is the set of columns available within each virtual table equivalent to the set of all the Velocity "properties" of each object - which means, as I understand it, all attributes represented by public methods named "get" and "set", declared locally or inherited, by the object's class? It doesn't seem that I have been able to depend on that, but I've gotten pretty turned around dealing with all the metadata and meta-metadata.
It seems that the "virtual" schema is supported by the data in the documented schema, though it's not clear that everything needed is there.
Further, I don't think I quite understand how to parse the returned result. From the javadoc, I can see that XWiki.search() returns a java.util.List. Through Java reflection I find that the List is actually a java.util.ArrayList, and that each ArrayList element is a java.lang.Object, which is itself an array of java.lang.Object, or depending on how I look at it, of java.lang.reflect.Field. I get the expected number of objects in the array(the number of requested fields in the query), and each one is of the expected type, with the expected value, which is great, but it doesn't seem from the analysis that it ought to. Again, I've probably just confused myself unnecessarily...
The real difficulty I have is in directly addressing any field of a returned row. I can loop through it and see what each one is, but without doing that and assigning each field based on the iteration count, I can't just use each field as I can with the returned list from getObjects. I've tried using the get() method that takes an integer index, but that doesn't seem to work; among other things, there's also another get() that takes a string for the field name. I haven't tried that one...
Thanks again for a clear answer; this message is both further question and open-ended comment, in hope of stimulating more discussion in order to gain a more solid understanding of what can be done. However much I love to tinker, I am not primarily a developer but an architect and designer, so I need to concentrate on making sure that the tools our developers use are up to the jobs that I give them. It does appear that XWiki is, although the metadata gymnastics needed to navigate the schema are probably a bit too tedious for the average application programmer, let alone the average wiki user. I'm seriously considering building a tool to make those queries more straightforward, though my job rarely permits such luxuries as merely improving the productivity of all our staff...
Of course, I can always go to the sources, and I will if I don't get an answer here (and if I have time). More than that, I will share it with the list, on the off chance that someone else needs it...
brain[sic]
-----Original Message-----
From: Frank Häfemeier [mailto:frank@haefemeier.net]
Sent: Thursday, March 23, 2006 10:39 AM
To: xwiki-users(a)objectweb.org
Subject: AW: [xwiki-users] SQL hair-pulling
>As mentioned in an earlier message, I got into the $xwiki.search()
>world yesterday, and am thoroughly confused.
>
>The main problem seems to be that the XWiki database schema and the
>schema used in all of the $xwiki.search() queries I have found are
>completely disjoint.
>
>Instead of the documented tables and columns, what seems to be used is
>a schema which reflects the object model within XWiki. This would
>really be convenient if true; is it?
This is right.
Bye
Frank