On 11/13/06, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
Robert Zajda <[EMAIL PROTECTED]>
wrote:

> On 11/12/06, Igor Tandetnik <[EMAIL PROTECTED]>
> wrote:
>> Robert Zajda
>> <[EMAIL PROTECTED]>
>> wrote:
>>>> Perhaps something like this:
>>>>
>>>> update articles set order=-1 where order=:oldorder
>>>> update articles set order=:oldorder where order=:neworder
>>>> update articles set order=:neworder where order=-1
>
> Forgive me, my english is not good enough.
> I want to "move up" row with order 2 (on first position - to have
> order 1).

So you execute the sequence I've shown with :oldorder bound to 2 and
:neworder to 1.

> Maybe it's trivial quastion but should I use:
> update articles set order=-1 where order=:oldorder and order=2
> update articles set order=:oldorder where order=:neworder
> update articles set order=:neworder where order=-1

:oldorder and :neworder are meant as parameters. You should use actual
values there, either by physically substituting them into the queries,
or by using SQLite's parameter binding mechanism (see sqlite3_prepare,
sqlite3_bind_int et al).

> It wont works.

What makes you say so? What difficulty do you foresee?


Thanks for your time.
This solution seems to works ok. As I understand that "-1" is used for
temporary. But how about two actions in the same time ? I'm
implementing this in web application for changing position of
articles. When two different users do the same action with the same
row it may be supprise , isn't it ?

Regards
Robert

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to