defaultBindingHandler function
The default argument binder.
defaultBindingHandler support a few type that can be translate or convert into a datatype that supported by SQLite below is the support Dart type that can be convert into SQLite supported type.
- NULL
- bool
- int
- double
- String
- Uint8List
- DateTime
- Uri
- Duration
- num
- RegExp
- Argument
Implementation
int defaultBindingHandler(Statement stmt, dynamic value, int index) {
if (value is bool?) return bindBool(stmt, value, index);
if (value is int?) return bindInt(stmt, value, index);
if (value is double?) return bindDouble(stmt, value, index);
if (value is String?) return bindString(stmt, value, index);
if (value is Uint8List?) return bindBlob(stmt, value, index);
if (value is DateTime?) return bindDateTime(stmt, value, index);
if (value is Uri?) return bindUri(stmt, value, index);
if (value is Duration?) return bindDuration(stmt, value, index);
if (value is RegExp?) return bindRegExp(stmt, value, index);
// not supported
throw sql.DatabaseException('Unsupported binding value $value. Try implement Argument instead.');
}