dbListViews

Version 23.4.8841


dbListViews


ターゲットデータベースサーバーのビューをリストします。Depending on your configuration and the target database type, some of these parameters and output attributes might be irrelevant.

必要なパラメータ

オプションのパラメータ

  • includesystemviews:システムビューを含めるかどうか。true またはfalseが使用可能です。デフォルトはfalse です。
  • schema:The name of the database schema from which to list the views.The schema is commonly referred to as the namespace of a group of tables and views.
  • catalog:The catalog in the database server.これは一般的に データベース と呼ばれます。If you do not provide a value, views from all catalogs in the database server are returned.

アウトプット属性

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

In this example, the targeted database server is MySQL and the targeted catalog (database) is sakila. Notice that there is no database parameter in the connection string: if the database is specified in the connection string, the catalog parameter is not required. This script writes all the attributes of the target catalog (database) to an output file.

<!-- 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" />

The output file has the following format:

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
-----

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

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