mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
262 lines
8.4 KiB
HTML
262 lines
8.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<title>Returns a list of currently configured servers</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.mysqlnd-ms-dump-servers" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">mysqlnd_ms_dump_servers</h1>
|
|
<p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">mysqlnd_ms_dump_servers</span> — <span class="dc-title">Returns a list of currently configured servers</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.mysqlnd-ms-dump-servers-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
|
|
<span class="methodname"><strong>mysqlnd_ms_dump_servers</strong></span>
|
|
( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$connection</code></span>
|
|
) : <span class="type">array</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Returns a list of currently configured servers.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.mysqlnd-ms-dump-servers-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">connection</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
A MySQL connection handle obtained from any of the
|
|
connect functions of the <a href="ref.mysqli.html" class="link">mysqli</a>,
|
|
<a href="ref.mysql.html" class="link">mysql</a> or
|
|
<a href="ref.pdo_mysql.html" class="link">PDO_MYSQL</a> extensions.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.mysqlnd-ms-dump-servers-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
<strong><code>FALSE</code></strong> on error. Otherwise, returns an array with two entries
|
|
<em>masters</em> and <em>slaves</em> each of which contains
|
|
an array listing all corresponding servers.
|
|
</p>
|
|
<p class="para">
|
|
The function can be used to check and debug the list of servers currently
|
|
used by the plugin. It is mostly useful when the list of servers changes at
|
|
runtime, for example, when using MySQL Fabric.
|
|
</p>
|
|
<p class="para">
|
|
<em>masters</em> and <em>slaves</em> server entries
|
|
</p>
|
|
<table class="doctable informaltable">
|
|
|
|
<col width="1*" />
|
|
<col width="7*" />
|
|
<col width="2*" />
|
|
<thead>
|
|
<tr>
|
|
<th>Key</th>
|
|
<th>Description</th>
|
|
<th>Version</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="tbody">
|
|
<tr>
|
|
<td>
|
|
<em>name_from_config</em>
|
|
</td>
|
|
<td>
|
|
<p class="para">
|
|
Server entry name from config, if appliciable. NULL if no
|
|
configuration name is available.
|
|
</p>
|
|
</td>
|
|
<td>Since 1.6.0.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<em>hostname</em>
|
|
</td>
|
|
<td>
|
|
<p class="para">
|
|
Host name of the server.
|
|
</p>
|
|
</td>
|
|
<td>Since 1.6.0.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<em>user</em>
|
|
</td>
|
|
<td>
|
|
<p class="para">
|
|
Database user used to authenticate against the server.
|
|
</p>
|
|
</td>
|
|
<td>Since 1.6.0.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<em>port</em>
|
|
</td>
|
|
<td>
|
|
<p class="para">
|
|
TCP/IP port of the server.
|
|
</p>
|
|
</td>
|
|
<td>Since 1.6.0.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>
|
|
<em>socket</em>
|
|
</td>
|
|
<td>
|
|
<p class="para">
|
|
Unix domain socket of the server.
|
|
</p>
|
|
</td>
|
|
<td>Since 1.6.0.</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 unknown-returnvaluet" id="refsect1-function.mysqlnd-ms-dump-servers-unknown-returnvaluet">
|
|
<h3 class="title">注释</h3>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
<span class="function"><strong>mysqlnd_ms_dump_servers()</strong></span> requires
|
|
PECL mysqlnd_ms >> 1.6.0.
|
|
</p>
|
|
</p></blockquote>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.mysqlnd-ms-dump-servers-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-2269">
|
|
<p><strong>Example #1 <span class="function"><strong>mysqlnd_ms_dump_servers()</strong></span> example</strong></p>
|
|
<div class="example-contents">
|
|
<div class="inicode"><pre class="inicode">{
|
|
"myapp": {
|
|
"master": {
|
|
"master1": {
|
|
"host":"master1_host",
|
|
"port":"master1_port",
|
|
"socket":"master1_socket",
|
|
"db":"master1_db",
|
|
"user":"master1_user",
|
|
"password":"master1_pw"
|
|
}
|
|
},
|
|
"slave": {
|
|
"slave_0": {
|
|
"host":"slave0_host",
|
|
"port":"slave0_port",
|
|
"socket":"slave0_socket",
|
|
"db":"slave0_db",
|
|
"user":"slave0_user",
|
|
"password":"slave0_pw"
|
|
},
|
|
"slave_1": {
|
|
"host":"slave1_host"
|
|
}
|
|
}
|
|
}
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br />$link </span><span style="color: #007700">= </span><span style="color: #0000BB">mysqli_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"myapp"</span><span style="color: #007700">, </span><span style="color: #DD0000">"global_user"</span><span style="color: #007700">, </span><span style="color: #DD0000">"global_pass"</span><span style="color: #007700">, </span><span style="color: #DD0000">"global_db"</span><span style="color: #007700">, </span><span style="color: #0000BB">1234</span><span style="color: #007700">, </span><span style="color: #DD0000">"global_socket"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">mysqlnd_ms_dump_servers</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
<div class="example-contents"><p>以上例程会输出:</p></div>
|
|
<div class="example-contents screen">
|
|
<div class="cdata"><pre>
|
|
array(2) {
|
|
["masters"]=>
|
|
array(1) {
|
|
[0]=>
|
|
array(5) {
|
|
["name_from_config"]=>
|
|
string(7) "master1"
|
|
["hostname"]=>
|
|
string(12) "master1_host"
|
|
["user"]=>
|
|
string(12) "master1_user"
|
|
["port"]=>
|
|
int(3306)
|
|
["socket"]=>
|
|
string(14) "master1_socket"
|
|
}
|
|
}
|
|
["slaves"]=>
|
|
array(2) {
|
|
[0]=>
|
|
array(5) {
|
|
["name_from_config"]=>
|
|
string(7) "slave_0"
|
|
["hostname"]=>
|
|
string(11) "slave0_host"
|
|
["user"]=>
|
|
string(11) "slave0_user"
|
|
["port"]=>
|
|
int(3306)
|
|
["socket"]=>
|
|
string(13) "slave0_socket"
|
|
}
|
|
[1]=>
|
|
array(5) {
|
|
["name_from_config"]=>
|
|
string(7) "slave_1"
|
|
["hostname"]=>
|
|
string(11) "slave1_host"
|
|
["user"]=>
|
|
string(12) "gloabal_user"
|
|
["port"]=>
|
|
int(1234)
|
|
["socket"]=>
|
|
string(13) "global_socket"
|
|
}
|
|
}
|
|
}
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |