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


PHP AbstractPlatform::getEmptyIdentityInsertSQL方法代码示例

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


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

示例1: _getInsertSQL

 /**
  * Gets the INSERT SQL used by the persister to persist a new entity.
  *
  * @return string
  */
 protected function _getInsertSQL()
 {
     if ($this->_insertSql === null) {
         $insertSql = '';
         $columns = $this->_getInsertColumnList();
         if (empty($columns)) {
             $insertSql = $this->_platform->getEmptyIdentityInsertSQL($this->_class->getQuotedTableName($this->_platform), $this->_class->getQuotedColumnName($this->_class->identifier[0], $this->_platform));
         } else {
             $columns = array_unique($columns);
             $values = array_fill(0, count($columns), '?');
             $insertSql = 'INSERT INTO ' . $this->_class->getQuotedTableName($this->_platform) . ' (' . implode(', ', $columns) . ') ' . 'VALUES (' . implode(', ', $values) . ')';
         }
         $this->_insertSql = $insertSql;
     }
     return $this->_insertSql;
 }
开发者ID:manish436,项目名称:zform,代码行数:21,代码来源:BasicEntityPersister.php

示例2: _getInsertSQL

 /**
  * Gets the INSERT SQL used by the persister to persist a new entity.
  *
  * @return string
  */
 protected function _getInsertSQL()
 {
     if ($this->_insertSql === null) {
         $insertSql = '';
         $columns = $this->_getInsertColumnList();
         if (empty($columns)) {
             $insertSql = $this->_platform->getEmptyIdentityInsertSQL($this->_class->getQuotedTableName($this->_platform), $this->_class->getQuotedColumnName($this->_class->identifier[0], $this->_platform));
         } else {
             $columns = array_unique($columns);
             $values = array();
             foreach ($columns as $column) {
                 $placeholder = '?';
                 if (isset($this->_columnTypes[$column]) && isset($this->_class->fieldMappings[$this->_class->fieldNames[$column]]['requireSQLConversion'])) {
                     $type = Type::getType($this->_columnTypes[$column]);
                     $placeholder = $type->convertToDatabaseValueSQL('?', $this->_platform);
                 }
                 $values[] = $placeholder;
             }
             $insertSql = 'INSERT INTO ' . $this->_class->getQuotedTableName($this->_platform) . ' (' . implode(', ', $columns) . ') VALUES (' . implode(', ', $values) . ')';
         }
         $this->_insertSql = $insertSql;
     }
     return $this->_insertSql;
 }
开发者ID:pabloasc,项目名称:test_social,代码行数:29,代码来源:BasicEntityPersister.php

示例3: getInsertSQL

    /**
     * Gets the INSERT SQL used by the persister to persist a new entity.
     *
     * @return string
     */
    protected function getInsertSQL()
    {
        if ($this->insertSql !== null) {
            return $this->insertSql;
        }

        $columns   = $this->getInsertColumnList();
        $tableName = $this->quoteStrategy->getTableName($this->class, $this->platform);

        if (empty($columns)) {
            $identityColumn  = $this->quoteStrategy->getColumnName($this->class->identifier[0], $this->class, $this->platform);
            $this->insertSql = $this->platform->getEmptyIdentityInsertSQL($tableName, $identityColumn);

            return $this->insertSql;
        }

        $values  = array();
        $columns = array_unique($columns);

        foreach ($columns as $column) {
            $placeholder = '?';

            if (isset($this->class->fieldNames[$column]) 
                && isset($this->columnTypes[$this->class->fieldNames[$column]])
                && isset($this->class->fieldMappings[$this->class->fieldNames[$column]]['requireSQLConversion'])) {

                $type        = Type::getType($this->columnTypes[$this->class->fieldNames[$column]]);
                $placeholder = $type->convertToDatabaseValueSQL('?', $this->platform);
            }

            $values[] = $placeholder;
        }

        $columns = implode(', ', $columns);
        $values  = implode(', ', $values);

        $this->insertSql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $tableName, $columns, $values);

        return $this->insertSql;
    }
开发者ID:nattaphat,项目名称:hgis,代码行数:45,代码来源:BasicEntityPersister.php


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