execute method

Uint8List? execute(
  1. int stmtId, [
  2. Uint8List? params
])

Executes a prepared statement with optional binary parameters.

The stmtId must be a valid prepared statement identifier. The params should be a binary buffer containing serialized parameters, or null if no parameters are needed.

Returns binary result data on success, null on failure.

Implementation

Uint8List? execute(
  int stmtId, [
  Uint8List? params,
]) {
  if (params == null || params.isEmpty) {
    return callWithBuffer(
      (buf, bufLen, outWritten) => _bindings.odbc_execute(
        stmtId,
        null,
        0,
        buf,
        bufLen,
        outWritten,
      ),
    );
  }
  return _withParamsBuffer(
    params,
    (ffi.Pointer<ffi.Uint8> paramsPtr) => callWithBuffer(
      (buf, bufLen, outWritten) => _bindings.odbc_execute(
        stmtId,
        paramsPtr,
        params.length,
        buf,
        bufLen,
        outWritten,
      ),
    ),
  );
}