asUpsertCommand method
Generates an UPSERT command for the given table name, where clause, and other optional parameters.
The tableName
parameter specifies the name of the table to perform the UPSERT operation on.
The where
parameter is an optional map that represents the WHERE clause of the UPSERT command.
The nullAsBlank
parameter specifies whether null values should be treated as blank values.
The quoteChar
parameter is an optional string that represents the character used for quoting identifiers.
The dataBaseProvider
parameter is an optional string that specifies the database provider.
Returns the generated UPSERT command as a string.
Implementation
String asUpsertCommand({
required String tableName,
Map<String, dynamic>? where,
bool nullAsBlank = false,
dynamic quoteChar,
String dataBaseProvider = "",
}) {
if (where.isValid()) {
return asUpdateCommand(
tableName: tableName,
where: where!,
nullAsBlank: nullAsBlank,
quoteChar: quoteChar,
dataBaseProvider: dataBaseProvider,
);
} else {
return asInsertCommand(
tableName: tableName,
nullAsBlank: nullAsBlank,
quoteChar: quoteChar,
dataBaseProvider: dataBaseProvider,
);
}
}