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


PHP DatabaseCompatibilityUtil::getTableRowsCountTotal方法代码示例

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


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

示例1: testAutoBuildUpgrade

 /**
  * @depends testAutoBuildDatabase
  */
 public function testAutoBuildUpgrade()
 {
     $this->unfreezeWhenDone = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $this->unfreezeWhenDone = true;
     }
     // adding Text Field
     $metadata = Account::getMetadata();
     $metadata['Account']['members'][] = 'newField';
     $rules = array('newField', 'type', 'type' => 'string');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'string128';
     $rules = array('string128', 'type', 'type' => 'string');
     $metadata['Account']['rules'][] = $rules;
     $rules = array('string128', 'length', 'min' => 3, 'max' => 128);
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'string555';
     $rules = array('string555', 'type', 'type' => 'string');
     $metadata['Account']['rules'][] = $rules;
     $rules = array('string555', 'length', 'min' => 1, 'max' => 555);
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'string100000';
     $rules = array('string100000', 'type', 'type' => 'string');
     $metadata['Account']['rules'][] = $rules;
     $rules = array('string100000', 'length', 'min' => 1, 'max' => 100000);
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'textField';
     $rules = array('textField', 'type', 'type' => 'text');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'longTextField';
     $rules = array('longTextField', 'type', 'type' => 'longtext');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'dateField';
     $rules = array('dateField', 'type', 'type' => 'date');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'booleanField';
     $rules = array('booleanField', 'boolean');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'integerField';
     $rules = array('integerField', 'type', 'type' => 'integer');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'dateTimeField';
     $rules = array('dateTimeField', 'type', 'type' => 'datetime');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'urlField';
     $rules = array('urlField', 'url');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'floatField';
     $rules = array('floatField', 'type', 'type' => 'float');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'longTextField';
     $rules = array('longTextField', 'type', 'type' => 'longtext');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'blobField';
     $rules = array('blobField', 'type', 'type' => 'blob');
     $metadata['Account']['rules'][] = $rules;
     $metadata['Account']['members'][] = 'longBlobField';
     $rules = array('longBlobField', 'type', 'type' => 'longblob');
     $metadata['Account']['rules'][] = $rules;
     Account::setMetadata($metadata);
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $messageLogger = new MessageLogger();
     $beforeRowCount = DatabaseCompatibilityUtil::getTableRowsCountTotal();
     InstallUtil::autoBuildDatabase($messageLogger);
     $afterRowCount = DatabaseCompatibilityUtil::getTableRowsCountTotal();
     $this->assertEquals($beforeRowCount, $afterRowCount);
     //Check Account fields
     $tableName = RedBeanModel::getTableName('Account');
     $columns = R::$writer->getColumns($tableName);
     $this->assertEquals('text', $columns['newfield']);
     $this->assertEquals('varchar(128)', $columns['string128']);
     $this->assertEquals('text', $columns['string555']);
     $this->assertEquals('longtext', $columns['string100000']);
     $this->assertEquals('text', $columns['textfield']);
     $this->assertEquals('date', $columns['datefield']);
     $this->assertEquals('tinyint(1)', $columns['booleanfield']);
     $this->assertEquals('int(11) unsigned', $columns['integerfield']);
     $this->assertEquals('datetime', $columns['datetimefield']);
     $this->assertEquals('varchar(255)', $columns['urlfield']);
     $this->assertEquals('double', $columns['floatfield']);
     $this->assertEquals('longtext', $columns['longtextfield']);
     $this->assertEquals('blob', $columns['blobfield']);
     $this->assertEquals('longblob', $columns['longblobfield']);
     $account = new Account();
     $account->name = 'Test Name';
     $account->owner = $super;
     $randomString = str_repeat("Aa", 64);
     $account->string128 = $randomString;
     $this->assertTrue($account->save());
     $metadata = Account::getMetadata();
     foreach ($metadata['Account']['rules'] as $key => $rule) {
         if ($rule[0] == 'string128' && $rule[1] == 'length') {
             $metadata['Account']['rules'][$key]['max'] = 64;
         }
     }
//.........这里部分代码省略.........
开发者ID:youprofit,项目名称:Zurmo,代码行数:101,代码来源:AutoBuildDatabaseTest.php

示例2: testGetTableRowsCountTotal

 public function testGetTableRowsCountTotal()
 {
     R::exec("create table temptesttable (temptable_id int(11) unsigned not null)");
     $tableRowsCountTotal = DatabaseCompatibilityUtil::getTableRowsCountTotal();
     $this->assertGreaterThan(0, $tableRowsCountTotal);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:6,代码来源:DatabaseCompatibilityUtilTest.php

示例3: testGetTableRowsCountTotal

 public function testGetTableRowsCountTotal()
 {
     if (RedBeanDatabase::getDatabaseType() == 'mysql') {
         $tableRowsCountTotal = DatabaseCompatibilityUtil::getTableRowsCountTotal();
         ZurmoRedBean::exec("create table if not exists temptesttable (temptable_id int(11) unsigned not null)");
         ZurmoRedBean::exec("insert into temptesttable (temptable_id) values (2)");
         ZurmoRedBean::exec("insert into temptesttable (temptable_id) values (9)");
         $tableRowsCountTotalAfterQuery = DatabaseCompatibilityUtil::getTableRowsCountTotal();
         $this->assertEquals(2, $tableRowsCountTotalAfterQuery - $tableRowsCountTotal);
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:11,代码来源:DatabaseCompatibilityUtilTest.php


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