parent
db908e507f
commit
60bc280ad0
|
@ -150,9 +150,10 @@ fn (mut g Gen) sqlite3_stmt(node ast.SqlStmt, typ SqlType) {
|
||||||
g.sql_stmt_name = tmp_sql_stmt_name
|
g.sql_stmt_name = tmp_sql_stmt_name
|
||||||
g.sql_table_name = tmp_sql_table_name
|
g.sql_table_name = tmp_sql_table_name
|
||||||
// get last inserted id
|
// get last inserted id
|
||||||
g.writeln('Array_sqlite__Row rows = sqlite__DB_exec($db_name, _SLIT("SELECT last_insert_rowid()")).arg0;')
|
res := g.new_tmp_var()
|
||||||
|
g.writeln('Array_sqlite__Row $res = sqlite__DB_exec($db_name, _SLIT("SELECT last_insert_rowid()")).arg0;')
|
||||||
id_name := g.new_tmp_var()
|
id_name := g.new_tmp_var()
|
||||||
g.writeln('int $id_name = string_int((*(string*)array_get((*(sqlite__Row*)array_get(rows, 0)).vals, 0)));')
|
g.writeln('int $id_name = string_int((*(string*)array_get((*(sqlite__Row*)array_get($res, 0)).vals, 0)));')
|
||||||
g.writeln('sqlite3_bind_int($g.sql_stmt_name, ${i + 0} , $id_name); // id')
|
g.writeln('sqlite3_bind_int($g.sql_stmt_name, ${i + 0} , $id_name); // id')
|
||||||
} else {
|
} else {
|
||||||
g.writeln('sqlite3_bind_int($g.sql_stmt_name, ${i + 0} , $x); // stmt')
|
g.writeln('sqlite3_bind_int($g.sql_stmt_name, ${i + 0} , $x); // stmt')
|
||||||
|
|
Loading…
Reference in New Issue