sqlite3_set_last_insert_rowid

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite3_set_last_insert_rowid

Bart Smissaert
Just wonder what the possible use for this is.

RBS
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] sqlite3_set_last_insert_rowid

Hick Gunter
See http://sqlite.org/c3ref/last_insert_rowid.html

"Some virtual table implementations may INSERT rows into rowid tables as part of committing a transaction (e.g. to flush data accumulated in memory to disk). In this case subsequent calls to this function return the rowid associated with these internal INSERT operations, which leads to unintuitive results. Virtual table implementations that do write to rowid tables in this way can avoid this problem by restoring the original rowid value using sqlite3_set_last_insert_rowid() before returning control to the user."

Or a virtual table implementation might support querying the last inserted rowid directly...


-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Bart Smissaert
Gesendet: Dienstag, 30. Jänner 2018 16:04
An: General Discussion of SQLite Database <[hidden email]>
Betreff: [EXTERNAL] [sqlite] sqlite3_set_last_insert_rowid

Just wonder what the possible use for this is.

RBS
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] sqlite3_set_last_insert_rowid

Bart Smissaert
Ok, thanks.
Should have looked at that.

RBS

On Tue, Jan 30, 2018 at 3:12 PM, Hick Gunter <[hidden email]> wrote:

> See http://sqlite.org/c3ref/last_insert_rowid.html
>
> "Some virtual table implementations may INSERT rows into rowid tables as
> part of committing a transaction (e.g. to flush data accumulated in memory
> to disk). In this case subsequent calls to this function return the rowid
> associated with these internal INSERT operations, which leads to
> unintuitive results. Virtual table implementations that do write to rowid
> tables in this way can avoid this problem by restoring the original rowid
> value using sqlite3_set_last_insert_rowid() before returning control to
> the user."
>
> Or a virtual table implementation might support querying the last inserted
> rowid directly...
>
>
> -----Ursprüngliche Nachricht-----
> Von: sqlite-users [mailto:[hidden email]]
> Im Auftrag von Bart Smissaert
> Gesendet: Dienstag, 30. Jänner 2018 16:04
> An: General Discussion of SQLite Database <sqlite-users@mailinglists.
> sqlite.org>
> Betreff: [EXTERNAL] [sqlite] sqlite3_set_last_insert_rowid
>
> Just wonder what the possible use for this is.
>
> RBS
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___________________________________________
>  Gunter Hick | Software Engineer | Scientific Games International GmbH |
> Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43
> 1 80100 - 0
>
> May be privileged. May be confidential. Please delete if not the addressee.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_set_last_insert_rowid

petern
In reply to this post by Bart Smissaert
For one, within a function that does an INSERT, set_last_insert_rowid makes
it possible to "pop" last_insert_rowid.
Consider a function which INSERT's into the model and then INSERT's a log
table row.  The caller probably isn't interested in the log rowid.

A better question to ask is always why an orthogonal or inverse operation
is missing rather than why it is present.
https://en.wikipedia.org/wiki/Orthogonality_(programming)

Peter

On Tue, Jan 30, 2018 at 7:03 AM, Bart Smissaert <[hidden email]>
wrote:

> Just wonder what the possible use for this is.
>
> RBS
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_set_last_insert_rowid

Darrol Thompson
I don't need this program so delete this.

Sent from Yahoo Mail on Android
 
  On Tue, Jan 30, 2018 at 11:15 AM, petern<[hidden email]> wrote:   For one, within a function that does an INSERT, set_last_insert_rowid makes
it possible to "pop" last_insert_rowid.
Consider a function which INSERT's into the model and then INSERT's a log
table row.  The caller probably isn't interested in the log rowid.

A better question to ask is always why an orthogonal or inverse operation
is missing rather than why it is present.
https://en.wikipedia.org/wiki/Orthogonality_(programming)

Peter

On Tue, Jan 30, 2018 at 7:03 AM, Bart Smissaert <[hidden email]>
wrote:

> Just wonder what the possible use for this is.
>
> RBS
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
 
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_set_last_insert_rowid

J Decker
In reply to this post by petern
Probably best reserved for initialization of a shard of a database where
you can set next to last of a prior .db.


On Tue, Jan 30, 2018 at 9:14 AM, petern <[hidden email]> wrote:

> For one, within a function that does an INSERT, set_last_insert_rowid makes
> it possible to "pop" last_insert_rowid.
> Consider a function which INSERT's into the model and then INSERT's a log
> table row.  The caller probably isn't interested in the log rowid.
>
> A better question to ask is always why an orthogonal or inverse operation
> is missing rather than why it is present.
> https://en.wikipedia.org/wiki/Orthogonality_(programming)
>
> Peter
>
> On Tue, Jan 30, 2018 at 7:03 AM, Bart Smissaert <[hidden email]>
> wrote:
>
> > Just wonder what the possible use for this is.
> >
> > RBS
> > _______________________________________________
> > sqlite-users mailing list
> > [hidden email]
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users