本文整理汇总了PHP中mysql_thread_id函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_thread_id函数的具体用法?PHP mysql_thread_id怎么用?PHP mysql_thread_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_thread_id函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getDBCon
function getDBCon($force = 0)
{
if ($force || !isset($this->a['db_con'])) {
if (!$this->createDBCon()) {
return false;
}
}
if (!$force && !@mysql_thread_id($this->a['db_con'])) {
return $this->getDBCon(1);
}
return $this->a['db_con'];
}
开发者ID:benblamey,项目名称:cmu-teaching-php,代码行数:12,代码来源:ARC2_Store.php
示例2: sql_disconnect_slave
function sql_disconnect_slave()
{
global $opt, $db;
if ($db['dblink_slave'] === false) {
return;
}
if ($opt['db']['pconnect'] == true && $db['dblink'] !== false) {
if (count($db['temptables']) > 0) {
foreach ($db['temptables'] as $k => $table) {
if (isset($db['temptables_slave'][$table])) {
sqlf_slave("DROP TEMPORARY TABLE IF EXISTS &tmpdb.`&1`", $table);
unset($db['temptables_slave'][$table]);
unset($db['temptables'][$k]);
}
}
if (count($db['temptables_slave']) > 0) {
sqlf_slave("DELETE FROM &db.`sys_temptables` WHERE `threadid`='&1'", mysql_thread_id($db['dblink_slave']));
}
$db['temptables_slave'] = array();
}
}
if ($db['dblink'] === $db['dblink_slave']) {
$db['dblink_slave'] = false;
return;
}
//is connected and no persistent connect used?
if ($opt['db']['pconnect'] == false && $db['dblink_slave'] !== false) {
mysql_close($db['dblink_slave']);
}
$db['dblink_slave'] = false;
}
开发者ID:kirstenko,项目名称:oc-server3,代码行数:31,代码来源:db.inc.php
示例3: db_thread_id
function db_thread_id()
{
return mysql_thread_id();
}
开发者ID:skaligotla,项目名称:kplaylist,代码行数:4,代码来源:index.php
示例4: getThreadId
/**
* get thread id.
* get the mysql thread id of the current connection
* when one gets reconnected the threadid will be changed
*
* @access public
* @return void
*/
public function getThreadId()
{
if ($this->connect()) {
return mysql_thread_id($this->_connection);
}
return null;
}
开发者ID:BlackIkeEagle,项目名称:hersteldienst-devolder,代码行数:15,代码来源:MySql.php
示例5: my_mysql_connect
}
echo "Explicit connection on close\n";
$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket);
$link1_thread_id = mysql_thread_id($link);
$default1_thread_id = mysql_thread_id();
echo 'Expect same thread id for $link and default conn: ';
var_dump($link1_thread_id == $default1_thread_id);
var_dump($link);
mysql_close($link);
var_dump($link);
// we sohuld have no default link anymore
mysql_close();
echo "\nClosing default link\n";
$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket);
$link2_thread_id = mysql_thread_id($link);
$default2_thread_id = mysql_thread_id();
echo 'Expect same thread id for $link and default conn but not the previous: ';
var_dump($link1_thread_id == $default1_thread_id && $link1_thread_id != $link2_thread_id);
var_dump($link);
mysql_close();
var_dump($link);
mysql_close($link);
var_dump($link);
echo "\nExplicit resource and pconnect\n";
$link = my_mysql_pconnect($host, $user, $passwd, $db, $port, $socket);
var_dump($link);
mysql_close($link);
var_dump($link);
// we sohuld have no default link
mysql_close();
echo "\nDefault link and pconnect\n";
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:bug48754.php
示例6: mysql_connect
<?php
require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(mysql_thread_id() > 0);
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:mysql_thread_id.php
示例7: threadId
function threadId()
{
/* 返回当前线程的 ID */
return mysql_thread_id($this->LinkId);
}
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:5,代码来源:db.php
示例8: sprintf
include "table.inc";
if ($socket) {
$myhost = sprintf("%s:%s", $host, $socket);
} else {
if ($port) {
$myhost = sprintf("%s:%s", $host, $port);
} else {
$myhost = $host;
}
}
if (!($plink = mysql_pconnect($myhost, $user, $passwd))) {
printf("[001] Cannot connect to the server using host=%s/%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $myhost, $user, $db, $port, $socket);
}
mysql_select_db($db, $plink);
$pthread_id = mysql_thread_id($plink);
$thread_id = mysql_thread_id($link);
if (!($res = mysql_query("SHOW FULL PROCESSLIST", $link))) {
printf("[002] Cannot get processlist, [%d] %s\n", mysql_errno($link), mysql_error($link));
}
$processlist = array();
while ($row = mysql_fetch_assoc($res)) {
$processlist[$row['Id']] = $row;
}
mysql_free_result($res);
if (!isset($processlist[$thread_id])) {
printf("[003] Cannot find regular connection thread in process list, [%d] %s\n", mysql_errno($link), mysql_error($link));
}
if (!isset($processlist[$pthread_id])) {
printf("[004] Cannot find persistent connection thread in process list, [%d] %s\n", mysql_errno($link), mysql_error($link));
}
if (!mysql_query(sprintf("KILL %d", $pthread_id), $link)) {
开发者ID:alphaxxl,项目名称:hhvm,代码行数:31,代码来源:mysql_pconn_kill.php
示例9: end_query
/**
* stores query, filenames, errors in TradeBanqDb::queries and TradeBanqDb::errors
* @param string $query
* @return void
*/
private function end_query($query, $records = 0)
{
if ($this->enable_log) {
$error = mysql_error();
$this->queries[] = array('start' => date("Y-m-d H:i:s"), 'query' => $query, 'records' => $records, 'time' => microtime(true) - $this->start_time, 'error' => $error, 'connection' => $this->last_connection_used && $this->master_connection && mysql_thread_id($this->last_connection_used) == mysql_thread_id($this->master_connection) ? "master" : "slave");
}
$this->start_time = 0;
}
开发者ID:badaraftab,项目名称:haisum.github.io,代码行数:13,代码来源:Db.class.php
示例10: getThreadId
/**
* Retrieve the current thread id
*
* @return @e integer
*/
public function getThreadId()
{
return mysql_thread_id($this->connection_id);
}
开发者ID:mover5,项目名称:imobackup,代码行数:9,代码来源:classDbMysqlClient.php
示例11: printf
printf("FAILURE: [%d] %s\n", mysql_errno(), mysql_error());
} else {
print "SUCCESS: connect\n";
}
if (!mysql_select_db($db, $con)) {
printf("FAILURE: [%d] %s\n", mysql_errno($con), mysql_error($con));
}
$id_default = mysql_thread_id();
$id_con = mysql_thread_id($con);
if ($id_default != $id_con) {
printf("FAILURE: Different values for default and specified connection\n");
}
if (!is_int($id_con)) {
printf("FAILURE: Function should have returned an integer value, got %s value\n", gettype($id_con));
}
$id_con = mysql_thread_id($illegal_link_identifier);
if (!is_null($id_con)) {
printf("FAILURE: Function should have returned a NULL value, got %s value\n", gettype($id_con));
}
if ($id_con !== NULL) {
printf("FAILURE: Should return NULL because of illegal link identifier\n");
}
mysql_close($con);
?>
--EXPECT-EXT/MYSQL-OUTPUT--
SUCCESS: connect
--EXPECT-EXT/MYSQL-PHP-ERRORS--
--EXPECT-EXT/MYSQLI-OUTPUT--
SUCCESS: connect
开发者ID:josenobile,项目名称:MySQLConverterTool,代码行数:30,代码来源:conn_param005.php
示例12: startTimer
/**
* Starts a timer which will kill the DB thread after $timeout seconds
*/
function startTimer($timeout)
{
global $IP;
if (function_exists('mysql_thread_id')) {
# This will kill the query if it's still running after $timeout seconds.
$tid = mysql_thread_id($this->mConn);
exec("php {$IP}/includes/killthread.php {$timeout} {$tid} &>/dev/null &");
}
}
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:12,代码来源:Database.php
示例13: printf
<?php
require_once "connect.inc";
require_once "table.inc";
if ($plink = my_mysql_connect($host, $user, $passwd, $db, $port, $socket, NULL, true)) {
printf("[001] Can connect to the server.\n");
}
if (($res = mysql_query('SELECT id FROM test ORDER BY id ASC', $plink)) && ($row = mysql_fetch_assoc($res)) && mysql_free_result($res)) {
printf("[002] Can fetch data using persistent connection! Data = '%s'\n", $row['id']);
}
$thread_id = mysql_thread_id($plink);
mysql_close($plink);
if (!($plink = my_mysql_connect($host, $user, $passwd, $db, $port, $socket, NULL, true))) {
printf("[003] Cannot connect, [%d] %s\n", mysql_errno(), mysql_error());
}
if (mysql_thread_id($plink) != $thread_id) {
printf("[004] Looks like the second call to pconnect() did not give us the same connection.\n");
}
$thread_id = mysql_thread_id($plink);
mysql_close($plink);
if (!($plink = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))) {
printf("[005] Cannot connect, [%d] %s\n", mysql_errno(), mysql_error());
}
if (mysql_thread_id($plink) == $thread_id) {
printf("[006] Looks like connect() did not return a new connection.\n");
}
print "done!";
require_once "clean_table.inc";
开发者ID:alphaxxl,项目名称:hhvm,代码行数:28,代码来源:mysql_pconn_disable.php
示例14: mysql_free_result
}
mysql_free_result($res);
var_dump($row);
// change the password for the second DB user and kill the persistent connection
if (!($res = mysql_query("SELECT CURRENT_USER() AS _user", $link))) {
printf("[006] [%d] %s", mysql_errno($link), mysql_error($link));
}
$row = mysql_fetch_assoc($res);
mysql_free_result($res);
$host = substr($row['_user'], strrpos($row['_user'], "@") + 1, strlen($row['_user']));
$sql = sprintf('SET PASSWORD FOR pcontest@"%s" = PASSWORD("newpass")', mysql_real_escape_string($host, $link));
if (!mysql_query($sql, $link)) {
printf("[007] Cannot change PW of second DB user, [%d] %s\n", mysql_errno($link), mysql_error($link));
}
// persistent connections cannot be closed but only be killed
$pthread_id = mysql_thread_id($plink);
if (!mysql_query(sprintf('KILL %d', $pthread_id), $link)) {
printf("[008] Cannot KILL persistent connection of second DB user, [%d] %s\n", mysql_errno($link), mysql_error($link));
}
// give the server a second to really kill the thread
sleep(1);
if (!($res = mysql_query("SHOW FULL PROCESSLIST", $link))) {
printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link));
}
$running_threads = array();
while ($row = mysql_fetch_assoc($res)) {
$running_threads[$row['Id']] = $row;
}
mysql_free_result($res);
if (isset($running_threads[$pthread_id])) {
printf("[010] Persistent connection has not been killed\n");
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:mysql_pconn_max_links.php
示例15: MySQL_Pconnect_Test
/**
* Test pconnect
*
* @return boolean
*/
public function MySQL_Pconnect_Test()
{
// We need to make sure that the connection ids are the same
$lastMySQLId = false;
$lastOurId = false;
for ($x = 0; $x <= 5; $x++) {
// Connect
$mysql = mysql_pconnect(TEST_HOST, TEST_USER, TEST_PASS);
$ourDb = $this->_object->mysql_pconnect(TEST_HOST, TEST_USER, TEST_PASS);
// Keep track of resource
$this->_cached[] = $mysql;
// Get thread ids
$thisMySQLId = mysql_thread_id();
$thisOurId = $this->_object->mysql_thread_id();
// Get original ids if not set
if ($lastMySQLId == false) {
$lastMySQLId = $thisMySQLId;
$lastOurId = $thisOurId;
}
// Keep checking that the ids are the same
if ($thisMySQLId !== $lastMySQLId || $thisOurId !== $lastOurId) {
return false;
}
}
return true;
}
开发者ID:ReKungPaw,项目名称:mysql,代码行数:31,代码来源:MySQL_Test.php
示例16: getThreadId
protected function getThreadId()
{
return mysql_thread_id($this->db_Conn);
}
开发者ID:rasuldev,项目名称:torino,代码行数:4,代码来源:database_mysql.php
示例17: printf
<?php
include_once "connect.inc";
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysql_thread_id($link))) {
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
require 'table.inc';
if (!is_int($id = mysql_thread_id($link)) || 0 === $id) {
printf("[002] Expecting int/any but zero, got %s/%s. [%d] %s\n", gettype($id), $id, mysql_errno($link), mysql_error($link));
}
if (!is_int($id_def = mysql_thread_id()) || 0 === $id_def) {
printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n", gettype($id_def), $id_def, mysql_errno(), mysql_error());
}
assert($id === $id_def);
mysql_close($link);
if (false !== ($tmp = mysql_thread_id($link))) {
printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
}
print "done!";
开发者ID:badlamer,项目名称:hhvm,代码行数:21,代码来源:mysql_thread_id.php
示例18: search_updatelist
function search_updatelist($options = '')
{
global $win32, $setctl, $bd, $runinit;
kprintheader(get_lang(17), 1, 0);
$updateall = false;
@ini_set('output_buffering', '1');
if (isset($options['deleteunused'])) {
$deleteunused = 1;
} else {
$deleteunused = 0;
}
if (isset($options['debugmode'])) {
$debugmode = 1;
} else {
$debugmode = 0;
}
if (isset($options['sleeppertrans'])) {
$sleeptrans = $options['sleeppertrans'];
} else {
$sleeptrans = 0;
}
if (isset($options['rebuildid3'])) {
$updateall = true;
}
$setctl->publish('updusecache');
$setctl->publish('followsymlinks');
$db_out = $db_mtime = $db_unique = $db_path = array();
$filecntr = 0;
$file = '';
$fixurl = 'http://www.kplaylist.net/forum/viewtopic.php?p=3672';
echo '<font class="notice">' . get_lang(296, '<a href="' . $fixurl . '" target="_blank">' . $fixurl . '</a>') . '</font><br/><br/>';
echo '<font class="notice">' . get_lang(136) . '..</font><br/>';
flush();
$data = array();
$datacnt = 0;
if ($debugmode) {
@ini_set('display_errors', 'On');
echo '<!-- update debug step 0 - mem limit detected: ' . @ini_get('memory_limit') . ' -->';
}
$kqm = new kq_Measure();
$kqm->start();
echo '<br/><div id="up_status2" class="notice"></div>';
echo '<br/><div id="up_status" class="notice"></div><br/>';
$cnt = 0;
if ($runinit['astream']) {
if (!updaterunning()) {
$setctl->set('updatemid', mysql_thread_id());
} else {
die('Another update is currently running.');
}
}
for ($i = 0, $c = $bd->getcnt(); $i < $c; $i++) {
if ($bd->gtype($i) == 'l') {
$grabdata = array();
if ($debugmode) {
echo '<!-- update debug step 1 - grabbing filelist from ' . $bd->getpath($i) . ' -->';
}
$stripc = strlen($bd->getpath($i));
GetDirArray($bd->getpath($i), $grabdata, $cnt, $stripc);
$data[$i] = $grabdata;
$datacnt += count($data[$i]);
}
}
if ($debugmode) {
echo '<!-- update debug step 2 -->';
}
if ($datacnt > 0) {
$result = db_execquery('SELECT count(*) FROM ' . TBL_SEARCH . ' WHERE xid = 0');
$row = mysql_fetch_row($result);
$dbrows = $row[0];
$result = db_execquery('SELECT fsize, id, md5, fname, drive, mtime, fpath FROM ' . TBL_SEARCH . ' WHERE xid = 0 ORDER BY id ASC', true);
$dcntr = 0;
updateup_status(get_lang(314, $dcntr, $dbrows));
while ($row = mysql_fetch_row($result)) {
if (UPDUSECACHE) {
$db_out[$dcntr] = $row;
} else {
$db_out[$dcntr] = array($row[0], $row[1]);
}
if ($dcntr % 50 == 0) {
updateup_status(get_lang(314, $dcntr, $dbrows));
}
if (!isset($db_mtime[$row[0]][$row[5]])) {
$db_mtime[$row[0]][$row[5]] = $dcntr;
}
if (!isset($db_unique[$row[0]][$row[2]])) {
$db_unique[$row[0]][$row[2]] = $dcntr;
}
if (strlen($row[6]) != 0 || strlen($row[3]) != 0) {
$path = crc32($row[6] . $row[3]);
if (isset($db_path[$path])) {
$ids = $db_path[$path];
$ids[] = $dcntr;
$db_path[$path] = $ids;
} else {
$db_path[$path] = array($dcntr);
}
}
$dcntr++;
}
//.........这里部分代码省略.........
开发者ID:Git-Host,项目名称:AMPPS,代码行数:101,代码来源:index.php
注:本文中的mysql_thread_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论