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

orm: do not order by default, ordering is slow; also fix a bug for tables without defined primary keys

This commit is contained in:
Delyan Angelov
2021-12-23 16:43:22 +02:00
parent d7deda5078
commit fa2de89db9
2 changed files with 7 additions and 8 deletions

View File

@ -272,13 +272,12 @@ pub fn orm_select_gen(orm SelectConfig, para string, num bool, qm string, start_
}
}
str += ' ORDER BY '
// NB: do not order, if the user did not want it explicitly,
// ordering is *slow*, especially if there are no indexes!
if orm.has_order {
str += ' ORDER BY '
str += '$para$orm.order$para '
str += orm.order_type.to_str()
} else {
str += '$para$orm.primary$para '
str += orm.order_type.to_str()
}
if orm.has_limit {