createPool method

int createPool(
  1. String connectionString,
  2. int maxSize, {
  3. PoolOptions? options,
})

Create a pool. When options is null or has no fields set, falls back to the legacy odbc_pool_create (no options) for maximum compatibility.

Returns the pool id (>0) on success, 0 on failure (call getLastError for details).

Implementation

int createPool(
  String connectionString,
  int maxSize, {
  PoolOptions? options,
}) {
  if (options == null || !options.hasAnyOption) {
    return _native.poolCreate(connectionString, maxSize);
  }
  if (!supportsApi) {
    // Old native lib: silently fall back to defaults but warn that the
    // requested options were ignored. Caller can check `supportsApi` first.
    return _native.poolCreate(connectionString, maxSize);
  }
  return _native.poolCreateWithOptions(
    connectionString,
    maxSize,
    optionsJson: options.toJson(),
  );
}