On Tue, 9 Aug 2016 17:09:39 -0300
Paulo Roberto wrote:
> I would like something like this:
>
> "BEGIN EXCLUSIVE TRANSACTION;"
> "SELECT counter FROM mytable WHERE counterid = ?;"
> "UPDATE mytable SET counter=? WHERE counterid = ?;"
> "COMMIT TRANSACTION;"
On Thu, Aug 11, 2016 at 4:34 AM, Paulo Roberto
wrote:
> Thank you very much, it worked!
Just remember that exposing a SQL function that de-references a
"user"-supplied integer value as a pointer is inherently unsafe.
Anyone can select remember(val, 0) or select
Thank you very much, it worked!
On Tue, Aug 9, 2016 at 11:49 PM, Richard Hipp wrote:
> On 8/9/16, Paulo Roberto wrote:
> >
> > I found your solution pretty elegant and I tried to implement it.
> > But after solving a lot of building issues with the
On 8/9/16, Paulo Roberto wrote:
>
> I found your solution pretty elegant and I tried to implement it.
> But after solving a lot of building issues with the sqlite3ext header
It does not have to be implemented as a loadable extension. Just copy
the lines
Thank you for all the answers.
Clemens,
The counterid in my case is a text field and not an integer. That's why I
need to sanitize.
Clemens and Keith,
As each of my process has its own connection to the database, I tried your
solution using BEGIN IMMEDIATE and it worked successfully.
Thank you.
> "BEGIN EXCLUSIVE TRANSACTION;"
> "SELECT counter FROM mytable WHERE counterid = ?;"
> "UPDATE mytable SET counter=? WHERE counterid = ?;"
> "COMMIT TRANSACTION;"
> I have a counter that I need to increment and get its previous value in one
> operation.
> To access this counter I must pass
On 8/9/16, Richard Hipp wrote:
> Or, you could make remember() a two argument function:
>
>UPDATE mytable SET counter=remember(counter, $ptr)+1 WHERE counterid=$id
>
A sample implementation for this function can now been seen at
On 8/9/16, Richard Hipp wrote:
>
> UPDATE mytable SET counter=remember(counter)+1 WHERE counterid=?
>
Or, you could make remember() a two argument function:
UPDATE mytable SET counter=remember(counter, $ptr)+1 WHERE counterid=$id
Then bind $ptr to the address of the
On 8/9/16, Paulo Roberto wrote:
>
> I need some help to ... increment a counter and get its
> former value.
> My question is: Preparing 4 statements, binding then and calling
> *sqlite3_step
> *for each one of then in order, would have the expected atomic operation
>
On 9 Aug 2016, at 9:09pm, Paulo Roberto wrote:
> My question is: Preparing 4 statements, binding then and calling *sqlite3_step
> *for each one of then in order, would have the expected atomic operation
> behavior or not?
You might be happier with BEGIN IMMEDIATE.
No
Paulo Roberto wrote:
> I need some help to do a simple operation, increment a counter and get its
> former value.
> I could have some race condition, so the transaction must be atomic.
>
> I also would like to use prepared statements to accomplish that, so I have
> less effort sanitizing inputs.
Hello,
I need some help to do a simple operation, increment a counter and get its
former value.
I could have some race condition, so the transaction must be atomic.
I also would like to use prepared statements to accomplish that, so I have
less effort sanitizing inputs.
My problem:
I have a
12 matches
Mail list logo