예제 #1
0
파일: PDO.php 프로젝트: pckg/database
 /**
  * @return Cache
  */
 public function getCache()
 {
     $key = 'pckg.database.repository.cache.' . sha1(Cache::getCachePathByRepository($this));
     $context = context();
     if (!$context->exists($key)) {
         $context->bind($key, $cache = new Cache($this));
     }
     return $context->get($key);
 }
예제 #2
0
 protected function buildOldKeySql(Cache $cache, Table $table, Constraint $key)
 {
     $cachedConstraint = $cache->getConstraint($key->getName(), $table->getName());
     $type = $cachedConstraint['type'] == 'PRIMARY KEY' ? 'PRIMARY' : $cachedConstraint['type'] . ' KEY';
     return $type . ' ' . $key->getName();
 }