orm: fix invalid `no more rows available` error (#5774)

pull/5780/head
Lukas Neubert 2020-07-09 22:36:01 +02:00 committed by GitHub
parent e47ad33af6
commit 14d83c8457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -89,7 +89,8 @@ fn (mut g Gen) sql_stmt(node ast.SqlStmt) {
g.sql_buf = strings.new_builder(100)
g.writeln(binds)
g.writeln('sqlite3_step($g.sql_stmt_name);')
g.writeln('if (strcmp(sqlite3_errmsg(${db_name}.conn), "not an error") != 0) puts(sqlite3_errmsg(${db_name}.conn)); ')
g.write('if (strcmp(sqlite3_errmsg(${db_name}.conn), "not an error") != 0)')
g.write('if (strcmp(sqlite3_errmsg(${db_name}.conn), "no more rows available") != 0) puts(sqlite3_errmsg(${db_name}.conn));')
g.writeln('sqlite3_finalize($g.sql_stmt_name);')
}