<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFSTOREDPROC</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="説明">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFSTOREDPROC</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">説明</span>
<p>
サーバーデータベースのストアードプロシージャを実行します。CFSTOREDPROC タグを使用すると、データベース接続情報の指定や、ストアードプロシージャの識別が行えます。
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">カテゴリ</span>
<p>
データベース操作タグ
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span><pre>&lt;cfstoredproc
   procedure = &quot;procedure name&quot;
   dataSource = &quot;ds_name&quot;
   username = &quot;username&quot;
   password = &quot;password&quot;
   blockFactor = &quot;blocksize&quot;
   debug = &quot;yes&quot;、&quot;no&quot;
   returnCode = &quot;yes&quot;、&quot;no&quot;&gt;
result = &quot;result_name&quot;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">関連項目</span>
<p>
cfinsert、cfqueryparam、cfprocparam、 cfprocresult、 cftransaction、cfquery、cfupdate、『ColdFusion MX 開発ガイド』の第13章の「ColdFusion アプリケーションの設計と最適化」 の「データベース使用の最適化」
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">ヒストリ</span>
<p>
ColdFusion&#160;MX&#160;7: result 属性が追加されました。
</p>

<p>
ColdFusion&#160;MX: connectString、dbName、dbServer、dbtype、provider、および providerDSN 属性は使用禁止になりました。ColdFusion 5 よりも後のリリースでは、これらは機能せず、エラーを引き起こす可能性があります。ColdFusion MX では、Type 4 JDBC ドライバを使用しています。
</p>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">使用方法</span>
<p>
このタグは、データベースのストアードプロシージャを呼び出すために使用します。このタグ内で、次のように cfprocresult タグおよび cfprocparam タグをコーディングします。
</p>
<ul>

<li>cfprocresult&#160;ストアードプロシージャから結果セットが返される場合は、結果セットごとに 1 つの cfprocresult タグをコーディングします。</li>

<li>cfprocparam&#160;ストアードプロシージャで入力または出力パラメータが使用されている場合は、パラメータごとに 1 つの cfprocparam タグをコーディングし、ストアードプロシージャ定義内の各パラメータを含めます。さらに、cfprocparam タグは、ストアードプロシージャ定義のパラメータと同じ順序でコーディングする必要があります。</li>
</ul>

<p>
returnCode = &quot;Yes&quot; に設定すると、このタグによりストアードプロシージャのステータスコードを保持する変数 prefix.statusCode が設定されます。ステータスコードの値は DBMS によって異なります。コード値の意味については、DBMS のドキュメントを参照してください。 
</p>

<p>
このタグでは、変数 prefix.ExecutionTime が設定されます。この変数には、ストアードプロシージャの実行時間がミリ秒単位で指定されます。
</p>

<p>
prefix の値は、cfstoredproc か、または result 属性を指定した場合はその属性で指定される値です。result 属性は、複数のページから同時に呼び出される可能性があるストアードプロシージャについて、一方の呼び出しの結果が他方の呼び出しの結果を上書きしないようにするための方法を提供します。たとえば、result 属性を myResult と指定した場合は、myResult.ExecutionTime として ExecutionTime にアクセスします。それ以外の場合は、cfstoredproc.ExecutionTime としてアクセスします。
</p>

<p>
このタグは、ストアードプロシージャとその使用方法について十分に理解してから実装してください。 
</p>

<p>
次の例では、Sybase ストアードプロシージャを使用しています。Oracle 8 または 9 のストアードプロシージャの例については、cfprocparamを参照してください。
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">例</span><pre>&lt;!--- この参照専用の例では、3 つの結果セットを返す Sybase ストアードプロシージャを実行します。必要なの
は、そのうち 2 つの結果セットです。このストアードプロシージャは、ステータスコードと出力パラメータを 1 
つ返します。それらをこの例で表示します。パラメータには名前指定表記を使用します。 ---&gt;
&lt;!--- 
&lt;cfstoredproc procedure = &quot;foo_proc&quot;
   dataSource = &quot;MY_SYBASE_TEST&quot; username = &quot;sa&quot;
   password = &quot;&quot; dbServer = &quot;scup&quot; dbName = &quot;pubs2&quot;
   returnCode = &quot;Yes&quot; debug = &quot;Yes&quot;&gt;
   &lt;cfprocresult name = RS1&gt;
   &lt;cfprocresult name = RS3 resultSet = 3&gt;

   &lt;cfprocparam type = &quot;IN&quot;       CFSQLType = CF_SQL_INTEGER
         value = &quot;1&quot; dbVarName = @param1&gt;
   &lt;cfprocparam type = &quot;OUT&quot; CFSQLType = CF_SQL_DATE
      variable = FOO dbVarName = @param2&gt;
&lt;/cfstoredproc&gt;
---&gt;
&lt;!--- 
&lt;cfoutput&gt;   出力パラメータ値 :'#foo#'&lt;br&gt;&lt;/cfoutput&gt;
&lt;h3&gt;結果情報&lt;/h3&gt;
&lt;cfoutput query = RS1&gt;#name#,#DATE_COL#&lt;br&gt;&lt;/cfoutput&gt;&lt;p&gt;
&lt;cfoutput&gt;
   &lt;hr&gt;
   &lt;p&gt;レコード件数:#RS1.recordCount# &gt;p&gt;列:#RS1.columnList#   &lt;hr&gt;
&lt;/cfoutput&gt; 
&lt;cfoutput query = RS3&gt;#col1#,#col2#,#col3#&lt;br&gt;
&lt;/cfoutput&gt;&lt;p&gt;
&lt;cfoutput&gt;
   &lt;hr&gt;
   &lt;p&gt;レコード件数:#RS3.recordCount# &lt;p&gt;列:#RS3.columnList#   &lt;hr&gt;
   ストアードプロシージャの戻りコード :'#cfstoredproc.statusCode#'&lt;br&gt;
&lt;/cfoutput&gt;
---&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="PROCEDURE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">PROCEDURE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>データベースサーバー上のストアードプロシージャの名前です。</p>

  </td>
  </tr>
  </table>
</div>
<div id="DATASOURCE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DATASOURCE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>ストアードプロシージャが含まれているデータベースをポイントするデータソースの名前です。</p>

  </td>
  </tr>
  </table>
</div>
<div id="USERNAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">USERNAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>データソースセットアップのユーザー名よりも優先されます。</p>

  </td>
  </tr>
  </table>
</div>
<div id="PASSWORD">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">PASSWORD</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>データソースセットアップのパスワードよりも優先されます。</p>

  </td>
  </tr>
  </table>
</div>
<div id="BLOCKFACTOR">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">BLOCKFACTOR</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "1"


<p>サーバーから一度に取得する行の最大数です。値の範囲は 1 ～ 100 です。</p>

  </td>
  </tr>
  </table>
</div>
<div id="DEBUG">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DEBUG</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "No"

<ul>

<li>Yes: 各ステートメントのデバッグ情報をリストします。</li>

<li>No</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="RETURNCODE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">RETURNCODE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "No"

<ul>

<li>Yes: ストアードプロシージャによって返されるステータスコードを cfstoredproc.statusCode に挿入します。 </li>

<li>No</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="RESULT">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">RESULT</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">オプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>cfstoredproc が statusCode 変数および ExecutionTime 変数を返す構造体の名前を指定します。指定すると、その値が接頭辞として cfcfstoredproc の代わりに使用され、これらの変数にアクセスするときに使われます。詳細については、「使用方法」を参照してください。</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
