asInsertCommand method
Generates an INSERT command for the given table name and map of values.
The tableName
parameter specifies the name of the table to insert into.
The nullAsBlank
parameter determines whether null values should be treated as blank strings.
The quoteChar
parameter specifies the character used for quoting identifiers.
The dataBaseProvider
parameter specifies the database provider.
Returns the generated INSERT command as a string.
Implementation
String asInsertCommand({
required String tableName,
bool nullAsBlank = false,
dynamic quoteChar,
String dataBaseProvider = "",
}) {
String columns = SqlUtil.columnsFromMap(
items: this,
quoteChar: quoteChar,
dataBaseProvider: dataBaseProvider,
);
String values = SqlUtil.valuesFromMap(
items: this,
nullAsBlank: nullAsBlank,
);
return 'INSERT INTO ${SqlUtil.wrap(tableName, quoteChar, dataBaseProvider)} ($columns) VALUES ($values);';
}