<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>CFFUNCTION</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">CFFUNCTION</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>
CFML 内で呼び出すことのできる関数を定義します。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: XML 値が returntype 属性に追加されました。
</p>

<p>
ColdFusion MX: このタグが追加されました。
</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;cffunction
   name = &quot;methodName&quot;
   returnType = &quot;dataType&quot;
   roles = &quot;securityRoles&quot;
   access = &quot;methodAccess&quot;
description = &quot;function description&quot;
output = &quot;yes&quot;、&quot;no&quot;
   displayName = &quot;name&quot;
   Hint = &quot;hint text&quot;&gt;
</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>
cfargument、cfcomponent、cfinvoke、cfinvokeargument、cfobject、cfproperty、cfreturn
</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>
cffunction タグを使用すると、ColdFusion のビルトイン関数と同じ方法で呼び出すことのできる関数を定義できます。 
</p>

<p>
ColdFusion コンポーネント (CFC) のメソッドを定義するには、cffunction タグを使用する必要があります。 
</p>

<p>
次の例は、ColdFusion Query オブジェクトを返す単純な CFC メソッドを定義するための cffunction タグの属性です。
</p>
<pre>&lt;cffunction
   name=&quot;getEmployees&quot;
   access=&quot;remote&quot;
   returnType=&quot;query&quot;
   hint=&quot;このクエリー結果は、従業員データベースの全レコードを返します。オプションの入力パラメータに基づい
て、このクエリー結果に対して詳細検索または絞り込み検索を行うことができます。&quot;
</pre>
<p>
ColdFusion コンポーネントに関する cffunction タグの使用方法については、『ColdFusion MX 開発ガイド』の第10章の「ColdFusion コンポーネントの作成と使用」 を参照してください。
</p>

<p>
roles 属性を指定した場合、この関数は、指定したロールのいずれかに所属するユーザーがログインした場合にのみ実行されます。
</p>

<p>
returnType 属性に variableName を指定した場合、この関数は、ColdFusion の変数ネーミング規則に沿った文字列を返さなければなりません。つまり、文字、アンダースコア (_)、あるいは Unicode 通貨記号で始まり、文字、数字、アンダースコア、ピリオド、Unicode 通貨記号のみから成る文字列を返す必要があります。ColdFusion は、その値が既存の 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><pre>&lt;cfcomponent&gt;
   &lt;cffunction name=&quot;getEmp&quot;&gt;
       &lt;cfquery 
            name=&quot;empQuery&quot; datasource=&quot;ExampleApps&quot; &gt;
            SELECT FIRSTNAME, LASTNAME, EMAIL
            FROM tblEmployees
       &lt;/cfquery&gt;
       &lt;cfreturn empQuery&gt;
   &lt;/cffunction&gt;
   &lt;cffunction name=&quot;getDept&quot;&gt;
      &lt;cfquery
name=&quot;deptQuery&quot; datasource=&quot;ExampleApps&quot; &gt;
          SELECT *
          FROM tblDepartments
       &lt;/cfquery&gt;
       &lt;cfreturn deptQuery&gt;
   &lt;/cffunction&gt;
&lt;/cfcomponent&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="NAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">NAME</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>文字列です。cfcomponent タグ内で使用されるコンポーネントメソッドを指定します。</p>

  </td>
  </tr>
  </table>
</div>
<div id="RETURNTYPE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">RETURNTYPE</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">Web サービスの場合は必須、その他の場合はオプション</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "&#160;any"


<p>タイプ名の文字列です。関数の戻り値のデータイプを指定します。</p><ul>

<li>any</li>

<li>array</li>

<li>binary</li>

<li>boolean</li>

<li>date</li>

<li>guid - この引数は xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx という形式の UUID または GUID でなければなりません。x は 16 進数の 1 文字を表します (0 ～ 9、A ～ F)。</li>

<li>numeric</li>

<li>query</li>

<li>string</li>

<li>struct</li>

<li>uuid: この引数は xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx という形式の ColdFusion UUID でなければなりません。x は 16 進数の 1 文字を表します (0 ～ 9、A ～ F)。</li>

<li>variableName: ColdFusion 変数のネーミング規則に従った形式の文字列</li>

<li>void値を返しません。</li>

<li>xml: Web サービス関数で CFML XML オブジェクトと XML 文字列を返すことができます。</li>

<li>コンポーネント名: type 属性の値が上記のどれにも当てはまらない場合、ColdFusion はそれを ColdFusion コンポーネントの名前として扱います。関数を実行したときに、渡された引数が指定の名前を持つ CFC でない場合はエラーになります。</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="ROLES">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ROLES</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> "&quot;&quot; (空)"


<p>メソッドを呼び出すことができる ColdFusion セキュリティロールのリストをカンマで区切って指定します。指定のロールでログインしているユーザーだけがこの関数を実行できます。この属性を指定しない場合、すべてのユーザーがこのメソッドを呼び出すことができます。</p>

  </td>
  </tr>
  </table>
</div>
<div id="ACCESS">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ACCESS</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> "public"


<p>メソッドを呼び出すことができるクライアントセキュリティコンテキストです。</p><ul>

<li>private: メソッドを宣言するコンポーネント、および定義されているコンポーネントを拡張するコンポーネントだけで使用できます。</li>

<li>package: メソッド、コンポーネントを延長するコンポーネント、またはパッケージ内の他のコンポーネントを宣言するコンポーネントだけで使用できます。</li>

<li>public: ローカルで実行中のページまたはコンポーネントメソッドから使用できます。</li>

<li>remote: ローカルまたはリモートで実行中のページまたはコンポーネントメソッドから使用できる他に、URL、Flash、または Web サービスを介してリモートクライアントから使用することができます。関数を Web サービスとしてパブリッシュする場合、このオプションは必須です。</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="説明">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">説明</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="OUTPUT">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">OUTPUT</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> "関数の本文は標準の CFML として処理されます。"


<p>関数がどのような条件下で HTML 出力を生成するかを指定します。</p><ul>

<li>yes: 関数の本文全体が cfoutput タグ内にある場合と同様に処理されます。シャープ記号 (#) で囲まれた変数名は、自動的に実際の値に置き換えられます。</li>

<li>no: 関数が cfsilent タグ内にある場合と同様に処理されます。</li>
</ul>

<p>この属性を指定しない場合、関数の本文は標準 CFML として処理されます。すべての変数は cfoutput タグ内に置く必要があります。</p>

  </td>
  </tr>
  </table>
</div>
<div id="DISPLAYNAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DISPLAYNAME</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>CFC メソッドのパラメータの場合にのみ意味があります。イントロスペクションを使用して CFC についての情報を示すときに、関数名に続く括弧内に表示される値です。</p>

  </td>
  </tr>
  </table>
</div>
<div id="HINT">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">HINT</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>CFC メソッドのパラメータの場合にのみ意味があります。イントロスペクションを使用して CFC についての情報を示すときに表示されるテキストです。hint 属性の値は、関数の説明のシンタックス行の次に表示されます。</p>

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

  </body>
</html>
