#INCLUDE "moa.module"
#INCLUDE "course.module"

PROC main(CHAN BYTE kyb, scr, err)
  CHAN MYSQL.CONTROL control:
  CHAN MYSQL.RESULT result:
  INITIAL BOOL quit IS FALSE:
  PAR
    MySQL(control, result, "bach-1", "root", "latte", "test", 0, "")
    SEQ --control process
      control ! query.all; "SELECT ** FROM t3"
      control ! quit
    WHILE NOT quit --output process
      result ? CASE
        connected
          SKIP
        INT rows:
        data.ready; rows
          SKIP
        MOBILE []MOBILE []BYTE row:
        data.row; row
          SEQ j = 0 FOR SIZE row 
            SEQ
              out.string(row[j], 0, scr)
              IF
                j < ((SIZE row) - 1)
                  scr ! ' '
                TRUE
                  scr ! '*n'
        end.of.data
          SKIP
        quit
          SEQ
            scr ! FLUSH
            quit := TRUE
:
