Example #1
0
 /**
  * 判断并创建merge引擎的  broadcast表
  */
 public static function mergeBdcTable()
 {
     //首先判断是否有要联合的表
     $unionTables = self::getTables(self::$broadcastPrefix, self::$broadcastTbNum);
     if (!$unionTables) {
         return false;
     }
     //第二才能判断需不需要建立表
     if (Mcommon::isStrInFile(self::$mergeBdcFile, date('Y'))) {
         return true;
     }
     //获取修改或者创建merge表的 ddl语句
     if (self::dbobj()->single("SHOW TABLES LIKE '" . self::$broadcastPrefix . "'")) {
         $sqlStr = \Api\Plugin\Tableddlget::alterMergeDdl(self::$broadcastPrefix, $unionTables);
     } else {
         $sqlStr = \Api\Plugin\Tableddlget::broadcastMergeTableDdl(self::$broadcastPrefix, $unionTables);
     }
     return self::dbobj()->query($sqlStr);
 }
Example #2
0
 /**
  * 自动建表
  */
 public static function createQueueTable()
 {
     $sqlStr = \Api\Plugin\Tableddlget::queneStatusTableDdl(self::$queuetable);
     return self::dbobj()->query($sqlStr);
 }
Example #3
0
 /**
  * 自动建表
  */
 public static function createMessageTable($tbname)
 {
     $sql = \Api\Plugin\Tableddlget::msgTableDdl($tbname);
     return self::dbobj()->query($sql);
 }