> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# dbListViews

> ターゲットデータベースサーバーのビューをリストします。

export const siteNameShort = "Arc";

ターゲットデータベースサーバーのビューをリストします。設定とターゲットデータベースの種類によっては、これらのパラメータやアウトプット属性の一部が関連しない場合があります。

## 必要なパラメータ

* **driver**: クロスプラットフォーム版ではJDBC ドライバーのクラス名、.NET 版ではADO.NET プロバイダー名。
* **conn**: 接続文字列、またはデータベースURL。

## オプションのパラメータ

* **includesystemviews**: システムビューを含めるかどうか。`true` または`false` が使用可能です。デフォルトは`false` です。
* **schema**: ビューをリストするデータベーススキーマの名前。スキーマは一般的にテーブルおよびビューのグループの *名前空間* と呼ばれます。
* **catalog**: データベースサーバーのカタログ。これは一般的に *データベース* と呼ばれます。値を指定しない場合、データベースサーバーのすべてのカタログのビューが返されます。

## アウトプット属性

* **db:name**: ビュー名。
* **db:type**: ビューの型。
* **db:schema**: ビューが属するスキーマ。
* **db:catalog**: ビューが属するカタログ。これは一般的に *データベース* と呼ばれます。

## 例

この例では、ターゲットのデータベースサーバーはMySQL、ターゲットのカタログ（データベース）は`sakila` です。接続文字列に`database` パラメータがないことに注意してください。接続文字列でデータベースが指定されている場合、`catalog` パラメータは不要です。このスクリプトは、ターゲットカタログ（データベース）のすべての属性をアウトプットファイルに書き込みます。

```xml theme={null}
<!-- Initializing the output item -->
<arc:set attr="output.data" />
<!-- Creating the input db item and the necessary attributes -->
<arc:set attr="db.driver" value="cdata.jdbc.mysql.MySQLDriver" />
<arc:set attr="db.catalog" value="sakila" />
<arc:set attr="db.conn" value="jdbc:cdata:mysql:server=localhost;port=3306;user=root;password=Password123;"/>

<arc:call op="dbListViews" in="db" out="results" >
  <!-- adding result data from the operation to an output item that will be pushed out as a file -->
  <arc:set attr="output.data">[output.data]\nView Name=[results.db:name]\nType=[results.db:type]\nCatalog=[results.db:catalog]\n-----
  </arc:set>
</arc:call>

<!-- setting the filename and pushing the file out --> 
<arc:set attr="output.filename" value="results.txt" />
```

アウトプットファイルは次の形式になります：

```
View Name=actor_info
Type=VIEW
Catalog=sakila
-----
View Name=customer_list
Type=VIEW
Catalog=sakila
-----
View Name=film_list
Type=VIEW
Catalog=sakila
-----
View Name=nicer_but_slower_film_list
Type=VIEW
Catalog=sakila
-----
View Name=sales_by_film_category
Type=VIEW
Catalog=sakila
-----
View Name=sales_by_store
Type=VIEW
Catalog=sakila
-----
View Name=staff_list
Type=VIEW
Catalog=sakila
-----
```

{siteNameShort} がインストールおよび実行されているマシンにドライバーがインストールされている場合に限り、上記の例を変更して別のデータベースを対象にすることができます。例を.NET 用に調整するには、`driver` と`conn` のインプットを次のように変更する必要があります：

```xml theme={null}
<arc:set attr="db.driver" value="System.Data.CData.MySql" /> 
<arc:set attr="db.conn" value="Server=localhost;Database=sakila;UID=root;Password=Password123;"/>
```
