applyResult function

void applyResult(
  1. PtrContext ctx,
  2. dynamic val
)

Default sql.FunctionResultHandler handler.

Implementation

void applyResult(sqlite.PtrContext ctx, dynamic val) {
  // integer like value
  if (val == null) {
    applyNullResult(ctx);
  } else if (val is Duration) {
    applyIntResult(ctx, val.inMicroseconds);
  } else if (val is int) {
    applyIntResult(ctx, val);
  } else if (val is bool) {
    applyIntResult(ctx, val ? 1 : 0);
  } else
  // unique value
  if (val is double) {
    Driver.binder.result_double(ctx, val);
  } else if (val is Uint8List) {
    Driver.binder.result_blob(ctx, val);
  } else
  // string like value
  if (val is RegExp) {
    applyStringResult(ctx, val.pattern);
  } else if (val is Uri) {
    applyStringResult(ctx, val.toString());
  } else if (val is DateTime) {
    applyStringResult(ctx, val.toIso8601String());
  } else if (val is String) {
    applyStringResult(ctx, val);
  } else {
    applyErrorResult(ctx, 'Dart return unsupported value $val.');
  }
}