當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。