Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere サーバ プログラミング » データベースツールインタフェース (DBTools)

 

ビットフィールド

DBTools 構造体の多くは、ビットフィールドを使用してブール情報を効率よく格納しています。たとえば、バックアップ構造体には次のビットフィールドがあります。

a_bit_field     backup_database : 1;
a_bit_field     backup_logfile  : 1;
a_bit_field     no_confirm  : 1;
a_bit_field     quiet       : 1;
a_bit_field     rename_log  : 1;
a_bit_field     truncate_log : 1;
a_bit_field     rename_local_log: 1;
a_bit_field     server_backup   : 1;

各ビットフィールドは 1 ビット長です。これは、構造体宣言のコロンの右側の 1 によって示されています。a_bit_field に割り当てられている値に応じて、特定のデータ型が使用されます。a_bit_field は dbtools.h の先頭で設定され、設定値はオペレーティングシステムに依存します。

0 または 1 の値をビットフィールドに割り当てて、構造体のブール情報を渡します。