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


PHP CM_Db_Db::describeColumn方法代码示例

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


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

示例1: testDescribeColumnThrowsException

    public function testDescribeColumnThrowsException()
    {
        CM_Db_Db::exec('
			CREATE TABLE `test2` (
				`id` int(12) unsigned NOT NULL AUTO_INCREMENT,
				PRIMARY KEY (`id`)
			)');
        try {
            CM_Db_Db::describeColumn('test2', 'id');
            CM_Db_Db::describeColumn('test2', 'id1');
            $this->fail('Column doesn\'t exist');
        } catch (CM_Db_Exception $e) {
            $this->assertContains('`id1`', $e->getMessage());
        }
        try {
            CM_Db_Db::describeColumn('test_', 'id');
            $this->fail('Table doesn\'t exist');
        } catch (CM_Db_Exception $e) {
            $this->assertContains('`id`', $e->getMessage());
        }
        CM_Db_Db::exec('DROP TABLE `test2`');
    }
开发者ID:NicolasSchmutz,项目名称:cm,代码行数:22,代码来源:DbTest.php

示例2: testDescribeColumnThrowsException

    public function testDescribeColumnThrowsException()
    {
        CM_Db_Db::exec('
			CREATE TABLE `test2` (
				`id` INT(12) UNSIGNED NOT NULL AUTO_INCREMENT,
				PRIMARY KEY (`id`)
			)');
        try {
            CM_Db_Db::describeColumn('test2', 'id');
            CM_Db_Db::describeColumn('test2', 'id1');
            $this->fail('Column doesn\'t exist');
        } catch (CM_Db_Exception $e) {
            $this->assertSame('Column not found', $e->getMessage());
            $this->assertSame(['column' => 'id1'], $e->getMetaInfo());
        }
        try {
            CM_Db_Db::describeColumn('test_', 'id');
            $this->fail('Table doesn\'t exist');
        } catch (CM_Db_Exception $e) {
            $this->assertContains('`id`', $e->getMetaInfo()['query']);
        }
        CM_Db_Db::exec('DROP TABLE `test2`');
    }
开发者ID:cargomedia,项目名称:cm,代码行数:23,代码来源:DbTest.php

示例3: decimal

<?php

if ('1.00' === CM_Db_Db::describeColumn('cm_splittestVariation_fixture', 'conversionWeight')->getDefaultValue()) {
    CM_Db_Db::exec('ALTER TABLE cm_splittestVariation_fixture
      MODIFY COLUMN conversionWeight decimal(10,2) NOT NULL DEFAULT 0');
    CM_Db_Db::update('cm_splittestVariation_fixture', array('conversionWeight' => 0), array('conversionStamp' => null));
}
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:39.php

示例4: int

<?php

// To be run in prod beforehand:
// pt-online-schema-change --execute --charset=utf8 --user=root --ask-pass --database=skadate t=cm_user --alter='CHANGE `site` `site` int(10) unsigned DEFAULT NULL'
if ('INT' !== CM_Db_Db::describeColumn('cm_user', 'site')->getType()) {
    CM_Db_Db::exec("ALTER TABLE `cm_user` CHANGE `site` `site` int(10) unsigned DEFAULT NULL;");
}
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:42.php

示例5: INT

<?php

if (!CM_Db_Db::describeColumn('cm_stream_subscribe', 'allowedUntil')->getAllowNull()) {
    CM_Db_Db::exec("ALTER TABLE cm_stream_subscribe CHANGE allowedUntil allowedUntil INT(10) UNSIGNED DEFAULT NULL");
}
if (!CM_Db_Db::describeColumn('cm_stream_publish', 'allowedUntil')->getAllowNull()) {
    CM_Db_Db::exec("ALTER TABLE cm_stream_publish CHANGE allowedUntil allowedUntil INT(10) UNSIGNED DEFAULT NULL");
}
开发者ID:cargomedia,项目名称:cm,代码行数:8,代码来源:64.php

示例6: int

<?php

if (CM_Db_Db::describeColumn('cm_stream_publish', 'allowedUntil')->getAllowNull()) {
    CM_Db_Db::exec('ALTER TABLE `cm_stream_publish` CHANGE `allowedUntil` `allowedUntil` int(10) unsigned NOT NULL');
}
if (CM_Db_Db::describeColumn('cm_stream_subscribe', 'allowedUntil')->getAllowNull()) {
    CM_Db_Db::exec('ALTER TABLE `cm_stream_subscribe` CHANGE `allowedUntil` `allowedUntil` int(10) unsigned NOT NULL');
}
开发者ID:cargomedia,项目名称:cm,代码行数:8,代码来源:17.php

示例7: INT

<?php

if (!CM_Db_Db::describeColumn('cm_streamChannelArchive_video', 'userId')->getAllowNull()) {
    CM_Db_Db::exec('ALTER TABLE  `cm_streamChannelArchive_video` CHANGE  `userId`  `userId` INT( 10 ) UNSIGNED NULL ;');
}
开发者ID:cargomedia,项目名称:cm,代码行数:5,代码来源:19.php


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