logo

class

sql::Row

sys::Obj
  sql::Row
  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  ** Row models the row of a relational table.  The cells of
 11  ** a row are accessed using normal reflection.  The row type's
 12  ** fields will be instances of Col.
 13  **
 14  ** Refer to the [Sql docs]`docLib::Sql` for more details.
 15  **
 16  class Row
 17  {
 18  
 19    **
 20    ** Get a cell by column.
 21    **
 22    native Obj get(Col col)
 23  
 24    **
 25    ** Set a cell by column.
 26    **
 27    native Void set(Col col, Obj val)
 28  
 29    **
 30    ** Dump the cells separated by a comma.
 31    **
 32    override Str toStr()
 33    {
 34      s := StrBuf.make
 35      type.fields.each |Field f|
 36      {
 37        if (s.size > 0) s.add(", ")
 38        s.add(f.get(this))
 39      }
 40      return s.toStr
 41    }
 42  
 43  }

More Info

Slots