Accessing a count in a multiple sql:update?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing a count in a multiple sql:update?

Alan Leavy

Hi all,

 

I’m looking for a feature that works a bit like sql:row-position() does in an <sql:row-iterator>, for use in a multiple update [<sql:update select="/whatever">].

 

I’ve tried  this:

<sql:execute>

    <sql:update select="//*[@cupping_attribute='true']">

INSERT INTO [MANDE].[dbo].[CUPPING_FORM_ATTRIBUTES]

                   ([CUPPING_FORM_ID]

                   ,[ATTRIBUTE_ID]

                   ,[DISPLAY_ORDER])

             VALUES

                   (<sql:param type="xs:string" select="/cupping_sheet/cupping_form_id" />

                   ,<sql:param type="xs:string" select="." />

                   ,<sql:param type="xs:int" select="position()" />)

    </sql:update>

 

But DISPLAY_ORDER ends up as 0 in all of the inserted CUPPING_FORM_ATTRIBUTES records.

 

Any Ideas?

 

Regards,

    Alan.

 

--------------------------------------------------------

Alan Leavy

Regional IT Manager

Technoserve East Africa / Coffee Programme

P.O. Box 78375

Dar Es Salaam, Tanzania.

Office: +255 (0)222 600 455

Fax:    +255 (0)222 600 466

Mobile: +254 (0)728 606 488 (Kenya)

Skype: leavyalan

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Accessing a count in a multiple sql:update?

Erik Bruchez
Administrator
Mmh, that looks like a bug in the SQL processor. position() should
work ideally. Note that the SQL processor doesn't use the Saxon XPath
2.0 implementation, but a much older XPath 1.0 implementation.

The issue is probably in this file:

http://github.com/orbeon/orbeon-forms/blob/master/src/java/org/orbeon/oxf/processor/sql/interpreters/QueryInterpreter.java

-Erik

On Fri, Jun 18, 2010 at 2:30 AM, Leavy, Alan <[hidden email]> wrote:

> Hi all,
>
>
>
> I’m looking for a feature that works a bit like sql:row-position() does in
> an <sql:row-iterator>, for use in a multiple update [<sql:update
> select="/whatever">].
>
>
>
> I’ve tried  this:
>
> <sql:execute>
>
>     <sql:update select="//*[@cupping_attribute='true']">
>
> INSERT INTO [MANDE].[dbo].[CUPPING_FORM_ATTRIBUTES]
>
>                    ([CUPPING_FORM_ID]
>
>                    ,[ATTRIBUTE_ID]
>
>                    ,[DISPLAY_ORDER])
>
>              VALUES
>
>                    (<sql:param type="xs:string"
> select="/cupping_sheet/cupping_form_id" />
>
>                    ,<sql:param type="xs:string" select="." />
>
>                    ,<sql:param type="xs:int" select="position()" />)
>
>     </sql:update>
>
>
>
> But DISPLAY_ORDER ends up as 0 in all of the inserted
> CUPPING_FORM_ATTRIBUTES records.
>
>
>
> Any Ideas?
>
>
>
> Regards,
>
>     Alan.
>
>
>
> --------------------------------------------------------
>
> Alan Leavy
>
> Regional IT Manager
>
> Technoserve East Africa / Coffee Programme
>
> P.O. Box 78375
>
> Dar Es Salaam, Tanzania.
>
> Office: +255 (0)222 600 455
>
> Fax:    +255 (0)222 600 466
>
> Mobile: +254 (0)728 606 488 (Kenya)
>
> Skype: leavyalan
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws