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


PHP Connection::getSupplementalDriver方法代码示例

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


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

示例1: normalizeRow

 /**
  * Normalizes result row.
  * @param  array
  * @return array
  */
 public function normalizeRow($row)
 {
     if ($this->types === NULL) {
         $this->types = array();
         if ($this->connection->getSupplementalDriver()->supports['meta']) {
             // workaround for PHP bugs #53782, #54695
             $col = 0;
             foreach ($row as $key => $foo) {
                 $type = $this->getColumnMeta($col++);
                 if (isset($type['native_type'])) {
                     $this->types[$key] = Reflection\DatabaseReflection::detectType($type['native_type']);
                 }
             }
         }
     }
     foreach ($this->types as $key => $type) {
         $value = $row[$key];
         if ($value === NULL || $value === FALSE || $type === Reflection\DatabaseReflection::FIELD_TEXT) {
         } elseif ($type === Reflection\DatabaseReflection::FIELD_INTEGER) {
             $row[$key] = is_float($tmp = $value * 1) ? $value : $tmp;
         } elseif ($type === Reflection\DatabaseReflection::FIELD_FLOAT) {
             $row[$key] = (string) ($tmp = (double) $value) === $value ? $tmp : $value;
         } elseif ($type === Reflection\DatabaseReflection::FIELD_BOOL) {
             $row[$key] = (bool) $value && $value !== 'f' && $value !== 'F';
         }
     }
     return $this->connection->getSupplementalDriver()->normalizeRow($row, $this);
 }
开发者ID:bazo,项目名称:Tatami,代码行数:33,代码来源:Statement.php

示例2: __construct

 public function __construct(Connection $connection, $queryString, array $params)
 {
     $time = microtime(TRUE);
     $this->connection = $connection;
     $this->supplementalDriver = $connection->getSupplementalDriver();
     $this->queryString = $queryString;
     $this->params = $params;
     try {
         if (substr($queryString, 0, 2) === '::') {
             $connection->getPdo()->{substr($queryString, 2)}();
         } elseif ($queryString !== NULL) {
             static $types = ['boolean' => PDO::PARAM_BOOL, 'integer' => PDO::PARAM_INT, 'resource' => PDO::PARAM_LOB, 'NULL' => PDO::PARAM_NULL];
             $this->pdoStatement = $connection->getPdo()->prepare($queryString);
             foreach ($params as $key => $value) {
                 $type = gettype($value);
                 $this->pdoStatement->bindValue(is_int($key) ? $key + 1 : $key, $value, isset($types[$type]) ? $types[$type] : PDO::PARAM_STR);
             }
             $this->pdoStatement->setFetchMode(PDO::FETCH_ASSOC);
             $this->pdoStatement->execute();
         }
     } catch (\PDOException $e) {
         $e = $this->supplementalDriver->convertException($e);
         $e->queryString = $queryString;
         throw $e;
     }
     $this->time = microtime(TRUE) - $time;
 }
开发者ID:nette,项目名称:database,代码行数:27,代码来源:ResultSet.php

示例3: __construct

	public function __construct($tableName, Connection $connection, IReflection $reflection)
	{
		$this->tableName = $tableName;
		$this->databaseReflection = $reflection;
		$this->driver = $connection->getSupplementalDriver();
		$this->delimitedTable = implode('.', array_map(array($this->driver, 'delimite'), explode('.', $tableName)));
	}
开发者ID:nakoukal,项目名称:fakturace,代码行数:7,代码来源:SqlBuilder.php

示例4: normalizeRow

	/**
	 * Normalizes result row.
	 * @param  array
	 * @return array
	 */
	public function normalizeRow($row)
	{
		if ($this->types === NULL) {
			try {
				$this->types = array();
				foreach ($row as $key => $foo) {
					$type = $this->getColumnMeta(count($this->types));
					if (isset($type['native_type'])) {
						$this->types[$key] = DatabaseReflection::detectType($type['native_type']);
					}
				}
			} catch (\PDOException $e) {
			}
		}
		foreach ($this->types as $key => $type) {
			$value = $row[$key];
			if ($value === NULL || $value === FALSE || $type === DatabaseReflection::FIELD_TEXT) {

			} elseif ($type === DatabaseReflection::FIELD_INTEGER) {
				$row[$key] = is_float($tmp = $value * 1) ? $value : $tmp;

			} elseif ($type === DatabaseReflection::FIELD_FLOAT) {
				$row[$key] = (string) ($tmp = (float) $value) === $value ? $tmp : $value;

			} elseif ($type === DatabaseReflection::FIELD_BOOL) {
				$row[$key] = ((bool) $value) && $value !== 'f' && $value !== 'F';
			}
		}

		return $this->connection->getSupplementalDriver()->normalizeRow($row, $this);
	}
开发者ID:JanTvrdik,项目名称:StaticWeb,代码行数:36,代码来源:Statement.php

示例5: tryDelimite

 protected function tryDelimite($s)
 {
     $driver = $this->connection->getSupplementalDriver();
     return preg_replace_callback('#(?<=[\\s,<>=]|^)[a-z_][a-z0-9_.]*(?=[\\s,<>=]|$)#i', function ($m) use($driver) {
         return strtoupper($m[0]) === $m[0] ? $m[0] : implode('.', array_map(array($driver, 'delimite'), explode('.', $m[0])));
     }, $s);
 }
开发者ID:exesek,项目名称:nette20login,代码行数:7,代码来源:Selection.php

示例6: tryDelimite

 protected function tryDelimite($s)
 {
     $driver = $this->connection->getSupplementalDriver();
     return preg_replace_callback('#(?<=[^\\w`"\\[]|^)[a-z_][a-z0-9_]*(?=[^\\w`"(\\]]|$)#i', function ($m) use($driver) {
         return strtoupper($m[0]) === $m[0] ? $m[0] : $driver->delimite($m[0]);
     }, $s);
 }
开发者ID:cujan,项目名称:atlas-mineralov-a-hornin,代码行数:7,代码来源:SqlBuilder.php

示例7: __construct

 public function __construct($tableName, Connection $connection, IReflection $reflection)
 {
     $this->tableName = $tableName;
     $this->databaseReflection = $reflection;
     $this->driver = $connection->getSupplementalDriver();
     $this->delimitedTable = $this->tryDelimite($tableName);
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:7,代码来源:SqlBuilder.php

示例8: reloadForeignKeys

 protected function reloadForeignKeys($table)
 {
     foreach ($this->connection->getSupplementalDriver()->getForeignKeys($table) as $row) {
         $this->structure['belongsTo'][strtolower($table)][$row['local']] = $row['table'];
         $this->structure['hasMany'][strtolower($row['table'])][$row['local'] . $table] = array($row['local'], $table);
     }
     if (isset($this->structure['belongsTo'][$table])) {
         uksort($this->structure['belongsTo'][$table], function ($a, $b) {
             return strlen($a) - strlen($b);
         });
     }
 }
开发者ID:BroukPytlik,项目名称:agility,代码行数:12,代码来源:DiscoveredReflection.php

示例9: analyzeForeignKeys

 protected function analyzeForeignKeys(&$structure, $table)
 {
     $lowerTable = strtolower($table);
     foreach ($this->connection->getSupplementalDriver()->getForeignKeys($table) as $row) {
         $structure['belongsTo'][$lowerTable][$row['local']] = $row['table'];
         $structure['hasMany'][strtolower($row['table'])][$table][] = $row['local'];
     }
     if (isset($structure['belongsTo'][$lowerTable])) {
         uksort($structure['belongsTo'][$lowerTable], function ($a, $b) {
             return strlen($a) - strlen($b);
         });
     }
 }
开发者ID:nette,项目名称:database,代码行数:13,代码来源:Structure.php

示例10: __construct

	public function __construct(Connection $connection)
	{
		$this->connection = $connection;
		$this->driver = $connection->getSupplementalDriver();
		$this->arrayModes = array(
			'INSERT' => $this->driver->isSupported(ISupplementalDriver::SUPPORT_MULTI_INSERT_AS_SELECT) ? 'select' : 'values',
			'REPLACE' => 'values',
			'UPDATE' => 'assoc',
			'WHERE' => 'and',
			'HAVING' => 'and',
			'ORDER BY' => 'order',
			'GROUP BY' => 'order',
		);
	}
开发者ID:nakoukal,项目名称:fakturace,代码行数:14,代码来源:SqlPreprocessor.php

示例11: buildSelectQuery

 /**
  * Returns SQL query.
  *
  * @return string
  */
 public function buildSelectQuery()
 {
     $join = $this->buildJoins(implode(',', $this->conditions), true);
     $join += $this->buildJoins(implode(',', $this->select) . ",{$this->group},{$this->having}," . implode(',', $this->order));
     $prefix = $join ? "{$this->delimitedTable}." : '';
     if ($this->select) {
         $cols = $this->tryDelimite($this->removeExtraTables(implode(', ', $this->select)));
     } elseif ($prevAccessed = $this->selection->getPreviousAccessed()) {
         $cols = array_map(array($this->connection->getSupplementalDriver(), 'delimite'), array_keys(array_filter($prevAccessed)));
         $cols = $prefix . implode(', ' . $prefix, $cols);
     } else {
         $cols = $prefix . '*';
     }
     return "SELECT{$this->buildTopClause()} {$cols} FROM {$this->delimitedTable}" . implode($join) . $this->buildConditions();
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:20,代码来源:SqlBuilder.php

示例12: getPrimarySequence

 /**
  * @return string
  */
 public function getPrimarySequence()
 {
     if ($this->primarySequence === FALSE) {
         $this->primarySequence = NULL;
         $driver = $this->connection->getSupplementalDriver();
         if ($driver->isSupported(ISupplementalDriver::SUPPORT_SEQUENCE) && $this->primary !== NULL) {
             foreach ($driver->getColumns($this->name) as $column) {
                 if ($column['name'] === $this->primary) {
                     $this->primarySequence = $column['vendor']['sequence'];
                     break;
                 }
             }
         }
     }
     return $this->primarySequence;
 }
开发者ID:jurasm2,项目名称:nette,代码行数:19,代码来源:Selection.php

示例13: __construct

 public function __construct(Connection $connection, $queryString, array $params)
 {
     $time = microtime(TRUE);
     $this->connection = $connection;
     $this->supplementalDriver = $connection->getSupplementalDriver();
     $this->queryString = $queryString;
     $this->params = $params;
     if (substr($queryString, 0, 2) === '::') {
         $connection->getPdo()->{substr($queryString, 2)}();
     } elseif ($queryString !== NULL) {
         $this->pdoStatement = $connection->getPdo()->prepare($queryString);
         $this->pdoStatement->setFetchMode(PDO::FETCH_ASSOC);
         $this->pdoStatement->execute($params);
     }
     $this->time = microtime(TRUE) - $time;
 }
开发者ID:cujan,项目名称:atlashornin,代码行数:16,代码来源:ResultSet.php

示例14: detectColumnTypes

 private function detectColumnTypes()
 {
     if ($this->types === null) {
         $this->types = array();
         if ($this->connection->getSupplementalDriver()->isSupported(ISupplementalDriver::META)) {
             // workaround for PHP bugs #53782, #54695
             $col = 0;
             while ($meta = $this->getColumnMeta($col++)) {
                 if (isset($meta['native_type'])) {
                     $this->types[$meta['name']] = Helpers::detectType($meta['native_type']);
                 }
             }
         }
     }
     return $this->types;
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:16,代码来源:Statement.php

示例15: detectColumnTypes

 private function detectColumnTypes()
 {
     if ($this->types === NULL) {
         $this->types = array();
         if ($this->connection->getSupplementalDriver()->isSupported(ISupplementalDriver::SUPPORT_COLUMNS_META)) {
             // workaround for PHP bugs #53782, #54695
             $count = $this->columnCount();
             for ($col = 0; $col < $count; $col++) {
                 $meta = $this->getColumnMeta($col);
                 if (isset($meta['native_type'])) {
                     $this->types[$meta['name']] = Helpers::detectType($meta['native_type']);
                 }
             }
         }
     }
     return $this->types;
 }
开发者ID:svobodni,项目名称:web,代码行数:17,代码来源:Statement.php


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