prepare method

int prepare(
  1. int connectionId,
  2. String sql, {
  3. int timeoutMs = 0,
})

Prepares a SQL statement for execution.

The connectionId must be a valid active connection. The sql should be a parameterized SQL statement. The timeoutMs specifies the statement timeout in milliseconds (0 = no timeout).

Returns a statement ID on success, 0 on failure.

Implementation

int prepare(int connectionId, String sql, {int timeoutMs = 0}) {
  final sqlPtr = sql.toNativeUtf8();
  try {
    return _bindings.odbc_prepare(
      connectionId,
      sqlPtr.cast<bindings.Utf8>(),
      timeoutMs,
    );
  } finally {
    malloc.free(sqlPtr);
  }
}