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


PHP Test::get_mysql_table方法代码示例

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


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

示例1: start_new

 public static function start_new($wid, $test_id, $debug = false)
 {
     $session = new TestSession();
     $session->Test_id = $test_id;
     $session->debug = $debug ? 1 : 0;
     $session->UserWorkspace_id = $wid;
     $lid = $session->mysql_save();
     $session = TestSession::from_mysql_id($lid);
     if (!$debug) {
         $sql = sprintf("UPDATE `%s` SET `session_count`=`session_count`+1 WHERE `%s`.`id`=%d", Test::get_mysql_table(), Test::get_mysql_table(), $test_id);
         mysql_query($sql);
     }
     $test = $session->get_Test();
     if ($test != null) {
         posix_mkfifo($session->get_RSession_fifo_path(), 0774);
     }
     if ($debug) {
         $session->register();
     }
     return $session;
 }
开发者ID:JerzyM,项目名称:concerto-platform,代码行数:21,代码来源:TestSession.php

示例2: start_new

 public static function start_new($test_id, $debug = false)
 {
     $session = new TestSession();
     $session->Test_id = $test_id;
     $session->debug = $debug ? 1 : 0;
     $test = Test::from_mysql_id($test_id);
     if ($test != null) {
         $loader = $test->get_loader_Template();
         if ($loader != null) {
             $session->loader_Template_id = $loader->id;
             $session->loader_HTML = $loader->HTML;
             $session->loader_head = $loader->head;
             $session->loader_effect_hide = $loader->effect_hide;
             $session->loader_effect_hide_options = $loader->effect_hide_options;
             $session->loader_effect_show = $loader->effect_show;
             $session->loader_effect_show_options = $loader->effect_show_options;
         }
     }
     $lid = $session->mysql_save();
     $sql = sprintf("UPDATE `%s` SET `session_count`=`session_count`+1 WHERE `%s`.`id`=%d", Test::get_mysql_table(), Test::get_mysql_table(), $test_id);
     mysql_query($sql);
     $session = TestSession::from_mysql_id($lid);
     if ($debug) {
         $session->register();
     }
     return $session;
 }
开发者ID:Abuamany,项目名称:concerto-platform,代码行数:27,代码来源:TestSession.php

示例3: update_db

 public static function update_db($simulate = false, $only_recalculate_hash = false, $only_create_db = false)
 {
     require '../Ini.php';
     $ini = new Ini();
     if ($only_create_db) {
         return Ini::create_db_structure();
     }
     if ($only_recalculate_hash) {
         foreach (User::get_all_db() as $db) {
             mysql_select_db($db);
             OModule::calculate_all_xml_hashes();
         }
         return json_encode(array("result" => 0));
     }
     $versions_to_update = array();
     $previous_version = Setting::get_setting("version");
     if ($previous_version == null) {
         $previous_version = Ini::$version;
     }
     $recalculate_hash = false;
     if (Setup::does_patch_apply("4.0.0.beta2", $previous_version)) {
         if ($simulate) {
             array_push($versions_to_update, "4.0.0.beta2");
         } else {
             //RDoc.HTML should be larger
             $sql = "ALTER TABLE `" . Ini::$db_master_name . "`.`RDoc` CHANGE `HTML` `HTML` mediumtext NOT NULL;";
             if (!mysql_query($sql)) {
                 return json_encode(array("result" => 1, "param" => $sql));
             }
             //names should be unique
             $tables = array("Test", "Template", "Table", "QTIAssessmentItem");
             foreach (User::get_all_db() as $db) {
                 foreach ($tables as $table) {
                     $sql = sprintf("SELECT `name` , COUNT(  `name` ) AS `c`\r\n                            FROM  `%s`.`%s` \r\n                            GROUP BY `name` \r\n                            HAVING `c`>1", $db, $table);
                     $z = mysql_query($sql);
                     if (!$z) {
                         return json_encode(array("result" => 1, "param" => $sql));
                     }
                     while ($r = mysql_fetch_array($z)) {
                         $sql = sprintf("UPDATE `%s`.`%s` SET `name`=CONCAT(`name`,'_',`id`) WHERE `name`='%s'", $db, $table, mysql_real_escape_string($r[0]));
                         if (!mysql_query($sql)) {
                             return json_encode(array("result" => 1, "param" => $sql));
                         }
                     }
                     //change object name column to unique
                     $sql = sprintf("ALTER TABLE `%s`.`%s` CHANGE  `name`  `name` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL", $db, $table);
                     if (!mysql_query($sql)) {
                         return json_encode(array("result" => 1, "param" => $sql));
                     }
                     $sql = sprintf("ALTER TABLE  `%s`.`%s` ADD UNIQUE ( `name` )", $db, $table);
                     if (!mysql_query($sql)) {
                         return json_encode(array("result" => 1, "param" => $sql));
                     }
                 }
                 //add TestSession new columns
                 $sql = sprintf("SHOW COLUMNS FROM `%s`.`%s` WHERE `Field`='effect_show'", $db, TestSession::get_mysql_table());
                 $z = mysql_query($sql);
                 if (mysql_num_rows($z) == 0) {
                     $sql = sprintf("ALTER TABLE `%s`.`%s` ADD  `effect_show` TEXT NOT NULL", $db, TestSession::get_mysql_table());
                     if (!mysql_query($sql)) {
                         return json_encode(array("result" => 1, "param" => $sql));
                     }
                 }
                 $sql = sprintf("SHOW COLUMNS FROM `%s`.`%s` WHERE `Field`='effect_hide'", $db, TestSession::get_mysql_table());
                 $z = mysql_query($sql);
                 if (mysql_num_rows($z) == 0) {
                     $sql = sprintf("ALTER TABLE `%s`.`%s` ADD  `effect_hide` TEXT NOT NULL", $db, TestSession::get_mysql_table());
                     if (!mysql_query($sql)) {
                         return json_encode(array("result" => 1, "param" => $sql));
                     }
                 }
                 $sql = sprintf("SHOW COLUMNS FROM `%s`.`%s` WHERE `Field`='effect_show_options'", $db, TestSession::get_mysql_table());
                 $z = mysql_query($sql);
                 if (mysql_num_rows($z) == 0) {
                     $sql = sprintf("ALTER TABLE `%s`.`%s` ADD  `effect_show_options` TEXT NOT NULL", $db, TestSession::get_mysql_table());
                     if (!mysql_query($sql)) {
                         return json_encode(array("result" => 1, "param" => $sql));
                     }
                 }
                 $sql = sprintf("SHOW COLUMNS FROM `%s`.`%s` WHERE `Field`='effect_hide_options'", $db, TestSession::get_mysql_table());
                 $z = mysql_query($sql);
                 if (mysql_num_rows($z) == 0) {
                     $sql = sprintf("ALTER TABLE `%s`.`%s` ADD  `effect_hide_options` TEXT NOT NULL", $db, TestSession::get_mysql_table());
                     if (!mysql_query($sql)) {
                         return json_encode(array("result" => 1, "param" => $sql));
                     }
                 }
                 $sql = sprintf("SHOW COLUMNS FROM `%s`.`%s` WHERE `Field`='loader_HTML'", $db, TestSession::get_mysql_table());
                 $z = mysql_query($sql);
                 if (mysql_num_rows($z) == 0) {
                     $sql = sprintf("ALTER TABLE `%s`.`%s` ADD  `loader_HTML` TEXT NOT NULL", $db, TestSession::get_mysql_table());
                     if (!mysql_query($sql)) {
                         return json_encode(array("result" => 1, "param" => $sql));
                     }
                 }
                 $sql = sprintf("SHOW COLUMNS FROM `%s`.`%s` WHERE `Field`='loader_head'", $db, TestSession::get_mysql_table());
                 $z = mysql_query($sql);
                 if (mysql_num_rows($z) == 0) {
                     $sql = sprintf("ALTER TABLE `%s`.`%s` ADD  `loader_head` TEXT NOT NULL", $db, TestSession::get_mysql_table());
                     if (!mysql_query($sql)) {
//.........这里部分代码省略.........
开发者ID:Abuamany,项目名称:concerto-platform,代码行数:101,代码来源:Setup.php

示例4: array

            <div align="center"><img src="cms/css/img/logo.png" /> v<?php 
echo Ini::$version;
?>
</div>
            <div align="center">
                <div style="display: table;">
                    <fieldset class="ui-widget-content">
                        <legend>available tests</legend>
                        <select id="selectTest" class="ui-widget-content" onchange="Concerto.selectTest()">
                            <option value="0">&lt;none selected&gt;</option>
                            <?php 
$query = array();
$sql = sprintf("SELECT `id`,`db_name` FROM `%s`.`%s`", Ini::$db_master_name, UserWorkspace::get_mysql_table());
$z = mysql_query($sql);
while ($r = mysql_fetch_array($z)) {
    $sql = sprintf("(SELECT `id`,%s as `wid`,`name` FROM `%s`.`%s` WHERE `type`=1)", $r['id'], $r['db_name'], Test::get_mysql_table());
    array_push($query, $sql);
}
$query = implode(" UNION ", $query) . " ORDER BY `name` ASC";
$z = mysql_query($query);
while ($r = mysql_fetch_array($z)) {
    ?>
                                <option value="<?php 
    echo $r['id'];
    ?>
" workspace="<?php 
    echo $r["wid"];
    ?>
"><?php 
    echo $r['name'];
    ?>
开发者ID:JerzyM,项目名称:concerto-platform,代码行数:31,代码来源:index.php

示例5: mysql_delete

 public function mysql_delete()
 {
     $this->clear_object_links(UserType::get_mysql_table(), "Owner_id");
     $this->clear_object_links(UserGroup::get_mysql_table(), "Owner_id");
     $this->clear_object_links(Template::get_mysql_table(), "Owner_id");
     $this->clear_object_links(Table::get_mysql_table(), "Owner_id");
     $this->clear_object_links(Test::get_mysql_table(), "Owner_id");
     $this->clear_object_links(CustomSection::get_mysql_table(), "Owner_id");
     $this->mysql_delete_object();
 }
开发者ID:Abuamany,项目名称:concerto-platform,代码行数:10,代码来源:User.php


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