Michael Wilson | 29 Jan 2006 08:15
Favicon

oXml DB Question

I have a stored procedure on my database server.  Using the db
extensions is it possible to call the stored procedure with oXML?  The
documentation web page mentions the <db:execute> but doesn't give a
complete example.  Such as how do you define the datasource when using
this method?  Anyway, if anyone is reading this that knows if this is
possible can I get a short example?  Thanks.

Mike
Martin Klang | 30 Jan 2006 15:01
Picon
Favicon

Re: oXml DB Question

Hi Michael,

I've little experience of stored procedures so I'll have to  
investigate this further, however here's an initial reply that might  
help.

With db:execute you can run any SQL query. There's no explicit  
support for stored procedures (or CallableStatements in JDBC) though  
you should be able to call a procedure with something like:
<db:execute sql="{call FOOBAR}"/><!-- call the stored procedure  
'FOOBAR' -->
On Oracle the syntax _may_ be:
<db:execute sql="{exec FOOBAR}"/>

If you want to use the result set you should be able to include a  
result template as the db:execute body as usual. For example, if  
FOOBAR returns a column called 'FOO', you can do:
<db:execute sql="{call FOOBAR}"><foobar>{$foo}</foobar></db:execute>
This should, theoretically, produce a foobar element for each row in  
the result.

Otherwise I'm told that you can wrap a stored procedure in a SQL  
function, which can then be used in a normal select statement.

I'm not sure about passing parameters or returning values, I'll have  
to look into that.

hope this helps!

/m
(Continue reading)

Michael Wilson | 30 Jan 2006 17:57
Favicon

RE: oXml DB Question

Thanks.  I figured out I could just:
<db:sql>
      DECLARE 
        val INTEGER; 
      BEGIN
        val := codex.main.add_search({$in_show},{$in_name},{$in_parent},
{$in_where}); 
      END;
</db:sql> 

which seems to work.  I do need that return value if possible though.
Any idea on how to get at the val variable from the above statement?  I
have a work around but it would save me "yet another hack" elsewhere in
my code.  Thanks for your help.  I'll give the cleaner syntax you
mentioned a try.

Mike 

-----Original Message-----
From: Martin Klang [mailto:martin@...] 
Sent: Monday, January 30, 2006 6:02 AM
To: Michael Wilson
Cc: o-xml@...
Subject: Re: [o:XML] oXml DB Question

Hi Michael,

I've little experience of stored procedures so I'll have to investigate
this further, however here's an initial reply that might help.

(Continue reading)

Martin Klang | 30 Jan 2006 18:40

Re: O:XML and firefox 1.5 SVG

Hey,

sorry for the delay in replying -

I tried using one of the shorter examples (Style 1) as a base and did  
this:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<o:program xmlns:o="http://www.o-xml.org/lang/" content-type="text/xml">
<html:html xmlns:html="http://www.w3.org/1999/xhtml">
   <html:head>
     <html:script type="text/javascript">
       function change_style(style_string)
       {
       document.getElementById("circ100").setAttribute("style",  
style_string);
       }
     </html:script>
   </html:head>
   <html:body>
     <html:button onclick="change_style('fill:red;');">red</html:button>
     <html:button onclick="change_style('fill:blue;');">blue</ 
html:button>
     <svg:svg xmlns:svg="http://www.w3.org/2000/svg" height="200">
       <o:for-each in="60 100 140 180">
         <svg:circle cx="{.}" cy="100" r="1cm" id="circ{.}"  
style="fill:red;"/>
       </o:for-each>
(Continue reading)

Martin Klang | 31 Jan 2006 19:21

Re: O-XML translation to Java

Philip,

Sincere apologies for not answering this earlier, it somehow got lost  
in the pile.

Due to fundamental differences between Java and o:XML, such as static  
vs dynamic typing and the pervasive use of XPath in o:XML,  
translation is somewhat complicated.

A good while ago I did a proof of concept code translation that uses  
XSLT to produce Java code which can then be compiled against the  
ObjectBox libraries. It was never completed to implement all language  
features, but showed that it can be done. (Let me know if you want to  
try it out)

Since then efforts have focused on the Java-based interpreter, which  
achieves comparable performance to the translated code and is much  
easier to use. Debugging code that's been translated then compiled is  
a pain.

Longer term plans include developing the MLML [1] concepts to build  
Java and/or .Net byte-code generators, thus circumventing the need  
for generating Java sources. In effect, the o:XML compiler _is_ a  
translator that produces an abstract syntax tree, which can be fed to  
either an interpreter or code generator.

hope this answers your question, again, sorry for the tardy response!

/m

(Continue reading)


Gmane