public function merge_table()
 {
     $limit = 2000;
     $tmptable = $this->_table . '_tmp___';
     $archivetable = $this->_table . '_archive';
     $key = $this->_pk ? $this->_pk : 'split_id';
     if (!helper_dbtool::isexisttable($archivetable)) {
         return 2;
     }
     $this->create_relatedtable($tmptable);
     $targettable = helper_dbtool::showtablecloumn($this->_table);
     $fieldstr = '`' . implode('`, `', array_keys($targettable)) . '`';
     DB::query("INSERT INTO %t ({$fieldstr}) SELECT {$fieldstr} FROM %t " . DB::limit($limit), array($tmptable, $archivetable));
     if (DB::result_first('SELECT COUNT(*) FROM %t', array($tmptable))) {
         $keylist = DB::fetch_all('SELECT ' . $key . ' FROM %t', array($tmptable), $key);
         $keylist = dimplode(array_keys($keylist));
         if (DB::query("INSERT INTO %t ({$fieldstr}) SELECT {$fieldstr} FROM %t WHERE {$key} in ({$keylist})", array($this->_table, $archivetable), false, true)) {
             DB::query("DELETE FROM %t WHERE {$key} in ({$keylist})", array($archivetable), false, true);
         }
         DB::query('DROP TABLE %t', array($tmptable));
         return 1;
     } else {
         DB::query('DROP TABLE %t', array($tmptable));
         DB::query('DROP TABLE %t', array($archivetable));
         $this->optimize();
         return 2;
     }
 }