Last_row_id

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

Last_row_id

Yadwindersingh
Hi all;
I am using vs15.x

Create trigger return_pono after insert on po
Begin
Select last_insert_rowid();

End

Trigger works quite fine in sqlite but fails to return any value to vb.net statement

Dim lrow as int64

Lrow = some_cmd.executescalar()


Please help
Thank you


_______________________________________________
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] Last_row_id

Hick Gunter
A trigger program does not return any result rows.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Yadwindersingh
Gesendet: Sonntag, 16. September 2018 03:28
An: [hidden email]
Betreff: [EXTERNAL] [sqlite] Last_row_id

Hi all;
I am using vs15.x

Create trigger return_pono after insert on po Begin Select last_insert_rowid();

End

Trigger works quite fine in sqlite but fails to return any value to vb.net statement

Dim lrow as int64

Lrow = some_cmd.executescalar()


Please help
Thank you


_______________________________________________
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] Last_row_id

David Raymond
I can't seem to find where/if it's mentioned, but I believe the only use of a select statement in a trigger is to call the raise function and trigger some level of error.

https://www.sqlite.org/lang_createtrigger.html


-----Original Message-----
From: sqlite-users [mailto:[hidden email]] On Behalf Of Hick Gunter
Sent: Monday, September 17, 2018 8:06 AM
To: 'SQLite mailing list'
Subject: Re: [sqlite] [EXTERNAL] Last_row_id

A trigger program does not return any result rows.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Yadwindersingh
Gesendet: Sonntag, 16. September 2018 03:28
An: [hidden email]
Betreff: [EXTERNAL] [sqlite] Last_row_id

Hi all;
I am using vs15.x

Create trigger return_pono after insert on po Begin Select last_insert_rowid();

End

Trigger works quite fine in sqlite but fails to return any value to vb.net statement

Dim lrow as int64

Lrow = some_cmd.executescalar()


Please help
Thank you


_______________________________________________
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: [EXTERNAL] Last_row_id

Hick Gunter
Or maybe also a SELECT ... INTO.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von David Raymond
Gesendet: Montag, 17. September 2018 16:07
An: SQLite mailing list <[hidden email]>
Betreff: Re: [sqlite] [EXTERNAL] Last_row_id

I can't seem to find where/if it's mentioned, but I believe the only use of a select statement in a trigger is to call the raise function and trigger some level of error.

https://www.sqlite.org/lang_createtrigger.html


-----Original Message-----
From: sqlite-users [mailto:[hidden email]] On Behalf Of Hick Gunter
Sent: Monday, September 17, 2018 8:06 AM
To: 'SQLite mailing list'
Subject: Re: [sqlite] [EXTERNAL] Last_row_id

A trigger program does not return any result rows.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Yadwindersingh
Gesendet: Sonntag, 16. September 2018 03:28
An: [hidden email]
Betreff: [EXTERNAL] [sqlite] Last_row_id

Hi all;
I am using vs15.x

Create trigger return_pono after insert on po Begin Select last_insert_rowid();

End

Trigger works quite fine in sqlite but fails to return any value to vb.net statement

Dim lrow as int64

Lrow = some_cmd.executescalar()


Please help
Thank you


_______________________________________________
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


___________________________________________
 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] Last_row_id

Jean-Luc Hainaut
In reply to this post by Hick Gunter
On 17/09/2018 14:05, Hick Gunter wrote:
> A trigger program does not return any result rows.

True. But a "select" query in the body of a trigger can be used to
evaluate a user-defined function (in the "where" clause for instance) in
which any action allowed by your host language can be executed,
including writing in a text file or opening a DB connection.

> -----Ursprüngliche Nachricht-----
> Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Yadwindersingh
> Gesendet: Sonntag, 16. September 2018 03:28
> An: [hidden email]
> Betreff: [EXTERNAL] [sqlite] Last_row_id
>
> Hi all;
> I am using vs15.x
>
> Create trigger return_pono after insert on po Begin Select last_insert_rowid();
>
> End
>
> Trigger works quite fine in sqlite but fails to return any value to vb.net statement
>
> Dim lrow as int64
>
> Lrow = some_cmd.executescalar()
>
>
> Please help
> Thank you
>
>
> _______________________________________________
> 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: [EXTERNAL] Last_row_id

Hick Gunter
True, but the information available is very limited, basically just the NEW database row and function calls.

CREATE TRIGGER return_pono AFTER INSERT ON po BEGIN
    INSERT INTO inserts VALUES (datetime('now'),'po','return_pono',last_insert_rowid());
END

Unless of course you start writing user defined functions that access the internal structures of SQLite, which seems quite beyond the current capability of the OP.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[hidden email]] Im Auftrag von Jean-Luc Hainaut
Gesendet: Donnerstag, 20. September 2018 10:40
An: [hidden email]
Betreff: Re: [sqlite] [EXTERNAL] Last_row_id

On 17/09/2018 14:05, Hick Gunter wrote:
> A trigger program does not return any result rows.

True. But a "select" query in the body of a trigger can be used to evaluate a user-defined function (in the "where" clause for instance) in which any action allowed by your host language can be executed, including writing in a text file or opening a DB connection.

> -----Ursprüngliche Nachricht-----
> Von: sqlite-users
> [mailto:[hidden email]] Im Auftrag von
> Yadwindersingh
> Gesendet: Sonntag, 16. September 2018 03:28
> An: [hidden email]
> Betreff: [EXTERNAL] [sqlite] Last_row_id
>
> Hi all;
> I am using vs15.x
>
> Create trigger return_pono after insert on po Begin Select
> last_insert_rowid();
>
> End
>
> Trigger works quite fine in sqlite but fails to return any value to
> vb.net statement
>
> Dim lrow as int64
>
> Lrow = some_cmd.executescalar()
>
>
> Please help
> Thank you
>
>
> _______________________________________________
> 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


___________________________________________
 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