Beispiel #1
0
function queryDeferred($sql, $run = false)
{
    static $sqls = "";
    static $sqls_len = 0;
    if ($sql) {
        $sqls .= $sql . ";";
        $sqls_len += strlen($sql) + 1;
    }
    if ($sqls_len > 1 << 18 || $run) {
        multi_query($sqls);
        $sqls = "";
        $sqls_len = 0;
    }
}
Beispiel #2
0
    $sqlstrs = array("create index reserve_ch_idx on " . $settings->tbl_prefix . RESERVE_TBL . "  (channel_disc);", "create index reserve_st_idx on " . $settings->tbl_prefix . RESERVE_TBL . "  (starttime);");
    if (multi_query($sqlstrs, $dbh)) {
        echo "予約テーブルにインデックスが作成できません\n";
    }
    // PROGRAM_TBL
    $sqlstrs = array("alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify channel_disc varchar(128) not null default 'none';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify channel_id integer not null default '0';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify type varchar(8) not null default 'GR';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify channel varchar(10) not null default '0';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify title varchar(512) not null default 'none';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify description varchar(512) not null default 'none';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify category_id integer not null default '0';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify starttime datetime not null default '1970-01-01 00:00:00';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify endtime datetime not null default '1970-01-01 00:00:00';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify program_disc varchar(128) not null default 'none';", "alter table " . $settings->tbl_prefix . PROGRAM_TBL . " modify autorec boolean not null default '1';");
    if (multi_query($sqlstrs, $dbh)) {
        echo "番組テーブルのアップデートに失敗\n";
    }
    $sqlstrs = array("create index program_ch_idx on " . $settings->tbl_prefix . PROGRAM_TBL . " (channel_disc);", "create index program_st_idx on " . $settings->tbl_prefix . PROGRAM_TBL . " (starttime);");
    if (multi_query($sqlstrs, $dbh)) {
        echo "番組テーブルにインデックスが作成できません\n";
    }
    // CHANNEL_TBL
    $sqlstrs = array("alter table " . $settings->tbl_prefix . CHANNEL_TBL . " modify type varchar(8) not null default 'GR';", "alter table " . $settings->tbl_prefix . CHANNEL_TBL . " modify channel varchar(10) not null default '0';", "alter table " . $settings->tbl_prefix . CHANNEL_TBL . " modify name varchar(512) not null default 'none';", "alter table " . $settings->tbl_prefix . CHANNEL_TBL . " modify channel_disc varchar(128) not null default 'none';", "alter table " . $settings->tbl_prefix . CHANNEL_TBL . " add sid varchar(64) not null default 'hd'");
    if (multi_query($sqlstrs, $dbh)) {
        echo "チャンネルテーブルのアップデートに失敗\n";
    }
    // CATEGORY_TBL
    $sqlstrs = array("alter table " . $settings->tbl_prefix . CATEGORY_TBL . " modify name_jp varchar(512) not null default 'none';", "alter table " . $settings->tbl_prefix . CATEGORY_TBL . " modify name_en varchar(512) not null default 'none';", "alter table " . $settings->tbl_prefix . CATEGORY_TBL . " modify category_disc varchar(128) not null default 'none'");
    if (multi_query($sqlstrs, $dbh)) {
        echo "カテゴリテーブルのアップデートに失敗\n";
    }
    // KEYWORD_TBL
    $sqlstrs = array("alter table " . $settings->tbl_prefix . KEYWORD_TBL . " modify keyword varchar(512) not null default '*';", "alter table " . $settings->tbl_prefix . KEYWORD_TBL . " modify type varchar(8) not null default '*';", "alter table " . $settings->tbl_prefix . KEYWORD_TBL . " modify channel_id integer not null default '0';", "alter table " . $settings->tbl_prefix . KEYWORD_TBL . " modify category_id integer not null default '0';", "alter table " . $settings->tbl_prefix . KEYWORD_TBL . " modify use_regexp boolean not null default '0';", "alter table " . $settings->tbl_prefix . KEYWORD_TBL . " add autorec_mode integer not null default '0';", "alter table " . $settings->tbl_prefix . KEYWORD_TBL . " add weekofday enum ('0','1','2','3','4','5','6','7' ) default '7'");
    if (multi_query($sqlstrs, $dbh)) {
        echo "キーワードテーブルのアップデートに失敗\n";
    }
} else {
    exit("DBの接続に失敗\n");
}
Beispiel #3
0
$error_connecting = false;
if (isset($_REQUEST['checked'])) {
    // Try hitting the mysql to check if this connects. If not, throw error.
    // If it connect show the proceed button, after saving the data in a proper module.
    // Create connection
    $conn = new mysqli($dburl, $dbusername, $dbpassword, $dbname);
    // Check connection
    if ($conn->connect_error) {
        $error_connecting = true;
    } else {
        // Save the data in the site table
        $sql = "INSERT INTO " . $tableprefix . "site (site_key, site_value) VALUES ('sitetitle', '" . $conn->real_escape_string($sitetitle) . "');";
        $sql .= "INSERT INTO " . $tableprefix . "site (site_key, site_value) VALUES ('sitedesc', '" . $conn->real_escape_string($sitedesc) . "');";
        $sql .= "INSERT INTO " . $tableprefix . "site (site_key, site_value) VALUES ('language', '" . $conn->real_escape_string($language) . "');";
        $sql .= "INSERT INTO " . $tableprefix . "site (site_key, site_value) VALUES ('timezone', '" . $conn->real_escape_string($timezone) . "');";
        @($result = multi_query($sql));
    }
    $conn->close();
    $saved = true;
}
// Locales
function locales()
{
    global $tableprefix;
    $locales = array();
    $result = query("SELECT locale, name FROM " . $tableprefix . "locale");
    while ($row = $result->fetch_assoc()) {
        $locales[$row['locale']] = $row['name'];
    }
    return $locales;
}