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


PHP MySQLDatabase类代码示例

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


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

示例1: sendQuery

 /**
  * @see MySQLDatabase::sendQuery()
  */
 public function sendQuery($query, $limit = 0, $offset = 0)
 {
     $startTime = microtime(true);
     $result = parent::sendQuery($query . ($limit > 0 ? " LIMIT " . $limit . " OFFSET " . $offset : ""));
     $endTime = microtime(true);
     $this->time += $endTime - $startTime;
     return $result;
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:11,代码来源:LWMySQLDatabase.class.php

示例2: destroy

 function destroy()
 {
     // Destructor
     $this->_mainTableName = null;
     $this->_defFile->destroy();
     $this->_defFile = null;
     MySQLDatabase::destroy();
 }
开发者ID:Ethennoob,项目名称:Web,代码行数:8,代码来源:classLogDatabase.php

示例3: __construct

 public function __construct($credsVar)
 {
     $this->credsVar = $credsVar;
     $this->logQueries = defined('LOGQUERIES') && LOGQUERIES;
     $this->uniqueID = 'sqldb-' . session_id();
     if (!file_exists(MYSQLVARPATH)) {
         mkdir(MYSQLVARPATH);
     }
     MySQLDatabase::GC();
 }
开发者ID:bnorm-software,项目名称:barkeep-backend,代码行数:10,代码来源:CLASS_MySQLDatabase.php

示例4: array

<?php

global $project;
$project = 'mysite';
global $databaseConfig;
$databaseConfig = array("type" => 'MySQLDatabase', "server" => 'localhost', "username" => 'root', "password" => 'omega', "database" => 'vp', "path" => '');
MySQLDatabase::set_connection_charset('utf8');
// Set the current theme. More themes can be downloaded from
// http://www.silverstripe.org/themes/
SSViewer::set_theme('simple');
// Set the site locale
i18n::set_locale('en_US');
FulltextSearchable::enable();
// Enable nested URLs for this site (e.g. page/sub-page/)
if (class_exists('SiteTree')) {
    SiteTree::enable_nested_urls();
}
Director::set_environment_type("dev");
// add a button to remove formatting
HtmlEditorConfig::get('cms')->insertButtonsBefore('styleselect', 'removeformat');
// tell the button which tags it may remove
HtmlEditorConfig::get('cms')->setOption('removeformat_selector', 'b,strong,em,i,span,ins');
//remove font->span conversion
HtmlEditorConfig::get('cms')->setOption('convert_fonts_to_spans', 'false,');
HtmlEditorConfig::get('cms')->setOptions(array('valid_elements' => "@[id|class|style|title],#a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align|style],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],#td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|dir|class|align|style],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],@[id,style,class],small", 'extended_valid_elements' => "img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],#iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt]"));
// TinyMCE cleanup on paste
HtmlEditorConfig::get('cms')->setOption('paste_auto_cleanup_on_paste', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_remove_styles', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_remove_styles_if_webkit', 'true');
HtmlEditorConfig::get('cms')->setOption('paste_strip_class_attributes', 'true');
GD::set_default_quality(80);
开发者ID:javeriaaali,项目名称:student-org-kit,代码行数:31,代码来源:_config.php

示例5: MySQLDatabase

<?php

# Instance of MySQLDatabase
$database = new MySQLDatabase();
# Instance of Session
$session = new Session();
# Instance of User
$user = User::find_by_id($session->id);
$application_no = customDecrypt($_GET["app_no"]);
?>
<h5 align="center">Transcript Application</h5>
<hr>
<h6 align="center">All Fields are Required</h6>
<form action="" method="POST" class="application_form form-horizontal" >
    <!-- Fullname -->
    <div class="control-group">
        <label class="control-label" for="inputApplicationFormNumber">Application Number</label>
        <div class="controls">
            <div class="input-prepend">
                <span class="add-on"><i class="iconic-hash"></i></span>
                <input type="text" class="input-xlarge" required id="app_no" name="app_no" value="<?php 
if (isset($application_no)) {
    echo $application_no;
}
?>
" readonly="readonly" />
            </div>
        </div>
    </div>

    <!-- Title -->
开发者ID:Ghaji,项目名称:transcripts,代码行数:31,代码来源:transcript_application.php

示例6: MySQLDatabase

<?php

require_once '../inc/initialize.php';
$db_academic = new MySQLDatabase();
$sql_exam = "SELECT * FROM exam_id";
$result_exam = $db_academic->query($sql_exam);
while ($record = $db_academic->fetch_array($result_exam)) {
    echo '<option value="' . $record['exam_type_id'] . '">' . $record['exam_name'] . '</option>';
}
开发者ID:Ghaji,项目名称:form_application,代码行数:9,代码来源:ajax_display_exam.php

示例7: FileCache

    $zoom = $_REQUEST["zoom"];
    // Validate the input parameters
    if (is_numeric($tllon) && -180.0 <= $tllon && $tllon < 180.0 && is_numeric($tllat) && -90.0 <= $tllat && $tllat <= 90.0 && is_numeric($brlon) && -180.0 <= $brlon && $brlon < 180.0 && is_numeric($brlat) && -90.0 <= $brlat && $brlat <= 90.0 && is_numeric($zoom) && $zoom >= 0 && $zoom < 20) {
        $min_lat = $tllat < $brlat ? $tllat : $brlat;
        $max_lat = $tllat > $brlat ? $tllat : $brlat;
        $min_lon = $tllon < $brlon ? $tllon : $brlon;
        $max_lon = $tllon > $brlon ? $tllon : $brlon;
        $key = "poi_" . $min_lat . "_" . $max_lat . "_" . $min_lon . "_" . $max_lon . "_" . $zoom;
        if (strcmp($cache_type, "FileCache") == 0) {
            $cache = new FileCache();
        } else {
            $cache = new NoCache();
        }
        $xml = $cache->get($key);
        if ($xml == FALSE) {
            $db = new MySQLDatabase($hostname, $database, $username, $password);
            $db->connect();
            $poi = new POIManager($db);
            $gpx = $poi->getWpts($min_lat, $max_lat, $min_lon, $max_lon, $zoom);
            $xml = $gpx->toXml();
            $db->disconnect();
            $cache->put($key, $xml);
        }
        header("Content-type: text/xml; charset=utf-8");
        print $xml;
    } else {
        header("Content-type: text/plain; charset=utf-8");
        print "Invalid Input";
    }
} else {
    header("Content-type: text/plain; charset=utf-8");
开发者ID:hozmaster,项目名称:odopoi,代码行数:31,代码来源:api.php

示例8: getDataFromDB

 /**
  * Get settings data from DB.
  *
  * @access	private
  * @return	array
  */
 private function getDataFromDB()
 {
     $data = array();
     $query = $this->db->query("\n\t\t\tSELECT setting_name, setting_value\n\t\t\tFROM ts_system_settings\n\t\t\tORDER BY id\n\t\t");
     while (($row = $this->db->fetchAssoc($query)) != NULL) {
         $data[$row['setting_name']] = $row['setting_value'];
     }
     return $data;
 }
开发者ID:jahanzaibbahadur,项目名称:Ticket-System,代码行数:15,代码来源:Cache.php

示例9: query

 public function query($sql, $errorLevel = E_USER_ERROR)
 {
     $query = new stdClass();
     $query->query = $sql;
     $query->source = '';
     $query->count = 0;
     $trace = $this->userCaller();
     if ($trace) {
         $query->source = 'Line ' . $trace['line'] . ' in ' . $trace['file'];
     }
     $this->queryRecord[] = $query;
     if (isset($this->allQueries[$sql])) {
         $cur = isset($this->duplicateQueries[$sql]) ? $this->duplicateQueries[$sql] : $query;
         if (!isset($cur->count)) {
             $cur->query = $sql;
             $cur->count = 0;
         }
         $cur->count = $cur->count + 1;
         if ($cur->count > 2 && !isset($cur->source)) {
             // lets see where it's coming from
             $trace = $this->userCaller();
             if ($trace) {
                 $cur->source = 'Line ' . $trace['line'] . ' in ' . $trace['file'];
             }
         }
         $this->duplicateQueries[$sql] = $cur;
     }
     // mark as having executed this query
     $this->allQueries[$sql] = true;
     return parent::query($sql, $errorLevel);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-ssautesting,代码行数:31,代码来源:DevMySQLDatabase.php

示例10: query

 public function query($sql, $errorLevel = E_USER_ERROR)
 {
     if (in_array(strtolower(substr($sql, 0, strpos($sql, ' '))), $this->writeQueries)) {
         throw new Exception("Attempted to write to readonly database");
     }
     return parent::query($sql, $errorLevel);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-ssautesting,代码行数:7,代码来源:DummyReadonlyMySQLDatabase.php

示例11: setCharset

 /**
  * Sets the charset of the database connection.
  * 
  * @param	string		$charset
  */
 public function setCharset($charset)
 {
     if (function_exists('mysqli_set_charset')) {
         $this->mySQLi->set_charset($charset);
     } else {
         parent::setCharset($charset);
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:13,代码来源:MySQLiDatabase.class.php

示例12: query

 /**
  * If a write query is detected, hand it off to the configured write database
  * 
  * @param string $sql
  * @param int $errorLevel
  * @return \MySQLQuery
  */
 public function query($sql, $errorLevel = E_USER_ERROR)
 {
     if (in_array(strtolower(substr($sql, 0, strpos($sql, ' '))), $this->writeQueries) || $this->writePerformed) {
         $alternateReturn = $this->writeDb()->query($sql, $errorLevel);
         $this->writePerformed = true;
         return $alternateReturn;
     }
     return parent::query($sql, $errorLevel);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-splitdb,代码行数:16,代码来源:ReadWriteMySQLDatabase.php

示例13: __construct

 public function __construct($parameters)
 {
     if (static::$firstTime) {
         static::$firstTime = false;
         // deregister the Silverstripe exception and error handlers
         restore_exception_handler();
         restore_error_handler();
     }
     parent::__construct($parameters);
 }
开发者ID:helpfulrobot,项目名称:themonkeys-laravel-silverstripe,代码行数:10,代码来源:MySQLDatabaseWrapper.php

示例14: AddToDatabase

 public function AddToDatabase()
 {
     $this->DB->Prepare("\n\t\t\tINSERT INTO tblIngredients\n\t\t\t\t(userID, type, title, description, baseIngredientID, createStamp, modifyStamp)\n\t\t\t\tVALUES\n\t\t\t\t(:userID, :type, :title, :description, :baseIngredientID, :createStamp, :modifyStamp)\n\t\t");
     $id = $this->DB->Execute(array(":userID" => $this->Session->ID, ":type" => $this->Type, ":title" => $this->Title, ":description" => $this->Description, ":baseIngredientID" => Nullable($this->BaseIngredientID()), ":createStamp" => $this->CreateStamp, ":modifyStamp" => microtime(true)));
     if ($id) {
         $this->ID = $id;
     }
     singleLog("Created ingredient #{$id}");
     return $id;
 }
开发者ID:bnorm-software,项目名称:barkeep-backend,代码行数:10,代码来源:CLASS_Ingredient.php

示例15: query

 /**
  * 
  * @param string $sql
  * @param integer $errorLevel
  * @return SS_Query
  */
 public function query($sql, $errorLevel = E_USER_ERROR)
 {
     $query = parent::query($sql, $errorLevel);
     if (isset($_REQUEST['showqueries']) && Director::isDev()) {
         $count = 1 + (int) Config::inst()->get('MySQLDebuggableDatabase', 'queries_count');
         Config::inst()->update('MySQLDebuggableDatabase', 'queries_count', $count);
         Debug::message(PHP_EOL . 'Query Counts: ' . $count . PHP_EOL, false);
     }
     return $query;
 }
开发者ID:deviateltd,项目名称:silverstripe-cacheable,代码行数:16,代码来源:MySQLDebuggableDatabase.php


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