本文整理汇总了PHP中mysqli::kill方法的典型用法代码示例。如果您正苦于以下问题:PHP mysqli::kill方法的具体用法?PHP mysqli::kill怎么用?PHP mysqli::kill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysqli
的用法示例。
在下文中一共展示了mysqli::kill方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __destruct
/**
* Connection destructor
*/
public function __destruct()
{
if (isset($this->mysqli) && !$this->mysqli->connect_error) {
$threadId = $this->mysqli->thread_id;
$this->mysqli->kill($threadId);
$this->mysqli->close();
}
}
示例2: disconnect
/**
* Disconnects from mysql-server.
*
* @return void
*/
public function disconnect()
{
if ($this->connected !== TRUE) {
return;
}
$this->mysqli->kill($this->mysqli->thread_id);
$this->mysqli->close();
$this->connected = FALSE;
}
示例3: implode
$holds_keys = implode(',', $holds_keys);
$sql = 'SELECT * FROM locum_holds_count ' . 'WHERE bnum IN (' . $holds_keys . ')';
if ($result = $mysqli->query($sql)) {
while ($holds_count = $result->fetch_assoc()) {
$bnum = $holds_count['bnum'];
$bibs[$bnum] = array_merge($bibs[$bnum], $holds_count);
}
$result->free();
} else {
// Query Error, log and move on
$log_msg .= sprintf("HOLDS QUERY ERROR:\n\t%s\n\tQUERY: %s\n", $mysqli->error, $sql);
}
unset($result);
}
// Kill the mysqli connection
$mysqli->kill($mysqli->thread_id);
$mysqli->close();
unset($mysqli);
$bibs_time = number_format(microtime(true) - $child_time_start, 3);
foreach ($bibs as &$bib) {
$loop_start = microtime(true);
prep_bib($bib);
$prep_time = microtime(true);
$prep_total += $prep_time - $loop_start;
write_sphinx_doc_xml($config, $bib, $offset);
$write_total += microtime(true) - $prep_time;
}
// Write to Log
$mem_usage = memory_get_usage();
$current_time = '[' . date("H:i:s") . ']';
$child_time_elapsed = number_format(microtime(true) - $child_time_start, 3);
示例4: mysqli
function StoredProcedureArray2($query="") {
//Me conecto a la base de datos
$mysqli = new mysqli("atc-nh-natsdb.nationalnet.com", "staffcenter", "XgwofvLY2ayLf", "staffcenter");
/* check connection */
if (mysqli_connect_errno()) {
printf("<br />Failed to connect to the database: %s\n", mysqli_connect_error());
exit();
}
//LLama al stored procedure
if ($mysqli->multi_query($query)) {
/* guarda el resultado del stored procedure */
$result = $mysqli->store_result();
$mysqli->kill($mysqli->thread_id);
$mysqli->close();
return $result;
}
}
示例5:
if (isset($_GET['i']) && $_GET['i'] == "hash") {
echo pass_hash("ripemd160", $_GET['p'], "SALT", "PEPPER");
} else {
if (isset($_POST['user'])) {
$user = $_POST['user'];
$pass = $_POST['pass'];
$query = $db->query("SELECT `pass` FROM `users` WHERE `user`='{$user}'");
$result = $query->fetch_assoc();
$verify = pass_verify("ripemd160", $pass, $result['pass'], "SALT", "PEPPER");
if ($verify == TRUE) {
$_SESSION['user'] = $user;
echo 1;
} else {
echo 0;
}
$db->kill($db->thread_id);
$db->close();
} else {
if (isset($_POST['key'])) {
$key = $_POST['key'];
$email = $_POST['email'];
$query = $db->query("SELECT `accesskey`,`user` FROM `accesskeys` WHERE `accesskey`='{$key}'");
$result = $query->fetch_assoc();
$verify = pass_verify("ripemd160", $email, $result['accesskey'], "SALT", "PEPPER");
if ($verify == TRUE) {
if ($result['user'] == NULL || $result['user'] == "") {
echo 1;
} else {
echo 0;
}
} else {
示例6: mysqltest
function mysqltest()
{
global $log_format, $db_con, $debug, $database, $mysql_host, $mysql_user, $mysql_password, $command_line, $tmp_dir;
// get our current MySQL thread id and if new, save it
$thread_id = "" . $db_con->thread_id . "\r\n";
$all_ids = @file_get_contents("" . $tmp_dir . "/thread_ids.txt");
// if the index procedure meanwhile was manually aborted (for multi threaded indexing)
if (!is_file("" . $tmp_dir . "/thread_ids.txt") || !$all_ids) {
$db_con->kill($thread_id);
//close last MySQL connection
$cl = '';
$report = "Indexation manually aborted.";
printCancel($report, $cl);
printEndHTMLBody($cl);
exit;
// terminate this indexing thread completely
}
$mysql_fail = '';
$check1 = '0';
$check2 = '0';
if ($check1 = $db_con->ping() != '1') {
$dbtries = 0;
while ($dbtries < 5 && ($check1 = $db_con->ping() != '1')) {
$dbtries++;
printDB_errorReport('noSQL', $command_line, '1');
sleep(10);
$db_con = new mysqli($mysql_host, $mysql_user, $mysql_password);
if (!$db_con) {
$mysql_fail = '1';
}
//echo "<span class='blue sml'> Cannot connect to database.<br /></span>";
if ($db_con) {
$success = mysqli_select_db($link, $database);
if (!$success) {
$mysql_fail = '1';
//echo "<p class='blue sml'> Cannot choose database.<br /></p>";
}
}
}
if ($check2 = $db_con->ping() != '1') {
printDB_errorReport('noSucc', $command_line, '1');
// failed 5 times. End of index procedure
printDB_errorReport('aborted', $command_line, '1');
printDB_errorReport('end', $command_line, '1');
die('');
}
printStandardReport('newSQL', $command_line, '1');
// reconnected to db
}
// get our current MySQL thread id and if new, save it
$thread_id = "" . $db_con->thread_id . "\r\n";
$all_ids = @file("" . $tmp_dir . "/thread_ids.txt");
// if the index procedure meanwhile was manually aborted (for multi threaded indexing)
if (!is_file("" . $tmp_dir . "/thread_ids.txt") || !is_array($all_ids)) {
$db_con->kill($thread_id);
//close last MySQL connection
$cl = '';
$report = "Indexation manually aborted.";
printCancel($report, $cl);
printEndHTMLBody($cl);
exit;
// terminate this indexing thread completely
}
if (!in_array($thread_id, $all_ids)) {
$fp = fopen("" . $tmp_dir . "/thread_ids.txt", "a+");
// try to write
if (!is_writeable("" . $tmp_dir . "/thread_ids.txt")) {
echo "\n <br /><br />\n <p class='warnadmin cntr'>\n <br /><br />\n Unable to open the file .../admin/" . $tmp_dir . "/thread_ids.txt\n <br /><br />\n Index procedure aborted.\n <br /><br /></p>\n <br /><br />\n <p class='evrow'><a class='bkbtn' href='admin.php' title='Go back to Admin'>Back to admin</a></p>\n <br /><br />\n </body>\n </html>\n ";
exit;
}
if (!fwrite($fp, $thread_id)) {
echo "\n <br /><br />\n <p class='warnadmin cntr'>\n <br /><br />\n Unable to write the actual MySQL thread-id into file " . $tmp_dir . "/thread_ids.txt\n <br /><br />\n Index procedure aborted.\n <br /><br /></p>\n <br /><br />\n <p class='evrow'><a class='bkbtn' href='admin.php' title='Go back to Admin'>Back to admin</a></p>\n <br /><br />\n </body>\n </html>\n ";
exit;
}
fclose($fp);
}
return $mysql_fail;
}
示例7: close
function close()
{
parent::kill($this->thread_id);
parent::close();
}