予約されたキーワード

□未翻訳

□翻訳中

■翻訳完了(細田謙二)

■レビュー(Omi Chiba)

予約されたキーワード

DALのコンストラクタに渡すことのできるもう1つの引数があります。これにより、対象となるバックエンドのデータベースにおける予約されたSQLのキーワードに対してテーブルの名前や、カラムの名前をチェックすることができます。

There is also another argument that can be passed to the DAL constructor to check table names and column names against reserved SQL keywords in target back-end databases.

その引数は、check_reservedです。これはデフォルトはNoneです。

This argument is check_reserved and it defaults to None.

これは、データベース・バックエンドのアダプタの名前を含む文字列のリストです。

This is a list of strings that contain the database back-end adapter names.

アダプタの名前は、DALの接続文字列において使用されているものと同じです。たとえば、PostgreSQLとMSSQLに対してチェックしたい場合は、次のような接続文字列になります:

The adapter name is the same as used in the DAL connection string. So if you want to check against PostgreSQL and MSSQL then your connection string would look as follows:

1.

2.

db = DAL('sqlite://storage.db',

check_reserved=['postgres', 'mssql'])

DALは、リストと同じ順番で、キーワードを走査します。

The DAL will scan the keywords in the same order as of the list.

"all"と"common"という2つの追加オプションがあります。allを指定すると、すべての知られているSQLキーワードに対してチェックされます。commonを指定すると、SELECT、INSERT、UPDATEなどの一般的なSQLのキーワードだけがチェックされます。

There are two extra options "all" and "common". If you specify all, it will check against all known SQL keywords. If you specify common, it will only check against common SQL keywords such as SELECT, INSERT, UPDATE, etc.

サポートされるバックエンドに対して、非予約語のSQLキーワードに対してチェックするかどうかを指定することも可能です。この場合、_nonreservedをその名前の前に付けてください。例:

For supported back-ends you may also specify if you would like to check against the non-reserved SQL keywords as well. In this case you would append _nonreserved to the name. For example:

1.

check_reserved=['postgres', 'postgres_nonreserved']

以下のデータベース・バックエンドは、予約語のチェックをサポートしています。

The following database backends support reserved words checking.