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


PHP SqlUtility::queryFromFile方法代码示例

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


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

示例1: run_upgrade_sql

function run_upgrade_sql($upgrade_sql_dir, $current_version, $tb_prefix = TABLE_PREFIX, $in_plain_msg = TRUE)
{
    global $progress;
    // add the ending slash '/' to the input direc
    $upgrade_sql_dir = substr($upgrade_sql_dir, -1) == '/' ? $upgrade_sql_dir : $upgrade_sql_dir . '/';
    // get a list of all update scripts minus sql extension
    $files = scandir($upgrade_sql_dir);
    foreach ($files as $file) {
        if (count($file = explode('_', $file)) == 5) {
            $file[4] = substr($file[4], 0, -3);
            $update_files[$file[2]] = $file;
        }
    }
    ksort($update_files);
    foreach ($update_files as $update_file) {
        if (version_compare($current_version, $update_file[4], '<')) {
            //update_one_ver($update_file, $_POST['tb_prefix']);
            $update_file = implode('_', $update_file);
            $sqlUtility = new SqlUtility();
            $sqlUtility->queryFromFile($upgrade_sql_dir . $update_file . 'sql', $tb_prefix, $in_plain_msg);
        }
    }
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:23,代码来源:upgrade.inc.php

示例2: queryDB

    $sql = "DELETE FROM %slanguage_text WHERE `variable`<>'_c_template' AND `variable`<>'_c_msgs'";
    queryDB($sql, array($_POST['tb_prefix']));
    $sql = "DELETE FROM %slanguages WHERE language_code<>'en'";
    queryDB($sql, array($_POST['tb_prefix']));
    // make sure English exists in the language table when upgrading
    $sql = "REPLACE INTO `%slanguages` VALUES ('en', 'utf-8', 'ltr', 'en([-_][[:alpha:]]{2})?|english', 'English', 'English', 3)";
    queryDB($sql, array($_POST['tb_prefix']));
    run_upgrade_sql(AT_INCLUDE_PATH . 'install/db', $_POST['old_version'], $_POST['tb_prefix']);
    /* reset all the accounts to English */
    $sql = "UPDATE %smembers SET language='en', creation_date=creation_date, last_login=last_login";
    queryDB($sql, array($_POST['tb_prefix']));
    /* set all the courses to 'en' as primary language if empty. added 1.4.1 */
    $sql = "UPDATE %scourses SET primary_language='en' WHERE primary_language=''";
    queryDB($sql, array($_POST['tb_prefix']));
    $sqlUtility = new SqlUtility();
    $sqlUtility->queryFromFile(AT_INCLUDE_PATH . 'install/db/atutor_language_text.sql', $_POST['tb_prefix']);
    if (!$errors) {
        print_progress($step);
        unset($_POST['submit']);
        store_steps(1);
        print_feedback($progress);
        echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">
				<input type="hidden" name="step" value="3" />
				<input type="hidden" name="upgrade_action" value="true" />';
        echo '<input type="hidden" name="db_login" value="' . urlencode($_POST['db_login']) . '" />';
        echo '<input type="hidden" name="db_password" value="' . urlencode($_POST['db_password']) . '" />';
        echo '<input type="hidden" name="db_host" value="' . $_POST['db_host'] . '" />';
        echo '<input type="hidden" name="db_name" value="' . $_POST['db_name'] . '" />';
        echo '<input type="hidden" name="db_port" value="' . $_POST['db_port'] . '" />';
        echo '<input type="hidden" name="tb_prefix" value="' . $_POST['tb_prefix'] . '" />';
        echo '<input type="hidden" name="old_version" value="' . $_POST['old_version'] . '" />';
开发者ID:genaromendezl,项目名称:ATutor,代码行数:31,代码来源:ustep2.php

示例3: runSQL

 /**
  * Run SQL defined in patch.xml
  * @access  private
  * @author  Cindy Qi Li
  */
 function runSQL()
 {
     // run sql
     // As sqlutility.class.php reads sql from a file, write sql to module content folder
     $patch_sql_file = $this->module_content_dir . '/' . $this->sql_file;
     $fp = fopen($patch_sql_file, 'w');
     fwrite($fp, trim($this->patch_array['sql']));
     fclose($fp);
     require AC_INCLUDE_PATH . 'classes/sqlutility.class.php';
     $sqlUtility = new SqlUtility();
     $sqlUtility->queryFromFile($patch_sql_file, TABLE_PREFIX);
     @unlink($patch_sql_file);
     return true;
 }
开发者ID:giuliaforsythe,项目名称:AChecker,代码行数:19,代码来源:Patch.class.php

示例4: SqlUtility

// possible values: FALSE | AT_PRIV_ADMIN | TRUE
$_admin_privilege = TRUE;
// possible values: FALSE | TRUE
/********
 * the following code is used for creating a module-specific directory.
 * it generates appropriate error messages to aid in its creation.
 */
$directory = AT_CONTENT_DIR . 'calendar';
// check if the directory is writeable
if (!is_dir($directory) && !@mkdir($directory)) {
    $msg->addError(array('MODULE_INSTALL', '<li>' . $directory . ' does not exist. Please create it.</li>'));
} else {
    if (!is_writable($directory) && @chmod($directory, 0666)) {
        $msg->addError(array('MODULE_INSTALL', '<li>' . $directory . ' is not writeable. On Unix issue the command <kbd>chmod a+rw</kbd>.</li>'));
    }
}
/******
 * the following code checks if there are any errors (generated previously)
 * then uses the SqlUtility to run any database queries it needs, ie. to create
 * its own tables.
 */
if (!$msg->containsErrors() && file_exists(dirname(__FILE__) . '/module.sql')) {
    // deal with the SQL file:
    require AT_INCLUDE_PATH . 'classes/sqlutility.class.php';
    $sqlUtility = new SqlUtility();
    /*
     * the SQL file could be stored anywhere, and named anything, "module.sql" is simply
     * a convention we're using.
     */
    $sqlUtility->queryFromFile(dirname(__FILE__) . '/module.sql', TABLE_PREFIX);
}
开发者ID:laiello,项目名称:atutor-calendar,代码行数:31,代码来源:module_install.php

示例5: SqlUtility

/* http://atutor.ca                                                     */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
// $Id$
if (!defined('AT_INSTALLER_INCLUDE_PATH') || !defined('AT_INCLUDE_PATH')) {
    exit;
}
include AT_INCLUDE_PATH . 'install/install.inc.php';
if (isset($_POST['submit'])) {
    //check DB & table connection
    $db = create_and_switch_db($_POST['db_host'], $_POST['db_port'], $_POST['db_login'], $_POST['db_password'], $_POST['tb_prefix'], $_POST['db_name'], true);
    if (!isset($errors)) {
        $sqlUtility = new SqlUtility();
        $sqlUtility->queryFromFile(AT_INCLUDE_PATH . 'install/db/atutor_schema.sql', $addslashes($_POST['tb_prefix']));
        $sqlUtility->queryFromFile(AT_INCLUDE_PATH . 'install/db/atutor_language_text.sql', $addslashes($_POST['tb_prefix']));
        if (!$errors) {
            print_progress($step);
            unset($_POST['submit']);
            unset($_POST['action']);
            store_steps($step);
            print_feedback($progress);
            echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">
			<input type="hidden" name="step" value="3" />';
            print_hidden(3);
            echo '<p align="center"><input type="submit" class="button" value="Next &raquo; " name="submit" /></p></form>';
            return;
        }
    }
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:31,代码来源:step2.php

示例6: import

 function import($language_sql_file)
 {
     // move sql import class from install/ to include/classes/
     // store the lang def'n in a .ini file and use insertLang
     // after checking if it already exists
     // use the sql class to insert the language into the db
     // check if this language exists before calling this method
     require_once AT_INCLUDE_PATH . 'classes/sqlutility.class.php';
     $sqlUtility = new SqlUtility();
     $sqlUtility->queryFromFile($language_sql_file, TABLE_PREFIX);
 }
开发者ID:genaromendezl,项目名称:ATutor,代码行数:11,代码来源:LanguageEditor.class.php

示例7: SqlUtility

                print_post_for_step9($_POST);
                echo '<p align="center"><input type="submit" class="button" value=" Next &raquo; " name="submit" /></p></form>';
                return;
            }
            $result = '';
            // Get course code to map encoding/charset
            if ($_POST['convert_type'] == 'all' || $_POST['convert_type'] == 'courses') {
                $query = "SELECT course_id, title FROM " . $_POST['tb_prefix'] . "courses";
                $result = mysql_query($query);
                if (mysql_num_rows($result) <= 0) {
                    return false;
                }
            } else {
                //'Skip' was selected, convert table structure only
                $sqlUtility = new SqlUtility();
                $sqlUtility->queryFromFile(AT_INCLUDE_PATH . 'install/db/atutor_convert_db_to_utf8.sql', $_POST['tb_prefix']);
                $progress[] = 'Database table structure has been converted to UTF-8.';
                print_feedback($progress);
                if (isset($errors)) {
                    print_errors($errors);
                    echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">
					<input type="hidden" name="step" value="3" />';
                    print_hidden(2);
                    print_post_for_step9($_POST);
                    echo '<p align="center"><input type="submit" class="button" value=" Retry " name="submit" /></p></form>';
                    return;
                }
                echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form">
					<input type="hidden" name="step" value="3" />';
                echo '<input type="hidden" name="con_step" value="4" />';
                print_hidden(2);
开发者ID:vicentborja,项目名称:ATutor,代码行数:31,代码来源:ustep7.php


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