1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

orm: make last_id() return int, instead of orm.Primitive (fix #12110) (#17151)

This commit is contained in:
walking devel
2023-01-29 14:00:23 +00:00
committed by GitHub
parent e6a4f76f82
commit 4747e70d9d
10 changed files with 56 additions and 28 deletions

View File

@ -51,10 +51,10 @@ pub fn (db DB) delete(table string, where orm.QueryData) ! {
}
// last_id is used internally by V's ORM for post-processing `INSERT ` queries
pub fn (db DB) last_id() orm.Primitive {
pub fn (db DB) last_id() int {
query := 'SELECT LASTVAL();'
id := db.q_int(query) or { 0 }
return orm.Primitive(id)
return db.q_int(query) or { 0 }
}
// DDL (table creation/destroying etc)