Easy Language

EASY is a programming language used by TdbEngine.

It is a scripting language which merges elements of CeeLanguage, BasicLanguage and PascalLanguage, with main intense on CGI output creation and of course database querying. It is less powerful as any of these languages but still allows complex database applications to be realized with it.

Code-Examples

  PROCEDURE saveMarks(db : INTEGER; cDest : STRING) : INTEGER
  VAR hdl    : INTEGER
  VAR aMarks : TBITS[]
   InitArray?(aMarks[FileSize?(db)])
   GetMarks?(db, aMarks)
   IF hdl:=F_Create(cDest)>0 THEN
     F_Write(hdl,aMarks); F_Close(hdl)
   END
   RETURN NBits(aMarks)
  ENDPROC

This code snippet is a very simple example for a quite complex issue: Storing a selection result (= a bit mask) in a binary file for later re-use.

  PROCEDURE HandleSearch
  VAR user_selection : STRING
  VAR db, zeile : INTEGER
  VAR Formatstring : STRING
  Subst('#action#',ParamStr?(0))
  user_selection:=CGIGetParam('selection')
  Subst('#selection#',user_selection,1)
  SetPara?('ec 1')
  IF db:=OpenDB('database/address.dat')=0 THEN
    Subst('#hits#','Database NOT found')
  ELSE
    IF FindAndMark?(db,user_selection)=0 THEN
      Subst('#hits#','No matches')
    ELSE
      Formatstring:='#Name# #Firstname# #PLZ# #Ort#<br>'
      SortMark?(db,'Name,Firstname')
      zeile:=FirstMark?(db)
      WHILE zeile DO
        ReadRec?(db,zeile)
        Subst('#hits#',Formatstring+'#hits#')
        Subst('#Name#',db,'Name',1)
        Subst('#Firstname#',db,'Firstname',1)
        Subst('#ZIP#',db,'ZIP',1)
        Subst('#City#',db,'City',1)
        zeile:=NextMark?(db,zeile)
      END
      Subst('#hits#','')
    END
    CloseDB(db)
  END
  ENDPROC

PROCEDURE Main CGIWriteLn('content-type: text/html') CGIWriteLn('') LoadTemplate?('templates/addresssearch.html') HandleSearch CGIWriteTemplate ENDPROC
This is a simple example of a query on a database for certain addresses matching a user input as for example 'Name LIKE "Mill*"' '

A complete list of all functions and language specifiers can be read here: http://www.tdbengine.org/programm/o.prg?pos=9&lan=en


CategoryProgrammingLanguage


EditText of this page (last edited February 3, 2005) or FindPage with title or text search