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


PHP mysqli_thread_id函数代码示例

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


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

示例1: poll_async

function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax)
{
    if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000))) {
        printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", $offset, $exp_ready, $tmp);
    }
    foreach ($links as $mysqli) {
        if ($use_oo_syntax) {
            $res = $mysqli->reap_async_query();
        } else {
            $res = mysqli_reap_async_query($mysqli);
        }
        if (is_object($res)) {
            printf("[%03d + 2] %s\n", $offset, var_export($res->fetch_assoc(), true));
        } else {
            if (mysqli_errno($mysqli) > 0) {
                printf("[%03d + 3] Error indicated through links array: %d/%s", $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
            } else {
                printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
            }
        }
    }
    foreach ($errors as $mysqli) {
        printf("[%03d + 5] Error on %d: %d/%s\n", $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
    }
    foreach ($reject as $mysqli) {
        printf("[%03d + 6] Rejecting thread %d: %d/%s\n", $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
    }
}
开发者ID:zaky-92,项目名称:php-1,代码行数:28,代码来源:ext_mysqli_tests_mysqli_reap_async_query.php

示例2: dump_properties

function dump_properties($mysqli)
{
    printf("\nClass variables:\n");
    $variables = array_keys(get_class_vars(get_class($mysqli)));
    sort($variables);
    foreach ($variables as $k => $var) {
        printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
    }
    printf("\nObject variables:\n");
    $variables = array_keys(get_object_vars($mysqli));
    foreach ($variables as $k => $var) {
        printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
    }
    printf("\nMagic, magic properties:\n");
    assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows);
    printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n", @$mysqli->affected_rows, gettype(@$mysqli->affected_rows), @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli)));
    assert(@mysqli_get_client_info() === @$mysqli->client_info);
    printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n", @$mysqli->client_info, gettype(@$mysqli->client_info), @mysqli_get_client_info(), gettype(@mysqli_get_client_info()));
    assert(@mysqli_get_client_version() === @$mysqli->client_version);
    printf("mysqli->client_version =  '%s'/%s ('%s'/%s)\n", @$mysqli->client_version, gettype(@$mysqli->client_version), @mysqli_get_client_version(), gettype(@mysqli_get_client_version()));
    assert(@mysqli_errno($mysqli) === @$mysqli->errno);
    printf("mysqli->errno = '%s'/%s ('%s'/%s)\n", @$mysqli->errno, gettype(@$mysqli->errno), @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli)));
    assert(@mysqli_error($mysqli) === @$mysqli->error);
    printf("mysqli->error = '%s'/%s ('%s'/%s)\n", @$mysqli->error, gettype(@$mysqli->error), @mysqli_error($mysqli), gettype(@mysqli_error($mysqli)));
    assert(@mysqli_field_count($mysqli) === @$mysqli->field_count);
    printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", @$mysqli->field_count, gettype(@$mysqli->field_count), @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli)));
    assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id);
    printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", @$mysqli->insert_id, gettype(@$mysqli->insert_id), @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli)));
    assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate);
    printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", @$mysqli->sqlstate, gettype(@$mysqli->sqlstate), @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli)));
    assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info);
    printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", @$mysqli->host_info, gettype(@$mysqli->host_info), @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli)));
    /* note that the data types are different */
    assert(@mysqli_info($mysqli) == @$mysqli->info);
    printf("mysqli->info = '%s'/%s ('%s'/%s)\n", @$mysqli->info, gettype(@$mysqli->info), @mysqli_info($mysqli), gettype(@mysqli_info($mysqli)));
    assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id);
    assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli)));
    printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", @$mysqli->thread_id, gettype(@$mysqli->thread_id), @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli)));
    assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version);
    printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", @$mysqli->protocol_version, gettype(@$mysqli->protocol_version), @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli)));
    assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info);
    printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", @$mysqli->server_info, gettype(@$mysqli->server_info), @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli)));
    assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version);
    printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", @$mysqli->server_version, gettype(@$mysqli->server_version), @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli)));
    assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count);
    printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", @$mysqli->warning_count, gettype(@$mysqli->warning_count), @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli)));
    printf("\nAccess to undefined properties:\n");
    printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
    @($mysqli->unknown = 13);
    printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
    $unknown = 'friday';
    @($mysqli->unknown = $unknown);
    printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
    printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
    assert(@mysqli_connect_error() === @$mysqli->connect_error);
    printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_error, gettype(@$mysqli->connect_error), @mysqli_connect_error(), gettype(@mysqli_connect_error()));
    assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
    printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_errno, gettype(@$mysqli->connect_errno), @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
}
开发者ID:alphaxxl,项目名称:hhvm,代码行数:59,代码来源:mysqli_class_mysqli_properties_no_conn.php

示例3: getDBCon

 function getDBCon($force = 0)
 {
     if ($force || !isset($this->a['db_con'])) {
         if (!$this->createDBCon()) {
             return false;
         }
     }
     if (!$force && !@mysqli_thread_id($this->a['db_con'])) {
         return $this->getDBCon(1);
     }
     return $this->a['db_con'];
 }
开发者ID:GettyScholarsWorkspace,项目名称:GettyScholarsWorkspace,代码行数:12,代码来源:ARC2_Store.php

示例4: close

 public function close()
 {
     foreach (array(self::LINK_TYPE_SLAVE, self::LINK_TYPE_MASTER) as $type) {
         if (array_key_exists($type, $this->links) && $this->links[$type] instanceof \mysqli) {
             $tid = mysqli_thread_id($this->links[$type]);
             if ($tid !== false) {
                 mysqli_kill($this->links[$type], $tid);
             }
             mysqli_close($this->links[$type]);
             unset($this->links[$type]);
         }
     }
     $this->links = array();
 }
开发者ID:jejem,项目名称:simple-sql,代码行数:14,代码来源:SimpleSQL.php

示例5: insertInto

 public function insertInto($table, $values)
 {
     if (is_array($values)) {
         $str = "INSERT INTO `{$table}` VALUES (NULL,";
         foreach ($values as $value) {
             $str .= "'" . $value . "',";
         }
         $str = substr($str, 0, strlen($str) - 1);
         $str .= ")";
         $nc = $this->c();
         $q = mysqli_query($nc, $str);
         mysqli_kill($nc, mysqli_thread_id($nc));
         mysqli_close($nc);
         if ($q) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:gottsohn,项目名称:muzikkitchen,代码行数:22,代码来源:db__.php

示例6: Clsoe

 public function Clsoe()
 {
     $thread_id = mysqli_thread_id($this->con);
     mysqli_kill($this->con, $thread_id);
 }
开发者ID:Eidolex,项目名称:Project,代码行数:5,代码来源:db.class.php

示例7: array

        break;
    }
    $links = $errors = $reject = array($mysqli1, $mysqli2);
    if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
        continue;
    }
    // WARNING: Due to the reference issue none of these should ever fire!
    foreach ($reject as $link) {
        printf("Connection %d was rejected...\n", mysqli_thread_id($link));
        if (mysqli_thread_id($link) != $thread_id) {
            printf("[006] Connector %d should have been rejected. But also %d has been rejected.", $thread_id, mysqli_thread_id($link));
        }
        $processed++;
    }
    foreach ($errors as $link) {
        printf("Connection %d has an error...\n", mysqli_thread_id($link));
        $processed++;
    }
    foreach ($links as $link) {
        if ($res = mysqli_reap_async_query($link)) {
            mysqli_free_result($res);
            $processed++;
        }
    }
} while ($processed < 2);
mysqli_close($mysqli1);
mysqli_close($mysqli2);
$mysqli1 = get_connection();
$mysqli2 = get_connection();
var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_mysqli_tests_mysqli_poll_reference.php

示例8: nl2br

<div id="boxlinks2">

<?php 
include 'inc/boxlinks2.php';
?>
</div>
<div id="content2">
 <h2><?php 
echo nl2br($daten['titel_' . $lang]);
?>
</h2><br />
<?php 
echo nl2br($daten[$lang]);
?>
 
    
  
</div><div id="nebennavigation"><div id="nebennavigationinnen"><?php 
include 'inc/nebennavigation_' . $lang . '.php';
?>
</div>   </div></div>
</div>


</body>
</html>
<?php 
$thread_id = mysqli_thread_id($link);
mysqli_kill($link, $thread_id);
mysqli_close($link);
开发者ID:Andreas-Schoenefeldt,项目名称:viszerale-therapie.at,代码行数:30,代码来源:pruefungen.php

示例9: getThreadId

 protected function getThreadId()
 {
     return mysqli_thread_id($this->db_Conn);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:4,代码来源:database_mysqli.php

示例10: getThreadId

 /**
  * Retrieve the current thread id
  *
  * @return	@e integer
  */
 public function getThreadId()
 {
     return mysqli_thread_id($this->connection_id);
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:9,代码来源:classDbMysqliClient.php

示例11: mysql_thread_id

 function mysql_thread_id($link = NULL)
 {
     $link = mysql_resolve_link($link);
     return mysqli_thread_id($link);
 }
开发者ID:siteman,项目名称:mysql2i,代码行数:5,代码来源:mysql2i.php

示例12: mysql_thread_id

 function mysql_thread_id($link_identifier = null)
 {
     return mysqli_thread_id(mysql_ensure_link($link_identifier));
 }
开发者ID:Jan-E,项目名称:mysql-wrapper,代码行数:4,代码来源:mysql-wrapper.php

示例13: getLinkId

 public function getLinkId()
 {
     return mysqli_thread_id($this->getLink());
 }
开发者ID:seansitter,项目名称:picnicphp,代码行数:4,代码来源:Mysqli.php

示例14: printf

<?php

require_once "connect.inc";
require_once "table.inc";
$host = 'p:' . $host;
if (!($plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
    printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
}
// get the thread ids of the two connections...
$thread_id = mysqli_thread_id($link);
$pthread_id = mysqli_thread_id($plink);
if (!($res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))) {
    printf("[002] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$running_threads = array();
while ($row = mysqli_fetch_assoc($res)) {
    $running_threads[$row['Id']] = $row;
}
mysqli_free_result($res);
if (count($running_threads) < 2) {
    printf("[003] Processlist is too short, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!isset($running_threads[$thread_id])) {
    printf("[004] Cannot find thread id of the regular link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (!isset($running_threads[$pthread_id])) {
    printf("[005] Cannot find thread id of the persistent link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
// Kill the persistent connection - don't use mysqli_kill, mysqlnd will catch that...
if (!mysqli_query($link, sprintf('KILL %d', $pthread_id))) {
    printf("[006] Cannot kill persistent connection, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_mysqli_tests_mysqli_pconn_kill.php

示例15: printf

<?php

require_once "connect.inc";
$tmp = NULL;
$link = NULL;
$test_table_name = 'test_mysqli_kill_table_1';
require 'table.inc';
// Zend will cast the NULL to 0
if (!is_bool($tmp = mysqli_kill($link, null))) {
    printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
}
if (!($thread_id = mysqli_thread_id($link))) {
    printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$tmp = mysqli_kill($link, $thread_id);
if (!is_bool($tmp)) {
    printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
}
if ($res = mysqli_query($link, "SELECT id FROM test_mysqli_kill_table_1 LIMIT 1")) {
    pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res);
}
var_dump($error = mysqli_error($link));
if (!is_string($error) || '' === $error) {
    printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error);
}
var_dump($res);
var_dump($link);
if ($IS_MYSQLND) {
    if ($link->info != 'Records: 6  Duplicates: 0  Warnings: 0') {
        printf("[008] mysqlnd used to be more verbose and used to support SELECT\n");
    }
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:mysqli_kill.php


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