@param string|null $conn

@return mixed
327855
public function checkHAMaster($conn = null)
    {
        $response = $this->invoke('neo.core_get_ha_master', $conn)
          ->execute();

        return $this->handleHttpResponse($response);
    }
207912
public function getLastVersionNumber($con = null)
    {
        $v = ChildDealerVersionQuery::create()
            ->filterByDealer($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }
300602
public function findConnection(string $connectionName)
  {
    if ( empty($connectionName) ) {
      # Take first available connection
      $connection = reset($this->connections);
      if ($connection === false)
        return null;
    } else {
      # Attempt to find the connection from the pool
      $connection = ( $this->connections[strtolower($connectionName)] ?? null);
    }

    return $connection;
  }
956729
protected function _getSearchResults( MW_DB_Connection_Interface $conn, $sql )
	{
		$context = $this->_getContext();
		$siteId = $context->getLocale()->getSiteId();

		$statement = $conn->create($sql);
		$statement->bind(1, $siteId, MW_DB_Statement_Abstract::PARAM_INT);

		$context->getLogger()->log( __METHOD__ . ': SQL statement: ' . $statement, MW_Logger_Abstract::DEBUG );

		return $statement->execute();
	}
815890
public static function createConnectionFromDSN($dsn)
    {
        if (is_string($dsn)) {
            $parsed = self::parseDSN($dsn);
        } else {
            $parsed = $dsn;
        }

        /**
         * @todo retry connection here.
         */
        return DriverManager::getConnection($parsed);
    }
787395
function doCount(PDO $conn = null) {
		$q = clone $this;

		if (!$q->getTable()) {
			throw new RuntimeException('No table specified.');
		}

		$q->setAction(self::ACTION_COUNT);
		return (int) $q->getQuery($conn)->bindAndExecute()->fetchColumn();
	}
842574
public static function Get($dsn = null, $use_as_default = false) {
		if ($dsn !== null AND $use_as_default) {
			self::$default_dsn = $dsn;
		} elseif ($dsn === null AND self::$default_dsn !== null) {
			$dsn = self::$default_dsn;
		}

		/**
		 * A mysqli connection can only be accessed by the PID that has created it
		 * Create a new Mysqli object after forking
		 */
		if (isset(self::$pids[$dsn]) and self::$pids[$dsn] != getmypid()) {
			unset(self::$proxy[$dsn]);
			unset(self::$pids[$dsn]);
		}

		if (!isset(self::$proxy[$dsn]) OR self::$proxy[$dsn] == false) {
			self::$proxy[$dsn] = new Proxy($dsn);
			self::$pids[$dsn] = getmypid();
		}
		return self::$proxy[$dsn];
	}
579705
protected final function delete($con = null) {
        if ($con === null) {
            $sql = new DeleteSQL();
            $sql->from($this->qualifiedName)->setDialect($this->dialect);

            return $sql;
        }
        $rst = false;
        if ($con && !is_array($con)) {
            $con = [$this->primaryKeys[0] => $con];
        }
        if (is_array($con) && $con) {
            $sql = new DeleteSQL();
            $sql->from($this->qualifiedName)->setDialect($this->dialect);
            $sql->where($con);
            $rst = $sql->exec();
            $this->checkSQL($sql);
        }

        return $rst;
    }
1302511
public function createTransaction($conn = null, $queryMode = Client::NEOCLIENT_QUERY_MODE_WRITE)
    {
        $transaction = new Transaction($conn, $this, $queryMode);

        return $transaction;
    }
381272
public static function conf($conf = null) {
        if (null !== $conf) {
            if (is_array($conf)) {
                Toolkit::override(static::$_conf, $conf);
                return static::$_conf;
            }

            if (is_string($conf)) {
                return static::$_conf[$conf] ?? null;
            }
        }
        if (!static::$_confObject instanceof stdClass) {
            /** @noinspection ReturnNullInspection */
            static::$_confObject = json_decode(json_encode(static::$_conf));
        }
        return static::$_confObject;
    }
79415
public function getConnection($context = null)
    {
        $db = $this->getDb($context);
        return $this->_di->getShared($db);
    }
938039
protected function getTablesClause($conn) {

		$table = $this->getTable();

		if (!$table) {
			throw new RuntimeException('No table specified.');
		}

		$statement = new QueryStatement($conn);
		$alias = $this->getAlias();
		// if $table is a Query, get its QueryStatement
		if ($table instanceof Query) {
			$table_statement = $table->getQuery($conn);
			$table_string = '(' . $table_statement->string . ')';
		} else {
			$table_statement = null;
			$table_string = '';
		}

		switch ($this->action) {
			case self::ACTION_UPDATE:
			case self::ACTION_COUNT:
			case self::ACTION_SELECT:
				// setup identifiers for $table_string
				if (null !== $table_statement) {
					$statement->addIdentifiers($table_statement->identifiers);
					$statement->addParams($table_statement->params);
				} else {
					// if $table has no spaces, assume it is an identifier
					if (strpos($table, ' ') === false) {
						$statement->addIdentifier($table);
						$table_string = QueryStatement::IDENTIFIER;
					} else {
						$table_string = $table;
					}
				}

				// append $alias, if it's not empty
				if ($alias) {
					$table_string .= " AS $alias";
				}

				// setup identifiers for any additional tables
				if ($this->extraTables) {
					$table_string = '(' . $table_string;
					foreach ($this->extraTables as $t_alias => $extra_table) {
						if ($extra_table instanceof Query) {
							$extra_table_statement = $extra_table->getQuery($conn);
							$extra_table_string = '(' . $extra_table_statement->string . ') AS ' . $t_alias;
							$statement->addParams($extra_table_statement->params);
							$statement->addIdentifiers($extra_table_statement->identifiers);
						} else {
							$extra_table_string = $extra_table;
							if (strpos($extra_table_string, ' ') === false) {
								$extra_table_string = QueryStatement::IDENTIFIER;
								$statement->addIdentifier($extra_table);
							}
							if ($t_alias != $extra_table) {
								$extra_table_string .= " AS $t_alias";
							}
						}
						$table_string .= ", $extra_table_string";
					}
					$table_string .= ')';
				}
				$statement->string = $table_string;
				break;
			case self::ACTION_DELETE:
				if (null !== $table_statement) {
					$statement->addIdentifiers($table_statement->identifiers);
					$statement->addParams($table_statement->params);
				} else {
					// if $table has no spaces, assume it is an identifier
					if (strpos($table, ' ') === false) {
						$statement->addIdentifier($table);
						$table_string = QueryStatement::IDENTIFIER;
					} else {
						$table_string = $table;
					}
				}

				// append $alias, if it's not empty
				if ($alias) {
					$table_string .= " AS $alias";
				}
				$statement->string = $table_string;
				break;
			default:
				throw new RuntimeException('Uknown action "' . $this->action . '", cannot build table list');
				break;
		}
		return $statement;
	}
263189
function doDelete(PDO $conn = null) {
		$q = clone $this;

		if (!$q->getTable()) {
			throw new RuntimeException('No table specified.');
		}

		$q->setAction(self::ACTION_DELETE);
		return (int) $q->getQuery($conn)->bindAndExecute()->rowCount();
	}
1027958
public function getLastVersionNumber($con = null)
    {
        $v = ChildDealerBrandVersionQuery::create()
            ->filterByDealerBrand($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }
810071
public function vn($vn = null)
    {
        if ($vn !== null) {
            $this->vn = strtoupper($this->escape($vn));
            return $this;
        }
        return $this->vn;
    }
287437
public function listIndex($label, $conn = null)
    {
        $command = $this->invoke('neo.list_index_command', $conn);
        $command->setArguments($label);
        $httpResponse = $command->execute();

        $response = $this->handleHttpResponse($httpResponse);
        $propertiesIndexed = [];
        foreach ($response->getBody() as $index) {
            foreach ($index['property_keys'] as $key) {
                $propertiesIndexed[] = $key;
            }
        }
        if ($response instanceof \GraphAware\NeoClient\Formatter\Response) {
            return new \GraphAware\NeoClient\Formatter\Response(new PsrResponse(200, array(), json_encode($propertiesIndexed)));
        }
        $response->setBody($propertiesIndexed);

        return $response;
    }
246639
public function detach($conn)
    {
        parent::detach($conn);
        if ($this->overload) {
            if (!$this->maxConcurrency || ($this->count() < $this->maxConcurrency)) {
                $this->overload = false;
                $this->enable();
            }
        }
    }