当前位置: 首页>>代码示例>>PHP>>正文


PHP Adapter::getCurrentSchema方法代码示例

本文整理汇总了PHP中Zend\Db\Adapter\Adapter::getCurrentSchema方法的典型用法代码示例。如果您正苦于以下问题:PHP Adapter::getCurrentSchema方法的具体用法?PHP Adapter::getCurrentSchema怎么用?PHP Adapter::getCurrentSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Db\Adapter\Adapter的用法示例。


在下文中一共展示了Adapter::getCurrentSchema方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  *
  * @param Adapter $adapter
  * @param string $schema default schema, taken from adapter if not given
  * @throws Exception\InvalidArgumentException if schema parameter not valid
  */
 public function __construct(Adapter $adapter, $schema = null)
 {
     $this->adapter = $adapter;
     if ($schema === null) {
         $schema = $adapter->getCurrentSchema();
     }
     $this->setDefaultSchema($schema);
 }
开发者ID:robocoder,项目名称:solublecomponents,代码行数:14,代码来源:InformationSchema.php

示例2: testGetCurrentSchema

 /**
  * @testdox unit test: Test getCurrentSchema() returns current schema from connection object
  * @covers Zend\Db\Adapter\Adapter::getCurrentSchema
  */
 public function testGetCurrentSchema()
 {
     $this->mockConnection->expects($this->any())->method('getCurrentSchema')->will($this->returnValue('FooSchema'));
     $this->assertEquals('FooSchema', $this->adapter->getCurrentSchema());
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:9,代码来源:AdapterTest.php

示例3: __construct

 /**
  * Constructor
  *
  * @param Adapter $adapter
  */
 public function __construct(Adapter $adapter)
 {
     $this->adapter = $adapter;
     $this->defaultSchema = $adapter->getCurrentSchema() ?: self::DEFAULT_SCHEMA;
 }
开发者ID:totolouis,项目名称:ZF2-Auth,代码行数:10,代码来源:AbstractSource.php

示例4: getLinkedTables

 public function getLinkedTables($tableName)
 {
     $getTableSql = "SELECT TABLE_NAME, COLUMN_NAME FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = " . "'" . $this->db->getCurrentSchema() . "'" . " AND REFERENCED_TABLE_NAME = '" . $tableName . "'" . " AND CONSTRAINT_NAME <>'PRIMARY' AND REFERENCED_TABLE_NAME is not null;";
     $rowSet = $this->db->query($getTableSql, Adapter\Adapter::QUERY_MODE_EXECUTE);
     return $rowSet->toArray();
 }
开发者ID:avz-cmf,项目名称:zaboy-rest,代码行数:6,代码来源:TableManagerMysql.php

示例5: configure

 /**
  * Setup services which depends on the db
  *
  * @param   \Zend\Db\Adapter\Adapter $db
  * @return  \Zend\Db\Adapter\Adapter
  */
 public function configure(DbAdapter $db)
 {
     $sm = $this->getServiceLocator();
     $platform = $db->getPlatform();
     $driver = $db->getDriver();
     $matches = array();
     $fulldomain = strtolower($this->getDomain());
     $config = $driver->getConnection()->getConnectionParameters();
     /// TODO: remove this
     if (isset($_SERVER['GRIDGUYZ_DOMAIN'])) {
         $domain = $_SERVER['GRIDGUYZ_DOMAIN'];
         $subdomain = isset($_SERVER['GRIDGUYZ_SUBDOMAIN']) ? $_SERVER['GRIDGUYZ_SUBDOMAIN'] : '';
     } elseif (preg_match('/^[\\da-fA-F:]+/', $fulldomain) || preg_match('/^\\d+(\\.\\d+){3}$/', $fulldomain)) {
         $subdomain = '';
         $domain = $fulldomain;
     } else {
         $fullLength = strlen($fulldomain);
         if (empty($config['validDomains'])) {
             $validDomains = array('localhost');
         } else {
             $validDomains = array_map('strtolower', (array) $config['validDomains']);
         }
         if (!empty($config['defaultDomain'])) {
             $defaultDomain = strtolower($config['defaultDomain']);
             if (!in_array($defaultDomain, $validDomains)) {
                 array_unshift($validDomains, $defaultDomain);
             }
         }
         foreach ($validDomains as $validDomain) {
             if ($fulldomain == $validDomain) {
                 $subdomain = '';
                 $domain = $fulldomain;
                 break;
             }
             $length = $fullLength - strlen($validDomain) - 1;
             if ($length > 0 && '.' . $validDomain == substr($fulldomain, $length)) {
                 $subdomain = substr($fulldomain, 0, $length);
                 $domain = $validDomain;
                 break;
             }
         }
     }
     if (!isset($subdomain) || !isset($domain)) {
         if (preg_match('/^(.+)\\.([a-z0-9-]+\\.[a-z]+)$/', $fulldomain, $matches)) {
             $subdomain = $matches[1];
             $domain = $matches[2];
         } else {
             $subdomain = '';
             $domain = $fulldomain;
         }
     }
     $query = $db->query('
         SELECT *
           FROM ' . $platform->quoteIdentifier('subdomain') . '
          WHERE LOWER( ' . $platform->quoteIdentifier('subdomain') . ' )
              = LOWER( ' . $driver->formatParameterName('subdomain') . ' )
     ');
     $result = $query->execute(array('subdomain' => $subdomain));
     if ($result->getAffectedRows() > 0) {
         $schema = $db->getCurrentSchema();
         foreach ($result as $data) {
             $info = new SiteInfo(array('schema' => $schema, 'domain' => $domain, 'subdomain' => $subdomain, 'subdomainId' => $data['id'], 'fulldomain' => $fulldomain, 'scheme' => $this->getScheme(), 'port' => $this->getPort()));
             $sm->setService('SiteInfo', $info);
             return $db;
         }
     } else {
         if ($domain) {
             $sm->setService('RedirectToDomain', new RedirectionService($this->getScheme(), $domain, $this->getPort(), 'sub-domain not found', false));
         } else {
             if (empty($config['defaultDomain'])) {
                 throw new Exception\InvalidArgumentException('Domain not found, and default domain not set');
             } else {
                 $sm->setService('RedirectToDomain', new RedirectionService($this->getScheme(), $config['defaultDomain'], $this->getPort(), 'sub-domain not found', false));
             }
         }
     }
     return $db;
 }
开发者ID:gridguyz,项目名称:core,代码行数:84,代码来源:Singlesite.php

示例6: createTestTable

 /**
  * Copies table structure and creates temporary table on top of it.
  * 
  * @param string $table Table name
  * @param Adapter $db
  */
 private function createTestTable($table, Adapter $source, Adapter $dest)
 {
     $createTable = $this->getCreateTable($table, $source);
     if ($source->getCurrentSchema() == $dest->getCurrentSchema()) {
         $createTable = str_replace('CREATE TABLE', 'CREATE TEMPORARY TABLE', $createTable);
     }
     $createTable = preg_replace('/ENGINE=\\w+/', 'ENGINE=Memory', $createTable, 1);
     $createTable = preg_replace(array('`\\s(tiny|medium|long)?text(\\s|,)`i', '`\\s(tiny|medium|long)?blob(\\s|,)`i'), array(' varchar(512)$2', ' varbinary(512)$2'), $createTable);
     $dest->query($createTable, Adapter::QUERY_MODE_EXECUTE);
 }
开发者ID:sporkcode,项目名称:spork,代码行数:16,代码来源:TestCaseDb.php


注:本文中的Zend\Db\Adapter\Adapter::getCurrentSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。