
1 // 2 // Copyright (c) 2007, Brian Frank and Andy Frank 3 // Licensed under the Academic Free License version 3.0 4 // 5 // History: 6 // 29 Jun 07 Brian Frank Creation 7 // 8 9 ** 10 ** Col models the column of a relational table. Col is a 11 ** subclass of Field and uses the standard reflection APIs. 12 ** 13 ** Refer to the [Sql docs]`docLib::Sql` for more details. 14 ** 15 class Col : Field 16 { 17 18 ** 19 ** Construct a column for the given meta-data. 20 ** 21 new make(Int index, Str name, Type of, Str sqlType, Str:Obj facets := null) 22 : super(name, of, facets) 23 { 24 this.index = index 25 this.sqlType = sqlType 26 } 27 28 ** 29 ** Get the cell of a row. 30 ** 31 override Obj get(Obj row) 32 { 33 return ((Row)row).get(this) 34 } 35 36 ** 37 ** Set the cell of a row. 38 ** 39 override Void set(Obj row, Obj val) 40 { 41 ((Row)row).set(this, val) 42 } 43 44 ** Zero based index of the column in the query result. 45 const Int index 46 47 ** The type of the column as defined by the SQL database. 48 const Str sqlType 49 50 }