<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.uodbc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.odbc-connection-string-quote.php',
    1 => 'odbc_connection_string_quote',
    2 => 'ODBC の接続文字列をクオートする',
  ),
  'up' => 
  array (
    0 => 'ref.uodbc.php',
    1 => 'ODBC 関数',
  ),
  'prev' => 
  array (
    0 => 'function.odbc-connection-string-is-quoted.php',
    1 => 'odbc_connection_string_is_quoted',
  ),
  'next' => 
  array (
    0 => 'function.odbc-connection-string-should-quote.php',
    1 => 'odbc_connection_string_should_quote',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/uodbc/functions/odbc-connection-string-quote.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.odbc-connection-string-quote" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">odbc_connection_string_quote</h1>
  <p class="verinfo">(PHP 8 &gt;= 8.2.0)</p><p class="refpurpose"><span class="refname">odbc_connection_string_quote</span> &mdash; <span class="dc-title">ODBC の接続文字列をクオートする</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.odbc-connection-string-quote-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>odbc_connection_string_quote</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$str</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   接続文字列の値を、ODBC のルールに従ってクオートします。
   つまり、波括弧で文字列を囲み、右括弧はエスケープします。
   この操作は、ユーザーが入力する接続文字列の値に対して常に行うべきです。
   そうしないと、接続文字列をパースする際に問題が発生したり、
   接続文字列に値を注入される可能性があります。
  </p>
  <p class="para">
   この関数は、
   文字列が既にクオートされているかをチェックしませんし、
   文字列にクオートが必要かどうかもチェックしないことに注意してください。
   それらの用途には、それぞれ
   <span class="function"><a href="function.odbc-connection-string-is-quoted.php" class="function">odbc_connection_string_is_quoted()</a></span> と、
   <span class="function"><a href="function.odbc-connection-string-should-quote.php" class="function">odbc_connection_string_should_quote()</a></span> をコールしてください。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.odbc-connection-string-quote-parameters">
  <h3 class="title">パラメータ</h3>
  <dl>
   
    <dt><code class="parameter">str</code></dt>
    <dd>
     <p class="para">
      クオートされていない文字列
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.odbc-connection-string-quote-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   波括弧で囲まれた、クオートされた文字列。
   適切にエスケープも行われます。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.odbc-connection-string-quote-examples">
  <h3 class="title">例</h3>
  <div class="example" id="odbc-connection-string-quote.example.basic">
   <p><strong>例1 <span class="function"><strong>odbc_connection_string_quote()</strong></span> の例</strong></p>
   <div class="example-contents"><p>
    この例は文字列をクオートし、接続文字列に追加します。
    文字列がクオートされ、文字列中の右括弧もエスケープされることに注意してください。
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$value </span><span style="color: #007700">= </span><span style="color: #0000BB">odbc_connection_string_quote</span><span style="color: #007700">(</span><span style="color: #DD0000">"foo}bar"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$connection_string </span><span style="color: #007700">= </span><span style="color: #DD0000">"DSN=PHP;UserValue=</span><span style="color: #0000BB">$value</span><span style="color: #DD0000">"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">$connection_string</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>上の例の出力は、
たとえば以下のようになります。</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">DSN=PHP;UserValue={foo}}bar}</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.odbc-connection-string-quote-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.odbc-connection-string-is-quoted.php" class="function" rel="rdfs-seeAlso">odbc_connection_string_is_quoted()</a> - ODBC の接続文字列の値が、クオートされているかを調べる</span></li>
    <li><span class="function"><a href="function.odbc-connection-string-should-quote.php" class="function" rel="rdfs-seeAlso">odbc_connection_string_should_quote()</a> - ODBC の接続文字列を、クオートすべきかを調べる</span></li>
   </ul>
  </p>
 </div>



</div><?php manual_footer($setup); ?>