Login  Register

Trouble with <sql:param>

classic Classic list List threaded Threaded
1 message Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Trouble with <sql:param>

dcrensha
8 posts
I am attempting to use the sql:param to put some data from another part of a form into a query (ie. ... SELECT * WHERE id=<sql:param .../>). I can't seem to get the element to return anything however, and NULL is put in the query instead.

My actual param statement goes like this:

<sql:param type="xs:int" select="instance('user-id-data')"/>

I will post the xpl file where I call it for reference:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
         xmlns:sql="http://orbeon.org/oxf/xml/sql"
              xmlns:xs="http://www.w3.org/2001/XMLSchema"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:oxf="http://www.orbeon.com/oxf/processors"
              xmlns:xi="http://www.w3.org/2001/XInclude">

    <p:param type="input" name="instance"/>
    <p:param type="output" name="data"/>

    <p:processor name="oxf:sql">
        <p:input name="data" href="#instance"/>
        <p:input name="datasource" href="/config/datasource-sql.xml"/>
        <p:input name="config">
            <sql:config>
                <store_info>
                    <sql:connection>
                        <sql:execute>
                            <sql:query>
                                SELECT store_number, store_name, unit_id, unit_access_id
                                        FROM unit
                                        JOIN unit_info USING (unit_id)
                                        LEFT JOIN (SELECT unit_id, unit_access_id FROM unit_access
                                                      WHERE user_id=<sql:param type="xs:int" select="instance('user-id-data')"/>) tmp
                                                      USING (unit_id)
                                        WHERE active=1 AND unit_access_id IS NOT NULL
                            </sql:query>
                            <sql:result-set>
                                <sql:row-iterator>
                                    <stores>
                                        <store_number>
                                                <sql:get-column-value type="xs:string" column="store_number"/>
                                        </store_number>
                                        <store_name>
                                            <sql:get-column-value type="xs:string" column="store_name"/>
                                        </store_name>
                                        <unit_id>
                                            <sql:get-column-value type="xs:int" column="unit_id"/>
                                        </unit_id>
                                        <unit_access_id>
                                            <sql:get-column-value type="xs:int" column="unit_access_id"/>
                                        </unit_access_id>
                                    </stores>
                                </sql:row-iterator>
                            </sql:result-set>
                        </sql:execute>
                    </sql:connection>
                </store_info>
            </sql:config>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>

</p:config>

The place the data is supposed to be coming from is my view.xhtml. Is there something special one has to do to pass the parameter from one file to the other?

Thanks in advance,
Dennis