Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @param AdapterInterface $adapter
  */
 public function __construct(AdapterInterface $adapter)
 {
     $this->adapter = $adapter;
     try {
         $this->cacher = CachePool::get('MetadataCacher');
         if ($this->cacher instanceof \Yafrk\Cache\Storage\StorageInterface) {
             $this->cacher->getResource();
         }
     } catch (\Exception $e) {
         $this->cacher = null;
         $message = 'MetaDataCacher Connect Error: ' . $e->getMessage() . "\n";
         error_log($message);
     }
     $this->defaultSchema = $adapter->getDriver()->getConnection()->getCurrentSchema() ?: self::DEFAULT_SCHEMA;
 }
Ejemplo n.º 2
0
 /**
  * @param SqlInterface|null $sql
  * @return string
  */
 public function getSqlString(SqlInterface $sql = null)
 {
     $sql = $sql ?: $this->lastSql;
     if (!$sql) {
         throw new Exception\InvalidArgumentException('Sql sequence is not supplied.');
     }
     return $sql->getSqlString($this->adapter->getPlatform());
 }