From b6d710c0c56dfa8abaab8b8f73c9d5e16c1a399d Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Thu, 19 Sep 2013 11:25:59 -0400 Subject: [PATCH] compiler/eda; (#647) use Database::Begin and Database::Commit around database initialization/creation statements. --- compiler/libec/src/dbpass.ec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/libec/src/dbpass.ec b/compiler/libec/src/dbpass.ec index 3e93113..a1d80c5 100644 --- a/compiler/libec/src/dbpass.ec +++ b/compiler/libec/src/dbpass.ec @@ -271,6 +271,9 @@ static void ProcessExpression(Expression exp) ifDBStmt.compound.declarations->Add(MkDeclaration(MkListOne(MkSpecifierName("FieldIndex")), MkListOne(MkInitDeclarator(MkDeclaratorArray(MkDeclaratorIdentifier(MkIdentifier("indexes")), MkExpConstant(numIndexesString)), MkInitializerList(MkListOne(MkInitializerList(MkListOne(MkInitializerAssignment(MkExpIdentifier(MkIdentifier("null"))))))))))); + // db.Begin(); + ifDBStmt.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("db")), MkIdentifier("Begin")), MkList())))); + ifDBStmt.compound.statements->Add(compound = MkCompoundStmt(null, tableStatements)); compound.compound.context = Context { parent = ifDBStmt.compound.context }; /* @@ -285,6 +288,9 @@ static void ProcessExpression(Expression exp) ifDBStmt.compound.statements->Add(compound = MkCompoundStmt(null, indexStatements)); compound.compound.context = Context { parent = ifDBStmt.compound.context }; + // db.Commit(); + ifDBStmt.compound.statements->Add(MkExpressionStmt(MkListOne(MkExpCall(MkExpMember(MkExpIdentifier(MkIdentifier("db")), MkIdentifier("Commit")), MkList())))); + // TODO: Don't make use of extension exp.type = extensionCompoundExp; exp.compound = databaseOpenStmt; -- 1.8.3.1