orm: handle empty fields (#11083)

pull/11092/head
Dialga 2021-08-07 06:25:38 +12:00 committed by GitHub
parent e1cc1665dc
commit 25d49bc615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -222,6 +222,8 @@ fn (mut g Gen) sql_insert(node ast.SqlStmtLine, expr string, table_name string,
g.write('orm__${typ}_to_primitive(${node.object_var_name}.$f.name),')
}
g.write('})')
} else {
g.write('NULL')
}
g.write('),')
g.write('.types = new_array_from_c_array(0, 0, sizeof(int), NULL),')