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


PHP DatabaseHandler::quoteIdentifier方法代码示例

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


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

示例1: convertFields

 function convertFields(OutputInterface $output)
 {
     $query = $this->db->createSelectQuery();
     $query->select($query->expr->count('*'));
     $query->from('ezcontentobject_attribute');
     $query->where($query->expr->eq($this->db->quoteIdentifier('data_type_string'), $query->bindValue('ezxmltext', null, PDO::PARAM_STR)));
     $statement = $query->prepare();
     $statement->execute();
     $count = $statement->fetchColumn();
     $output->writeln("Found {$count} field rows to convert.");
     $query = $this->db->createSelectQuery();
     $query->select('*');
     $query->from('ezcontentobject_attribute');
     $query->where($query->expr->eq($this->db->quoteIdentifier('data_type_string'), $query->bindValue('ezxmltext', null, PDO::PARAM_STR)));
     $statement = $query->prepare();
     $statement->execute();
     while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
         if (empty($row['data_text'])) {
             $inputValue = Value::EMPTY_VALUE;
         } else {
             $inputValue = $row['data_text'];
         }
         $converted = $this->convert($inputValue);
         $updateQuery = $this->db->createUpdateQuery();
         $updateQuery->update($this->db->quoteIdentifier('ezcontentobject_attribute'));
         $updateQuery->set($this->db->quoteIdentifier('data_type_string'), $updateQuery->bindValue('ezrichtext', null, PDO::PARAM_STR));
         $updateQuery->set($this->db->quoteIdentifier('data_text'), $updateQuery->bindValue($converted, null, PDO::PARAM_STR));
         $updateQuery->where($updateQuery->expr->lAnd($updateQuery->expr->eq($this->db->quoteIdentifier('id'), $updateQuery->bindValue($row['id'], null, PDO::PARAM_INT)), $updateQuery->expr->eq($this->db->quoteIdentifier('version'), $updateQuery->bindValue($row['version'], null, PDO::PARAM_INT))));
         $updateQuery->prepare()->execute();
         $this->logger->info("Converted ezxmltext field #{$row['id']} to richtext", ['original' => $inputValue, 'converted' => $converted]);
     }
     $output->writeln("Converted {$count} ezxmltext fields to richtext");
 }
开发者ID:ezsystems,项目名称:ezplatform-xmltext-fieldtype,代码行数:33,代码来源:ConvertXmlTextToRichTextCommand.php

示例2: getSearchableFieldMapData

 /**
  * Returns searchable field mapping data
  *
  * @return array
  */
 public function getSearchableFieldMapData()
 {
     $query = $this->dbHandler->createSelectQuery();
     $query->select($this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_definition_identifier")), $this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass"), $this->dbHandler->quoteIdentifier("content_type_identifier")), $this->dbHandler->alias($this->dbHandler->quoteColumn("id", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_definition_id")), $this->dbHandler->alias($this->dbHandler->quoteColumn("data_type_string", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_type_identifier")))->from($this->dbHandler->quoteTable("ezcontentclass_attribute"))->innerJoin($this->dbHandler->quoteTable("ezcontentclass"), $query->expr->eq($this->dbHandler->quoteColumn("contentclass_id", "ezcontentclass_attribute"), $this->dbHandler->quoteColumn("id", "ezcontentclass")))->where($query->expr->eq($this->dbHandler->quoteColumn("is_searchable", "ezcontentclass_attribute"), $query->bindValue(1, null, PDO::PARAM_INT)));
     $statement = $query->prepare($query);
     $statement->execute();
     return $statement->fetchAll(\PDO::FETCH_ASSOC);
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:13,代码来源:DoctrineDatabase.php

示例3: getContentInfoList

    /**
     * Get sorted arrays of content IDs, which should be returned
     *
     * @param Criterion $filter
     * @param array $sort
     * @param mixed $offset
     * @param mixed $limit
     * @param mixed $translations
     *
     * @return int[]
     */
    protected function getContentInfoList( Criterion $filter, $sort, $offset, $limit, $translations )
    {
        $query = $this->handler->createSelectQuery();
        $query->selectDistinct(
            'ezcontentobject.*',
            $this->handler->aliasedColumn( $query, 'main_node_id', 'main_tree' )
        );

        if ( $sort !== null )
        {
            $this->sortClauseConverter->applySelect( $query, $sort );
        }

        $query->from(
            $this->handler->quoteTable( 'ezcontentobject' )
        )->innerJoin(
            'ezcontentobject_version',
            'ezcontentobject.id',
            'ezcontentobject_version.contentobject_id'
        )->leftJoin(
            $this->handler->alias(
                $this->handler->quoteTable( 'ezcontentobject_tree' ),
                $this->handler->quoteIdentifier( 'main_tree' )
            ),
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->handler->quoteColumn( "contentobject_id", "main_tree" ),
                    $this->handler->quoteColumn( "id", "ezcontentobject" )
                ),
                $query->expr->eq(
                    $this->handler->quoteColumn( "main_node_id", "main_tree" ),
                    $this->handler->quoteColumn( "node_id", "main_tree" )
                )
            )
        );

        if ( $sort !== null )
        {
            $this->sortClauseConverter->applyJoin( $query, $sort );
        }

        $query->where(
            $this->getQueryCondition( $filter, $query, $translations )
        );

        if ( $sort !== null )
        {
            $this->sortClauseConverter->applyOrderBy( $query );
        }

        $query->limit( $limit, $offset );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll( \PDO::FETCH_ASSOC );
    }
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:68,代码来源:DoctrineDatabase.php

示例4: getFieldMap

 /**
  * Returns field mapping data
  *
  * Returns an associative array with ContentType and FieldDefinition identifiers as
  * first and second level keys respectively, and FieldDefinition ID as value.
  *
  * @return array
  */
 public function getFieldMap()
 {
     $query = $this->dbHandler->createSelectQuery();
     $query->select($this->dbHandler->alias($this->dbHandler->quoteColumn("id", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_id")), $this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass_attribute"), $this->dbHandler->quoteIdentifier("field_identifier")), $this->dbHandler->alias($this->dbHandler->quoteColumn("identifier", "ezcontentclass"), $this->dbHandler->quoteIdentifier("type_identifier")))->from($this->dbHandler->quoteTable("ezcontentclass_attribute"))->innerJoin($this->dbHandler->quoteTable("ezcontentclass"), $query->expr->eq($this->dbHandler->quoteColumn("contentclass_id", "ezcontentclass_attribute"), $this->dbHandler->quoteColumn("id", "ezcontentclass")));
     $statement = $query->prepare($query);
     $statement->execute();
     $map = array();
     $rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
     foreach ($rows as $row) {
         $map[$row["type_identifier"]][$row["field_identifier"]] = $row["field_id"];
     }
     return $map;
 }
开发者ID:Jenkosama,项目名称:ezpublish-kernel,代码行数:21,代码来源:DoctrineDatabase.php

示例5: loadRolesForContentObjects

 /**
  * Loads all roles associated with the given content objects.
  *
  * @param array $contentIds
  * @param int $status One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
  *
  * @return array
  */
 public function loadRolesForContentObjects($contentIds, $status = Role::STATUS_DEFINED)
 {
     $query = $this->handler->createSelectQuery();
     if ($status === Role::STATUS_DEFINED) {
         $roleIdCondition = $query->expr->eq($this->handler->quoteColumn('id', 'ezrole'), $this->handler->quoteColumn('role_id', 'ezuser_role_search'));
     } else {
         $roleIdCondition = $query->expr->eq($this->handler->quoteColumn('version', 'ezrole'), $this->handler->quoteColumn('role_id', 'ezuser_role_search'));
     }
     $query->select($this->handler->aliasedColumn($query, 'contentobject_id', 'ezuser_role'), $this->handler->aliasedColumn($query, 'id', 'ezrole'), $this->handler->aliasedColumn($query, 'name', 'ezrole'), $this->handler->aliasedColumn($query, 'version', 'ezrole'), $this->handler->aliasedColumn($query, 'id', 'ezpolicy'), $this->handler->aliasedColumn($query, 'function_name', 'ezpolicy'), $this->handler->aliasedColumn($query, 'module_name', 'ezpolicy'), $this->handler->aliasedColumn($query, 'original_id', 'ezpolicy'), $this->handler->aliasedColumn($query, 'identifier', 'ezpolicy_limitation'), $this->handler->aliasedColumn($query, 'value', 'ezpolicy_limitation_value'))->from($query->alias($this->handler->quoteTable('ezuser_role'), $this->handler->quoteIdentifier('ezuser_role_search')))->leftJoin($this->handler->quoteTable('ezrole'), $roleIdCondition)->leftJoin($this->handler->quoteTable('ezuser_role'), $query->expr->eq($this->handler->quoteColumn('role_id', 'ezuser_role'), $this->handler->quoteColumn('id', 'ezrole')))->leftJoin($this->handler->quoteTable('ezpolicy'), $query->expr->eq($this->handler->quoteColumn('role_id', 'ezpolicy'), $this->handler->quoteColumn('id', 'ezrole')))->leftJoin($this->handler->quoteTable('ezpolicy_limitation'), $query->expr->eq($this->handler->quoteColumn('policy_id', 'ezpolicy_limitation'), $this->handler->quoteColumn('id', 'ezpolicy')))->leftJoin($this->handler->quoteTable('ezpolicy_limitation_value'), $query->expr->eq($this->handler->quoteColumn('limitation_id', 'ezpolicy_limitation_value'), $this->handler->quoteColumn('id', 'ezpolicy_limitation')))->where($query->expr->in($this->handler->quoteColumn('contentobject_id', 'ezuser_role_search'), $contentIds));
     $statement = $query->prepare();
     $statement->execute();
     return $statement->fetchAll(\PDO::FETCH_ASSOC);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:21,代码来源:DoctrineDatabase.php

示例6: getSortColumnName

 /**
  * Returns the quoted sort column name.
  *
  * @param int $number
  *
  * @return string
  */
 protected function getSortColumnName($number)
 {
     return $this->dbHandler->quoteIdentifier('sort_column_' . $number);
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:11,代码来源:SortClauseHandler.php


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