appadminの追加情報

□未翻訳

□翻訳中

□翻訳完了(細田謙二)

■レビュー(中垣健志)

appadminの追加情報

appadminは一般に公開されることを意図されていません。これはデータベースへのアクセスを簡単に行えるようして開発者を支援するために設計されいます。これには2つのファイルしか含まれていません:1つは"appadmin.py"コントローラで、もう1つはそのコントローラのすべてのアクションから利用される"appadmin.html"ビューです。

appadmin is not intended to be exposed to the public. It is designed to help you by providing an easy access to the database. It consists of only two files: a controller "appadmin.py" and a view "appadmin.html" which are used by all actions in the controller.

appadminコントローラは比較的小さく読むことが可能です。すなわち、データベースのインターフェイス定義の例を提示していることになります。

The appadmin controller is relatively small and readable; it provides an example of designing a database interface.

appadminはどのデータベースが利用可能なのか、どのテーブルが各データベースに存在しているかを示します。レコードを挿入することができ、また、各テーブルのレコードを個別に列挙することができます。appadminは一度に100レコードを出力してページングします。

appadmin shows which databases are available and which tables exist in each database. You can insert records and list all records for each table individually. appadmin paginates output 100 records at a time.

一旦、レコードのセットが選択されると、ページのヘッダが変化して、選択されたレコードを更新または削除することができるようになります。

Once a set of records is selected, the header of the pages changes, allowing you to update or delete the selected records.

レコードを更新するには、Query文字列フィールドにSQL文を入力します:

To update the records, enter an SQL assignment in the Query string field:

1.

title = 'test'

ここで、文字列の値は単一引用符で囲む必要があります。複数のフィールドはカンマで区切ることができます。

where string values must be enclosed in single quotes. Multiple fields can be separated by commas.

レコードを削除するには、対応するチェックボックスをクリックして、本当に行うか確認します。

To delete a record, click the corresponding checkbox to confirm that you are sure.

appadminはまた、SQLのFILTERが2つ以上のテーブルを含むSQLの条件を持つ場合、結合(join)を実行することができます。たとえば、次の例を試してください:

appadmin can also perform joins if the SQL FILTER contains a SQL condition that involves two or more tables. For example, try:

1.

db.image.id == db.comment.image_id

web2pyは、これをDALに向かって渡します。DALはそのクエリが2つのテーブルをリンクしていることを理解します。したがって、両者のテーブルは内部結合(INNER JOIN)によって選択されます。これはその出力です:

web2py passes this along to the DAL, and it understands that the query links two tables; hence, both tables are selected with an INNER JOIN. Here is the output:

idフィールドの番号をクリックすると、対応するidを持つレコードに対する編集ページが得られます。

If you click on the number of an id field, you get an edit page for the record with the corresponding id.

参照フィールドの数字をクリックすると、その参照されたレコードに対する編集ページが得られます。

If you click on the number of a reference field, you get an edit page for the referenced record.

結合(join)によって選択された行を更新または削除することはできません。なぜなら、それらは複数のテーブルからのレコードを含み、対象が曖昧になるからです。

You cannot update or delete rows selected by a join, because they involve records from multiple tables and this would be ambiguous.