Open
Description
I need to insert in DB list of single INSERT statement as single transaction. Like:
Future<dynamic> sqlInsert(Map body) async {
try {
await connection.transaction( (ctx) async {
await ctx.query("""INSERT INTO "public"."t1" ( "purchaseNumber") VALUES ( '123');"""); //
await ctx.query("""INSERT INTO "public"."t1" ( "purchaseNumber") VALUES ( '321');"""); //
await ctx.query("""COMMIT"""); //
}
).timeout(Duration(seconds: 10));
}
on PostgreSQLException catch(e)
{
writeLog(e.message);
}
}
But I am getting error:
Unhandled exception: TimeoutException after 0:00:10.000000: Future not completed
Same result on:
connection.transaction( (ctx) {
ctx.query("""INSERT INTO "public"."сontract_procedure" ( "purchaseNumber") VALUES ( '1111111111');"""); // to add ; to the end of every query
ctx.query("""INSERT INTO "public"."сontract_procedure" ( "purchaseNumber") VALUES ( '11111111211');"""); // to add ; to the end of every query
ctx.query("""COMMIT"""); // to add ; to the end of every query
}
What I am missing?
Metadata
Metadata
Assignees
Labels
No labels