function upper_table() { global $wpdb; $table_name = $wpdb->prefix . "upper_winds"; if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) { $sql = "CREATE TABLE {$table_name}( \r\n\t`LVL` VARCHAR(4) NOT NULL, \r\n\t`REGION` TEXT NOT NULL, \r\n\t`VALID` INT NOT NULL, \r\n\t`CURRENT` TEXT NOT NULL \r\n\t);"; //reference to upgrade.php file require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($sql); load_table(); } }
function load_codeCommentInfoTable($db, $prodName) { $tableArr = load_prodTableNameMapInfoTable($db); if (!array_key_exists($prodName, $tableArr)) { set_db_result(1, "错误:产品{$prodName} 没有对应的表, 请在配置页面中创建!"); return array(); } $tableName = $tableArr[$prodName]; return load_table($db, $tableName); }