mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
orm: fix offset when order is given too (#5625)
This commit is contained in:
parent
5813d2bf72
commit
421b6d4a80
@ -202,6 +202,13 @@ fn test_orm_sqlite() {
|
||||
select from User order age desc limit 1
|
||||
}
|
||||
assert oldest.age == 34
|
||||
|
||||
offs := 1
|
||||
|
||||
second_oldest := sql db {
|
||||
select from User order age desc limit 1 offset offs
|
||||
}
|
||||
assert second_oldest.age == 31
|
||||
}
|
||||
|
||||
fn test_orm_pg() {
|
||||
|
@ -149,6 +149,7 @@ fn (mut g Gen) sql_select_expr(node ast.SqlExpr) {
|
||||
}
|
||||
if node.has_offset {
|
||||
g.write(' OFFSET ')
|
||||
g.sql_side = .right
|
||||
g.expr_to_sql(node.offset_expr)
|
||||
}
|
||||
g.writeln('"));')
|
||||
|
Loading…
Reference in New Issue
Block a user