/**
  * {@inheritDoc}
  */
 public function selectShard($distributionValue)
 {
     if ($this->conn->isTransactionActive()) {
         throw ShardingException::activeTransaction();
     }
     if ($distributionValue === null || is_bool($distributionValue) || !is_scalar($distributionValue)) {
         throw ShardingException::noShardDistributionValue();
     }
     $platform = $this->conn->getDatabasePlatform();
     $sql = sprintf("USE FEDERATION %s (%s = %s) WITH RESET, FILTERING = %s;", $platform->quoteIdentifier($this->federationName), $platform->quoteIdentifier($this->distributionKey), $this->conn->quote($distributionValue), $this->filteringEnabled ? 'ON' : 'OFF');
     $this->conn->exec($sql);
     $this->currentDistributionValue = $distributionValue;
 }
 /**
  * {@inheritDoc}
  */
 public function selectGlobal()
 {
     if ($this->conn->isTransactionActive()) {
         throw ShardingException::activeTransaction();
     }
     $sql = "USE FEDERATION ROOT WITH RESET";
     $this->conn->exec($sql);
     $this->currentDistributionValue = null;
 }