connect method

Future<DbLayer> connect(
  1. DBConnectionInfo connInfo
)

Implementation

Future<DbLayer> connect(DBConnectionInfo connInfo) async {
  options = connInfo.getQueryOptions();
  connectionInfo = connInfo.getSettings();
  var nOfProces = connectionInfo!.setNumberOfProcessorsFromPlatform
      ? Platform.numberOfProcessors
      : connectionInfo!.numberOfProcessors;

  if (connectionInfo!.driver == ConnectionDriver.pgsql) {
    if (connectionInfo!.numberOfProcessors > 1 && connectionInfo!.usePool) {
      executor = PostgreSqlExecutorPool(nOfProces, connectionInfo);
    } else {
      executor = PostgreSqlExecutor(connectionInfo);
      await executor.open();
    }
  } else {
    if (connectionInfo!.numberOfProcessors > 1 && connectionInfo!.usePool) {
      executor = MySqlExecutorPool(nOfProces, connectionInfo: connectionInfo);
    } else {
      executor = MySqlExecutor(connectionInfo: connectionInfo);
      await executor.open();
    }
  }

  return this;
}