From 8055357576bf3571e8b428105674ffe385a27827 Mon Sep 17 00:00:00 2001 From: "Yang, Gao" Date: Fri, 15 May 2020 17:36:01 +0800 Subject: [PATCH] [Fix-Issue-3991] Fix Read with SQLite not supporting SELECT FOR UPDATE syntax --- orm/db_sqlite.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/orm/db_sqlite.go b/orm/db_sqlite.go index 0f54d81a..6b0de591 100644 --- a/orm/db_sqlite.go +++ b/orm/db_sqlite.go @@ -17,6 +17,8 @@ package orm import ( "database/sql" "fmt" + "reflect" + "time" ) // sqlite operators. @@ -66,6 +68,11 @@ type dbBaseSqlite struct { var _ dbBaser = new(dbBaseSqlite) +// override base db read for update behavior as SQlite does not support syntax +func (d *dbBaseSqlite) Read(q dbQuerier, mi *modelInfo, ind reflect.Value, tz *time.Location, cols []string, isForUpdate bool) error { + return d.dbBase.Read(q, mi, ind, tz, cols, false) +} + // get sqlite operator. func (d *dbBaseSqlite) OperatorSQL(operator string) string { return sqliteOperators[operator]