本文整理汇总了PHP中Doctrine\DBAL\Connection::getDatabasePlatform方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getDatabasePlatform方法的具体用法?PHP Connection::getDatabasePlatform怎么用?PHP Connection::getDatabasePlatform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Connection
的用法示例。
在下文中一共展示了Connection::getDatabasePlatform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateStatus
/**
* Update status
*
* @param string $nonce
* @param string $apiUrls
*
* @return int
*/
public function updateStatus($nonce, $apiUrls)
{
// Truncate table
$this->con->executeQuery($this->con->getDatabasePlatform()->getTruncateTableSQL($this->tables['status']));
// Insert new row
return $this->con->insert($this->tables['status'], array('nonce' => $nonce, 'noncets' => time(), 'apiurls' => $apiUrls, 'modified' => new \DateTime()), array(\PDO::PARAM_STR, \PDO::PARAM_INT, \PDO::PARAM_STR, 'datetime'));
}
示例2: truncateTable
protected function truncateTable($tableName)
{
if (!in_array($tableName, $this->truncatedTables)) {
$query = $this->connection->getDatabasePlatform()->getTruncateTableSql($tableName, true);
$this->connection->executeUpdate($query);
$this->truncatedTables[] = $tableName;
}
}
示例3: apply
/**
* {@inheritdoc}
*/
public function apply($fromAlias, $fromIdentifier, $resourcePrefix, array $requesterIdentifiers, $mask, array $orX = [])
{
$this->queryBuilder->leftJoin($fromAlias, $this->getAclSchema()->getPermissionsTableName(), 'acl_p', 'acl_p.resource = ' . $this->connection->getDatabasePlatform()->getConcatExpression(':acl_prefix', $fromAlias . '.' . $fromIdentifier));
$orX[] = 'acl_p.requester IN (:acl_identifiers) AND :acl_mask = (acl_p.mask & :acl_mask)';
$this->queryBuilder->andWhere(implode(' OR ', $orX));
$this->queryBuilder->setParameter('acl_prefix', $resourcePrefix, \PDO::PARAM_STR)->setParameter('acl_identifiers', $requesterIdentifiers, Connection::PARAM_STR_ARRAY)->setParameter('acl_mask', $mask, \PDO::PARAM_INT);
return $this->queryBuilder;
}
示例4: __construct
/**
* Initializes a new instance of a class derived from AbstractCollectionPersister.
*
* @param \Doctrine\ORM\EntityManager $em
*/
public function __construct(EntityManager $em)
{
$this->em = $em;
$this->uow = $em->getUnitOfWork();
$this->conn = $em->getConnection();
$this->platform = $this->conn->getDatabasePlatform();
$this->quoteStrategy = $em->getConfiguration()->getQuoteStrategy();
}
示例5: initialize
/**
* Initialization of data required to run current command
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function initialize(InputInterface $input, OutputInterface $output)
{
$this->kernelDir = $this->getContainer()->getParameter('kernel.root_dir');
$this->entityManager = $this->getContainer()->get('doctrine.orm.entity_manager');
$this->connection = $this->entityManager->getConnection();
$this->dbPlatform = $this->connection->getDatabasePlatform();
$this->output = $output;
}
示例6: dropTable
public function dropTable()
{
$schema = $this->getTableSchema();
$queries = $schema->toDropSql($this->connection->getDatabasePlatform());
foreach ($queries as $query) {
$this->connection->prepare($query)->execute();
}
}
示例7: getSystemInfo
/**
* Returns the system information:
* - cpu information
* - memory size
* - php version
* - php accelerator info
* - database related info.
*
* @return array
*/
public function getSystemInfo()
{
$info = ezcSystemInfo::getInstance();
$accelerator = false;
if ($info->phpAccelerator) {
$accelerator = ['name' => $info->phpAccelerator->name, 'url' => $info->phpAccelerator->url, 'enabled' => $info->phpAccelerator->isEnabled, 'versionString' => $info->phpAccelerator->versionString];
}
return ['cpuType' => $info->cpuType, 'cpuSpeed' => $info->cpuSpeed, 'cpuCount' => $info->cpuCount, 'memorySize' => $info->memorySize, 'phpVersion' => phpversion(), 'phpAccelerator' => $accelerator, 'database' => ['type' => $this->connection->getDatabasePlatform()->getName(), 'name' => $this->connection->getDatabase(), 'host' => $this->connection->getHost(), 'username' => $this->connection->getUsername()]];
}
示例8: setUpDBALTypes
/**
* Configures DBAL types required in tests
*/
protected function setUpDBALTypes()
{
if (Type::hasType('jsonb')) {
Type::overrideType('jsonb', 'Boldtrn\\JsonbBundle\\Types\\JsonbArrayType');
} else {
Type::addType('jsonb', 'Boldtrn\\JsonbBundle\\Types\\JsonbArrayType');
}
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('JSONB', 'jsonb');
}
示例9: __construct
public function __construct(Version $version)
{
$config = $version->getConfiguration();
$this->version = $version;
$this->connection = $config->getConnection();
$this->sm = $this->connection->getSchemaManager();
$this->platform = $this->connection->getDatabasePlatform();
$this->outputWriter = $config->getOutputWriter();
}
示例10: setUp
public function setUp()
{
$this->connection = \OC_DB::getConnection();
if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
$this->markTestSkipped("Test only relevant on MySql");
}
$dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix");
$this->tableName = uniqid($dbPrefix . "_enum_bit_test");
$this->connection->exec("CREATE TABLE {$this->tableName}(b BIT, e ENUM('1','2','3','4'))");
}
示例11: setUp
public function setUp()
{
$this->connection = \OC_DB::getConnection();
if (!$this->connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
$this->markTestSkipped("Test only relevant on Sqlite");
}
$dbPrefix = \OC::$server->getConfig()->getSystemValue("dbtableprefix");
$this->tableName = uniqid($dbPrefix . "_enum_bit_test");
$this->connection->exec("CREATE TABLE {$this->tableName}(t0 tinyint unsigned, t1 tinyint)");
}
示例12: generateChangeScript
/**
* @param \Doctrine\DBAL\Schema\Schema $targetSchema
* @return string
*/
public function generateChangeScript(Schema $targetSchema)
{
$schemaDiff = $this->getDiff($targetSchema, $this->connection);
$script = '';
$sqls = $schemaDiff->toSql($this->connection->getDatabasePlatform());
foreach ($sqls as $sql) {
$script .= $this->convertStatementToScript($sql);
}
return $script;
}
示例13: shouldBeRun
/**
* {@inheritdoc}
*/
public function shouldBeRun()
{
$schemaManager = $this->connection->getSchemaManager();
if (!$schemaManager->tablesExist('tl_member')) {
return false;
}
$sql = $this->connection->getDatabasePlatform()->getListTableIndexesSQL('tl_member', $this->connection->getDatabase());
$index = $this->connection->fetchAssoc($sql . " AND INDEX_NAME = 'username'");
return '0' !== $index['Non_Unique'];
}
示例14: processRow
/**
* @param array $row
*/
private function processRow(array $row)
{
$fields = Type::getType(Type::TARRAY)->convertToPHPValue($row['data'], $this->connection->getDatabasePlatform());
foreach ($fields as $field => $values) {
$fieldType = $this->getFieldType($row['entity_id'], $field);
$dataType = $this->normalizeDataTypeName($fieldType);
$data = ['audit_id' => $row['id'], 'data_type' => $dataType, 'field' => $field, sprintf('old_%s', $dataType) => $this->parseValue($values['old']), sprintf('new_%s', $dataType) => $this->parseValue($values['new'])];
$types = ['integer', 'string', 'string', $dataType, $dataType];
$this->connection->insert('oro_audit_field', $data, $types);
}
}
示例15: setUp
protected function setUp()
{
parent::setUp();
$this->config = \OC::$server->getConfig();
$this->connection = \OC::$server->getDatabaseConnection();
if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
$this->markTestSkipped('DB migration tests are not supported on OCI');
}
$this->manager = new \OC\DB\MDB2SchemaManager($this->connection);
$this->tableName = strtolower($this->getUniqueID($this->config->getSystemValue('dbtableprefix', 'oc_') . 'test_'));
}