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


PHP DBManager::tableExists方法代码示例

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


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

示例1: testGetTablesArray

 public function testGetTablesArray()
 {
     $tablename = 'test' . mt_rand();
     $this->createTableParams($tablename, array('foo' => array('name' => 'foo', 'type' => 'varchar', 'len' => '255')), array());
     $this->assertTrue($this->_db->tableExists($tablename));
     $this->dropTableName($tablename);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:DBManagerTest.php

示例2: createCustomTable

 /**
  * Creates the custom table with an id of id_c.
  *
  * @param bool $execute
  * @return string
  */
 public function createCustomTable($execute = true)
 {
     $out = '';
     if (!$this->db->tableExists($this->bean->table_name . '_cstm')) {
         $GLOBALS['log']->debug('creating custom table for ' . $this->bean->table_name);
         $idDef = array('id_c' => array('name' => 'id_c', 'type' => 'id', 'required' => 1));
         $idIdx = array('id' => array('name' => $this->bean->table_name . '_cstm_pk', 'type' => 'primary', 'fields' => array('id_c')));
         $query = $this->db->createTableSQLParams($this->bean->table_name . '_cstm', $idDef, $idIdx);
         if (!$this->db->supports('inline_keys')) {
             $indicesArr = $this->db->getConstraintSql($idIdx, $this->bean->table_name . '_cstm');
         } else {
             $indicesArr = array();
         }
         if ($execute) {
             $this->db->query($query);
             if (!empty($indicesArr)) {
                 foreach ($indicesArr as $idxq) {
                     $this->db->query($idxq);
                 }
             }
         }
         $out = $query . "\n";
         if (!empty($indicesArr)) {
             $out .= implode("\n", $indicesArr) . "\n";
         }
         $out .= $this->add_existing_custom_fields($execute);
     }
     return $out;
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:35,代码来源:DynamicField.php

示例3:

 /**
  * Delete the primary table for the module implementing the class.
  * If custom fields were added to this table/module, the custom table will be removed too, along with the cache
  * entries that define the custom fields.
  *
  */
 function drop_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("drop_tables: Metadata for table " . $this->table_name . " does not exist");
         echo "meta data absent for table " . $this->table_name . "<br>\n";
     } else {
         if (empty($this->table_name)) {
             return;
         }
         if ($this->db->tableExists($this->table_name)) {
             $this->db->dropTable($this);
         }
         if ($this->db->tableExists($this->table_name . '_cstm')) {
             $this->db->dropTableName($this->table_name . '_cstm');
             DynamicField::deleteCache();
         }
         if ($this->db->tableExists($this->get_audit_table_name())) {
             $this->db->dropTableName($this->get_audit_table_name());
         }
     }
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:29,代码来源:SugarBean.php

示例4: preflightDB

 /**
  * Check that DB settings are fine
  * @return bool
  */
 protected function preflightDB()
 {
     $check = $this->db->canInstall();
     if ($check !== true) {
         $error = array_shift($check);
         array_unshift($check, $this->translate($error));
         return $this->error(call_user_func_array('sprintf', $check), true);
     }
     $tablename = "uptest" . uniqid();
     if (!$this->db->query("CREATE TABLE {$tablename}(a int, b int)")) {
         $fail = "Table creation";
     } elseif (!$this->db->query("INSERT INTO {$tablename}(a,b) VALUES(1,2)")) {
         $fail = "Insertion";
     } elseif (!$this->db->query("UPDATE {$tablename} SET a=2 WHERE a=1")) {
         $fail = "Update";
     } elseif (!$this->db->query("DELETE FROM {$tablename} WHERE a=2")) {
         $fail = "Deletion";
     }
     if ($this->db->tableExists($tablename)) {
         if (!$this->db->query("DROP TABLE {$tablename}") && empty($fail)) {
             $fail = "Table deletion";
         }
     }
     if (!empty($fail)) {
         return $this->error("{$fail} test failed, please check DB permissions.", true);
     }
     return true;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:32,代码来源:UpgradeDriver.php


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