Hi,

Gabriela Radu wrote:
hi.
i don;t want to export my projects, i just want to see the tables that xwiki creates when i make a new space(project). how can i see that? like in using mysql you can see the db from the ".sql" . do i have something similar here? pls say yes :)
Thank you!
 

Hi Gabriela,

I am not sure what are you looking for, but I think that you must we aware about the fact that no new table is created when you create a new space. In fact a new space exists when a page is created on it. And it will be removed when all the pages belonging to it are deleted. So, new pages/spaces are stored in the predefined database structure.

XWiki has its own methods that will probably allow you to get what you want. For instance, look at the My Recent Modifications panel code:

#set($recentDocs = $xwiki.searchDocuments("where 1=1 and doc.author='$context.user' order by doc.date desc", 5, 0))
#if($recentDocs.size() > 0 || $showEmptyPanels)
#panelheader($msg.get("My Recent Modifications"))
#set($first = true)
#foreach($docname in $recentDocs)
#set($rdoc = $xwiki.getDocument($docname).getTranslatedDocument())
#if($first == true)
#set($first = false)
#else
<span class="pitemseparator"> | </span>
#end
<span class="panelitem"><a href="$rdoc.getURL("view")">$rdoc.displayTitle</a></span>
#end
#panelfooter()
#end

The first Velocity directive, #set, uses a method searchDocuments() of the $xwiki class to pass a given set of documents to $recentDocs. Its argument contents "pure" SQL: "where 1=1 and doc.author='$context.user' order by doc.date desc" :-)

On the other hand, it is possible to use SQL within XWiki. See this Groovy snippet...

<%
import groovy.sql.Sql
db = Sql.newInstance("jdbc:mysql://YourHots/YourDatabase", "username", "password", "com.mysql.jdbc.Driver")
List YourResults = db.rows('SELECT * FROM tablename s where field1 like "I" and field2 like "A" and field>=1')
%>

It allows you to use SQL statements and get the results on your XWiki page. It, of course, can ask XWiki schema as well.

Hope this helps,

Ricardo
-- 
Ricardo Rodríguez
Your EPEC Network ICT Team