*カラム [#af6f36c7] カラム情報。 #contents **カラムコンテナ [#u9d9cdbd] ResutSet から com.sun.star.sdbcx.XColumnsSupplier インターフェースの getColumns メソッドを利用してカラムコンテナを取得します。 oColumns = oForm.getColumns() また、テーブルオブジェクトからは次のようにしてアクセス。 oCurrentController = ThisComponent.getCurrentController() oActiveConnection = oCurrentController.ActiveConnection oTables = oActiveConnection.getTables() oColumn = oTables.getByIndex(0) カラムコンテナは一般的な次のインターフェースをエクスポートしています。カラム名やインデックスで取り扱えます。 -com.sun.star.container.XContainer -com.sun.star.container.XEnumerationAccess -com.sun.star.container.XIndexAccess -com.sun.star.container.XNameAccess また、カラム操作が必要であれば次のようなインターフェースのメソッドを利用します。 -com.sun.star.sdbc.XColumnLocate -com.sun.star.sdbcx.XAppend -com.sun.star.sdbcx.XDataDescriptorFactory -com.sun.star.sdbcx.XDrop -com.sun.star.util.XRefreshable **カラム [#j6832bff] カラムを取得します。上記のインターフェースを利用して取得します。たとえば、XNameAccess インターフェースのメソッドを利用して名前で取得します。 sNames = oColumns.getElementNames() For i = 0 To UBound(sNames) step 1 oColumn = oColumn.getByName( sNames(i) ) Next **カラム情報 [#c5cab253] カラムの情報や値が取得できます。各種値に関するプロパティはそのカラムの型に対応したもののみが参照できます。 テーブルオブジェクトから参照したカラムオブジェクトはデータタイプなどを以下のプロパティで参照できます。 テーブルオブジェクトから参照したカラムオブジェクトはデータタイプなどを以下のプロパティで参照できます。&idlref(com.sun.star.sdbcx.Column); |プロパティ|型|説明|h |Name|string|カラム名| |Type|long|データタイプ &idlref(com.sun.star.sdbc.DataType);| |TypeName|string|カラム型名| |Precision|long|精度。VARCHAR のときには文字列の最大長| |Scale|long|小数点以下の桁数| |IsNullable|long|Null 値可能| |IsAutoIncrement|boolean|自動で増加。オートインクリメント| |IsCurrency|boolean|通貨値| |IsRowVersion|boolean|タイムスタンプ付き| |Description|string|説明| |DefaultValue|string|デフォルト値| &idlref(com.sun.star.sdbcx.Column); さらに、フォームから参照した場合にはカラムは現在のレコードのものに相当します。 |プロパティ|型|説明|h |Align|long|テキスト配置。0: 左、1: 中央、2: 右| |ControlDefault|string|表示デフォルト値| |HelpText|string|UI でのヘルプテキスト| |ControlModel|.beans.XPropertySet|関連コントロールモデル| |Hidden|boolean|隠し| |Position|long|グリッドでの位置| |Width|long|グリッドでの幅| |DisplaySize|long|文字数でのカラム表示幅| |FormatKey|long|書式フォーマットコード (キー)| |||| |TableName|string|所属テーブル名| |SchemaName|string|スキーマ名| |ServiceName|string|データサービス名| |CatalogName|string|カタログ名| |Label|string|ラベル| |IsCaseSensitive|boolean|大小文字を区別| |IsDefinitelyWritable|boolean|確実に書き込み可能| |IsReadOnly|boolean|読み込み専用| |IsSearchable|boolean|検索可| |IsSigned|boolean|符号付| |IsWritable|boolean|書き込み可| |RelativePosition|long|相対位置| データの取得は対応するメソッドで行えます。 |プロパティ|型|説明|h |Array|.sdbc.XArray|Array| |BinaryStream|.io.XInputStream|BinaryStream| |Boolean|boolean|Boolean| |Blob|.sdbc.XBlob|Blob| |Byte|byte|Byte| |Bytes|[]byte|Bytes| |CharacterStream|.io.XInputStream|CharacterStream| |Clob|.sdbc.XClob|Clob| |Date|.util.Date|Date| |Double|double|Double| |Float|float|Float| |Int|long|Int| |Long|hyper|Long| |Ref|.sdbc.XRef|Ref| |Short|short|Short| |String|string|String| |Time|.util.Time|Time| |Timestamp|.util.DateTime|Timestamp| |Value|any|値| |