本文整理汇总了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;
}
示例2: destroy
function destroy()
{
// Destructor
$this->_mainTableName = null;
$this->_defFile->destroy();
$this->_defFile = null;
MySQLDatabase::destroy();
}
示例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();
}
示例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);
示例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 -->
示例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>';
}
示例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");
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}