delete method

Future<int?> delete(
  1. WhereData whereData
)

Implementation

Future<int?> delete(WhereData whereData) async {
  if (!initialized) throw ArgumentError(C_MUST_INIT);
  if (whereData != null && whereData.whereStructList.length == 0)
    throw IllegalStateException(
        "TableData must contain WhereData for delete");
  String sql = sqlCommands.delete(whereData);
  print(sql);
  int? rowCount;
  try {
    rowCount = await transaction.getConnection().updateQuery(sql);
    if(rowCount==0) throw SqlException(SqlExceptionEnum.ENTRY_NOT_FOUND);
  } on SqlException catch (e) {
    throw SqlException(e.sqlExceptionEnum, cause: e.cause, sql: sql);
  }
  return rowCount;
}