Open koplenov opened 7 months ago
@koplenov This error occurs because the value that V considers after the '=' in the case 'seo_f1' is seen as an identifier belonging to the language, not a possible value of the table field. It is indeed a bug in the language. The example below shows a way the language recognizes it.
import db.sqlite
pub struct SeoBlock {
seo_f1 string
seo_is_f1_capitalize bool
seo_params string
}
fn main() {
db := sqlite.connect('test.db') or { panic(err) }
t := SeoBlock{'test1',true,'test'}
local_seo_f1 := 'test2'
sql db {
create table SeoBlock
update SeoBlock set seo_f1 = t.seo_f1 where seo_f1 == ""
update SeoBlock set seo_f1 = local_seo_f1 where seo_f1 == ""
} or { panic(err) }
}
V doctor:
What did you do?
v -g -o vdbg cmd/v && vdbg sql_bug.v
What did you expect to see?
Correct error in sql expression
What did you see instead?