| ColdFusion MX | ||
| 目 次 > CFML リファレンス > ColdFusion 関数 > StructIsEmpty |
|
|
|
|
||
構造体に何もデータが含まれていないかどうかを調べます。
structure が空の場合は true。structure が存在しない場合は例外が発生します。
StructIsEmpty(structure)
ColdFusion MX: 動作の変更 : この関数は、XML オブジェクトに使用できます。
パラメータ |
説明 |
|---|---|
structure |
データの有無を調べる構造体です。 |
<!--- この例は、StructIsEmpty の使用方法を示しています。 --->
<p>このファイルは、StructNew、StructClear、および StructDelete で呼び出される addemployee.cfm と同一です。この中では、従業員の追加を行っています。従業員の情報は employee 構造体 (EMPINFO 属性) から渡されます。UNIX では、Emp_ID も追加する必要があります。
<cfswitch expression = "#ThisTag.ExecutionMode#">
<cfcase value = "start">
<cfif StructIsEmpty(attributes.EMPINFO)>
<cfoutput>エラー。従業員データが渡されていません。</cfoutput>
<cfexit method = "ExitTag">
<cfelse>
<!--- 従業員を追加。UNIX では、Emp_ID も追加する必要があります。 --->
<cfquery name = "AddEmployee" datasource = "cfsnippets">
INSERT INTO Employees
(FirstName, LastName, Email, Phone, Department)
VALUES
<cfoutput>
(
'#StructFind(attributes.EMPINFO, "firstname")#' ,
'#StructFind(attributes.EMPINFO, "lastname")#' ,
'#StructFind(attributes.EMPINFO, "email")#' ,
'#StructFind(attributes.EMPINFO, "phone")#' ,
‘#StructFind(attributes.EMPINFO, "department")#’
)
</cfoutput>
</cfquery>
</cfif>
<cfoutput><hr>従業員情報の追加が完了しました。</cfoutput>
</cfcase>
</cfswitch>
|
|
||
| 目 次 > CFML リファレンス > ColdFusion 関数 > StructIsEmpty |
|
|