DataTableセル管理系¶
| 関数名 | 引数 | 戻り値 |
|---|---|---|
DT_CELL_GET | string, int, string(, int) | int |
DT_CELL_GETS | string, int, string(, int) | string |
DT_CELL_ISNULL | string, int, string(, int) | int |
DT_CELL_SET | string, int, string(, any, int) | int |
API
int DT_CELL_GET dataTableName, row, columnName(, asId)
string DT_CELL_GETS dataTableName, row, columnName(, asId)
int DT_CELL_ISNULL dataTableName, row, columnName(, asId)
int DT_CELL_SET dataTableName, row, columnName(, value, asId)
DataTable(データベース,DataTableクラスを基づき)のセルを操作する関数です。
DT_CELL_GET:dataTableNameに対応するDataTableに行rowの列columnNameの整数を返します。失敗した場合、0を返します。asIdが1の場合,列idの値がrowの行にあたります。asIdがそれ以外場合,第row行(0行から始まる)にあたります。
DT_CELL_GETS:dataTableNameに対応するDataTableに行rowの列columnNameの文字列を返します。失敗した場合、空文字列を返します。DT_CELL_ISNULL:dataTableNameに対応するDataTableに行rowの列columnNameの値が空き(整数でも文字列でもない)の場合1を返します。- 戻り値が
0の場合,該当値が空きではありません。 - 戻り値が
-1の場合,DataTable自体が存在しません。 - 戻り値が
-2の場合,該当する行か列が存在しません。
- 戻り値が
DT_CELL_SET:dataTableNameに対応するDataTableに行rowの列columnNameの値をvalueで代入します。valueを省略した場合,空きで代入します。- 戻り値が
1の場合,代入が成功しました。 - 戻り値が
0の場合,列idに値を代入しようとしました。 - 戻り値が
-1の場合,DataTable自体が存在しません。 - 戻り値が
-2の場合,valueの型が該当するセルの型と違います。 - 戻り値が
-3の場合,該当する行か列が存在しません。
- 戻り値が
注意
列idの値を編集することができません。
ヒント
命令、式中関数両方対応しています。
例
MAIN.ERB
@SYSTEM_TITLE
#DIM id
DT_CREATE "db"
DT_COLUMN_ADD "db", "name"
DT_COLUMN_ADD "db", "height", "int16"
DT_COLUMN_ADD "db", "age", "int16"
id = DT_ROW_ADD("db", "name", "Name1", "age", 11)
DT_ROW_ADD "db", "name", "Name2", "age", 21, "height", 164
DT_ROW_ADD "db", "name", "Name3", "age", 18, "height", 159
DT_ROW_ADD "db", "name", "Name4", "age", 33, "height", 180
DT_ROW_ADD "db", "name", "Name5", "age", 18, "height", 172
PRINTFORML 第1行の列heightの値は\@DT_CELL_ISNULL("db", id, "height", 1)==1?空き#空きではない\@
DT_CELL_SET "db", 0, "height", 132
PRINTFORM 第1行 - 名前:%DT_CELL_GETS("db", 0, "name")%
PRINTFORM 年齢:{DT_CELL_GET("db", 0, "age")}
PRINTFORML 身長:{DT_CELL_GET("db", 0, "height")}
ONEINPUT
結果
第1行の列heightの値は空き
第1行 - 名前:Name1 年齢:11 身長:132