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


PHP Column::setDataType方法代码示例

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


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

示例1: getInternalColumns

 protected function getInternalColumns()
 {
     if (is_null($this->columns)) {
         $this->columns = array();
         $keyLength = $this->getKeyLength();
         if (is_null($keyLength)) {
             throw new ErrorException("Cannot create meta-table-schema for indicies when no key-length is specified!");
         }
         $columnPage = new Column();
         for ($i = 1; $i <= 33; $i++) {
             $columnPage->setName("ref{$i}");
             $columnPage->setDataType(DataType::INT());
             $columnPage->setLength($keyLength);
             $columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
             $this->columns[] = clone $columnPage;
             $columnPage->setName("val{$i}");
             $columnPage->setDataType(DataType::INT());
             $columnPage->setLength($keyLength);
             $columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
             $this->columns[] = clone $columnPage;
             $columnPage->setName("row{$i}");
             $columnPage->setDataType(DataType::INT());
             $columnPage->setLength($keyLength);
             $columnPage->setExtraFlags(Column::EXTRA_PRIMARY_KEY);
             $this->columns[] = clone $columnPage;
         }
     }
     return $this->columns;
 }
开发者ID:addiks,项目名称:phpsql,代码行数:29,代码来源:Indicies.php

示例2: __construct

 /**
  * Constructs an instance from a list of column headers as returned by the
  * Google Analytics API.
  *
  * @param array $headers
  * @param Google\Analytics\API $api
  */
 public function __construct(array $headers, API $api)
 {
     $headerCount = count($headers);
     for ($i = 0; $i < $headerCount; $i++) {
         self::_validateHeader($headers[$i]);
         try {
             $column = $api->getColumn($headers[$i]['name']);
         } catch (InvalidArgumentException $e) {
             /* I don't expect this to happen but in case it does, we can
             			create a representation of the column by building it on the
             			fly, though it will be missing most of the available
             			properties. */
             $column = new Column();
             $column->setID(API::addPrefix($headers[$i]['name']));
             $column->setType($headers[$i]['columnType']);
             $column->setDataType($headers[$i]['dataType']);
         }
         $this->_columns[] = $column;
         $this->_columnIndicesByName[$column->getName()] = $i;
     }
 }
开发者ID:performics,项目名称:ga-cli-api,代码行数:28,代码来源:GaDataColumnHeaderCollection.class.php

示例3: checkColumnDetail

 /**
  * Obtiene el detalle de columnas de la tabla o vista actual
  * @return Array
  */
 public function checkColumnDetail()
 {
     $sql = "select ut.column_name, data_type, data_length, nullable, data_default, comments " . "from user_tab_columns ut inner join user_col_comments uc " . "on ut.table_name = uc.table_name " . "and ut.column_name = uc.column_name " . "where ut.table_name = upper(:v_table)";
     $stmt = oci_parse($this->getConnection(), $sql);
     oci_bind_by_name($stmt, ":v_table", $this->objectName);
     if (!@oci_execute($stmt)) {
         $e = oci_error();
         $this->setMensaje("Error al obtener el detalle de las columnas de la tabla o vista '{$this->objectName}' - {$e['message']}");
         $this->setEstado(false);
     }
     while ($row = oci_fetch_array($stmt, OCI_ASSOC | OCI_RETURN_NULLS)) {
         $column = new Column();
         $column->setColumnName($row['COLUMN_NAME']);
         $column->setDataType($row['DATA_TYPE']);
         $column->setDataLength($row['DATA_LENGTH']);
         $column->setIsNullable($row['NULLABLE']);
         $column->setDefaultValue($row['DATA_DEFAULT']);
         $column->setComment($row['COMMENTS']);
         $this->aColumns[] = $column;
     }
     return $this->aColumns;
 }
开发者ID:juyagu,项目名称:Analia,代码行数:26,代码来源:Table.php

示例4: _refreshColumnMetadata

 /**
  * Populates the properties that store cached dimensions and metrics,
  * either from the database or from the API directly, depending on when
  * the data that we have was last fetched.
  */
 private function _refreshColumnMetadata()
 {
     /* If we're not using a database, the best we can do is to cache the
        column metadata for the duration of this process' existence. */
     if (self::$_dbConn) {
         try {
             $lastFetchData = self::_getLastFetchData('google_analytics_api_columns');
             if ($lastFetchData) {
                 $fetchDate = (int) $lastFetchData['fetch_date'];
                 $etag = $lastFetchData['etag'];
             } else {
                 $fetchDate = null;
                 $etag = null;
             }
             $columns = null;
             $newETag = null;
             if ($this->_bypassColumnCache || !$fetchDate || $fetchDate <= time() - GOOGLE_ANALYTICS_API_METADATA_CACHE_DURATION) {
                 $this->_bypassColumnCache = false;
                 $request = new APIRequest('metadata/ga/columns');
                 if ($etag) {
                     $request->setHeader('If-None-Match: ' . $etag);
                 }
                 $columns = $this->_makeRequest($request);
                 if ($columns) {
                     $stmt = self::$_DB_STATEMENTS['google_analytics_api_columns']['insert'];
                     foreach ($columns as $column) {
                         $stmt->bindValue(':name', $column->getName(), \PDO::PARAM_STR);
                         $stmt->bindValue(':type', $column->getType(), \PDO::PARAM_STR);
                         $stmt->bindValue(':data_type', $column->getDataType(), \PDO::PARAM_STR);
                         $stmt->bindValue(':replaced_by', $column->getReplacementColumn(), \PDO::PARAM_STR);
                         $stmt->bindValue(':group', $column->getGroup(), \PDO::PARAM_STR);
                         $stmt->bindValue(':ui_name', $column->getUIName(), \PDO::PARAM_STR);
                         $stmt->bindValue(':description', $column->getDescription(), \PDO::PARAM_STR);
                         $stmt->bindValue(':calculation', $column->getCalculation(), \PDO::PARAM_STR);
                         $stmt->bindValue(':min_template_index', $column->getMinTemplateIndex(), \PDO::PARAM_INT);
                         $stmt->bindValue(':max_template_index', $column->getMaxTemplateIndex(), \PDO::PARAM_INT);
                         $stmt->bindValue(':min_template_index_premium', $column->getPremiumMinTemplateIndex(), \PDO::PARAM_INT);
                         $stmt->bindValue(':max_template_index_premium', $column->getPremiumMaxTemplateIndex(), \PDO::PARAM_INT);
                         $stmt->bindValue(':allowed_in_segments', $column->isAllowedInSegments(), \PDO::PARAM_INT);
                         $stmt->bindValue(':deprecated', $column->isDeprecated(), \PDO::PARAM_INT);
                         $stmt->execute();
                     }
                     $stmt = null;
                 }
                 if (array_key_exists('etag', $this->_responseParsed) && $this->_responseParsed['etag']) {
                     $newETag = $this->_responseParsed['etag'];
                 } else {
                     $responseHeader = $this->getResponseHeaderAsAssociativeArray();
                     if (array_key_exists('ETag', $responseHeader) && $responseHeader['ETag']) {
                         $newETag = $responseHeader['ETag'];
                     }
                 }
                 if ($newETag) {
                     self::_storeFetchData('google_analytics_api_columns', count($columns), $newETag);
                 }
             }
             if (!$columns) {
                 $columns = array();
                 $stmt = self::$_dbConn->query('SELECT * FROM google_analytics_api_columns');
                 $stmt->bindColumn('name', $name, \PDO::PARAM_STR);
                 $stmt->bindColumn('type', $type, \PDO::PARAM_STR);
                 $stmt->bindColumn('data_type', $dataType, \PDO::PARAM_STR);
                 $stmt->bindColumn('replaced_by', $replacement, \PDO::PARAM_STR);
                 $stmt->bindColumn('group', $group, \PDO::PARAM_STR);
                 $stmt->bindColumn('ui_name', $uiName, \PDO::PARAM_STR);
                 $stmt->bindColumn('description', $description, \PDO::PARAM_STR);
                 $stmt->bindColumn('calculation', $calculation, \PDO::PARAM_STR);
                 /* Null values get cast to zeros if I bind them as
                    integers, so we'll rely on the object's setter to take care
                    of the type casting. */
                 $stmt->bindColumn('min_template_index', $minTemplateIndex, \PDO::PARAM_STR);
                 $stmt->bindColumn('max_template_index', $maxTemplateIndex, \PDO::PARAM_STR);
                 $stmt->bindColumn('min_template_index_premium', $minTemplateIndexPremium, \PDO::PARAM_STR);
                 $stmt->bindColumn('max_template_index_premium', $maxTemplateIndexPremium, \PDO::PARAM_STR);
                 $stmt->bindColumn('allowed_in_segments', $allowedInSegments, \PDO::PARAM_BOOL);
                 $stmt->bindColumn('deprecated', $deprecated, \PDO::PARAM_BOOL);
                 while ($stmt->fetch(\PDO::FETCH_BOUND)) {
                     $column = new Column();
                     $column->setID('ga:' . $name);
                     $column->setReplacementColumn($replacement);
                     $column->setType($type);
                     $column->setDataType($dataType);
                     $column->setGroup($group);
                     $column->setUIName($uiName);
                     $column->setDescription($description);
                     $column->setCalculation($calculation);
                     if ($minTemplateIndex !== null) {
                         $column->setMinTemplateIndex($minTemplateIndex);
                     }
                     if ($maxTemplateIndex !== null) {
                         $column->setMaxTemplateIndex($maxTemplateIndex);
                     }
                     if ($minTemplateIndexPremium !== null) {
                         $column->setPremiumMinTemplateIndex($minTemplateIndexPremium);
                     }
//.........这里部分代码省略.........
开发者ID:performics,项目名称:ga-cli-api,代码行数:101,代码来源:API.class.php

示例5: testInsertException1

 /**
  * Record can't be inserted cause its not new
  *
  * @expectedException CDbException
  */
 public function testInsertException1()
 {
     $col2 = new Column();
     $col2->COLUMN_NAME = 'test2';
     $col2->setDataType('varchar');
     $col2->setCollation('utf8_general_ci');
     $col2->size = 250;
     $column = array($col2);
     $table = array('TABLE_SCHEMA' => 'tabletest', 'TABLE_NAME' => 'tabletest3');
     // Load column definition
     $ta = Table::model()->findByPk($table);
     $ta->insert($column);
 }
开发者ID:cebe,项目名称:chive,代码行数:18,代码来源:TableTest.php

示例6: getInternalColumns

 protected function getInternalColumns()
 {
     $columns = array();
     $columnPage = new Column();
     $columnPage->setName("TABLE_CATALOG");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(512);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("TABLE_SCHEMA");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(64);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("TABLE_NAME");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(64);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("TABLE_TYPE");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(64);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("ENGINE");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(64);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("VERSION");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("ROW_FORMAT");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(10);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("TABLE_ROWS");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("AVG_ROW_LENGTH");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("DATA_LENGTH");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("MAX_DATA_LENGTH");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("INDEX_LENGTH");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("DATA_FREE");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("AUTO_INCREMENT");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("CREATE_TIME");
     $columnPage->setDataType(DataType::DATETIME());
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("UPDATE_TIME");
     $columnPage->setDataType(DataType::DATETIME());
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("CHECK_TIME");
     $columnPage->setDataType(DataType::DATETIME());
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("TABLE_COLLATION");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(32);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("CHECKSUM");
     $columnPage->setDataType(DataType::BIGINT());
     $columnPage->setLength(21);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("CREATE_OPTIONS");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(32);
     $columns[$columnPage->getName()] = clone $columnPage;
     $columnPage->setName("TABLE_COMMENT");
     $columnPage->setDataType(DataType::VARCHAR());
     $columnPage->setLength(32);
     $columns[$columnPage->getName()] = clone $columnPage;
     return $columns;
 }
开发者ID:addiks,项目名称:phpsql,代码行数:87,代码来源:Tables.php

示例7: testAlterWrongCOLUMNNAME

 /**
  * tests to insert a new Column with wrong Name
  */
 public function testAlterWrongCOLUMNNAME()
 {
     $col = new Column();
     $col->TABLE_SCHEMA = 'columntest';
     $col->TABLE_NAME = 'test';
     $col->COLUMN_NAME = 'test \'`';
     $col->setDataType('float');
     $col->COLUMN_DEFAULT = 1;
     $col->size = 10;
     $col->scale = 5;
     $this->assertFalse($col->insert());
 }
开发者ID:cebe,项目名称:chive,代码行数:15,代码来源:ColumnTest.php


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