next up previous contents
Next: The MySQL.init process Up: Documentation of the API Previous: Overview of the protocols   Contents


An example program: simple.occ


#INCLUDE "mysql.inc"
#USE "mysql.lib"

#INCLUDE "consts.inc"
#USE "course.lib"

PROC main(CHAN BYTE kyb, scr, err)
  CHAN MYSQL.CONTROL control:
  CHAN MYSQL.RESULT result:
  BOOL quit:
  PAR
    MySQL(control, result, "bach-1", "root", "latte", "test", 0, "")
    SEQ --control process
      control ! query.all; "SELECT ** FROM t3"
      control ! quit
    SEQ --output process
      quit := FALSE
      WHILE NOT quit
        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
:



Espen Suenson 2006-07-07