execSQLList method

Future<BoolCommitResult> execSQLList(
  1. List<String> pSql, {
  2. bool? exclusive,
  3. bool? noResult,
  4. bool? continueOnError,
})

Run sql command List

Implementation

Future<BoolCommitResult> execSQLList(List<String> pSql,
    {bool? exclusive, bool? noResult, bool? continueOnError}) async {
  final result = BoolCommitResult(success: false);
  // If there is no open transaction, start one
  final bool closeBatch = !await batchStart();
  for (String sql in pSql) {
    openedBatch[_dbModel!.databaseName!]!.execute(sql);
  }
  if (closeBatch) {
    try {
      result
        ..commitResult = await batchCommit(
            exclusive: exclusive,
            noResult: noResult,
            continueOnError: continueOnError)
        ..success = true;
    } catch (e) {
      result.errorMessage = e.toString();
      print('SQFENTITY ERROR while run execSQLList:');
      print(result.toString());
    }
    openedBatch[_dbModel!.databaseName!] = null;
  } else {
    result.success = true;
  }
  return result;
}