Deutsch English
Alphabetical index
Array functions
CGI functions
Data types
Date functions
Debugging
Fulltext functions
Language elements
Numerical functions
Operators
Other functions
Ramtext functions
Selecting
Socket functions
Statistical functions
Stream functions
String functions
System functions
Table functions
  • access()
  • andmarks()
  • autofield()
  • autorecno()
  • blobsize()
  • blobtype()
  • cleardat()
  • closedb()
  • copyblob()
  • copymemo()
  • dbdir()
  • dbname()
  • dbno()
  • dbrights()
  • deldb()
  • delindex()
  • delmark()
  • delmarkedrecords()
  • delmarks()
  • delrec()
  • editoff()
  • editon()
  • embedblob()
  • exists()
  • fields()
  • filemode()
  • fileno()
  • filesize()
  • findandmark()
  • findauto()
  • findrec()
  • firstmark()
  • firstrec()
  • flushdb()
  • fsum()
  • genindex()
  • getcode()
  • getdef()
  • getfield()
  • getmarks()
  • getmode()
  • getpw()
  • getrec()
  • getrfield()
  • getstructure()
  • gettype()
  • incrfield()
  • inddef()
  • indname()
  • indno()
  • ismark()
  • label()
  • labelno()
  • lastrec()
  • link()
  • linkblob()
  • linkinfo()
  • lock()
  • makedb()
  • markdoubles()
  • markindex()
  • markpattern()
  • maxfile()
  • maxlabel()
  • memolen()
  • memostr()
  • newtable()
  • nextmark()
  • nextrec()
  • nmarks()
  • opendb()
  • prevrec()
  • primfile()
  • primtable()
  • putmarks()
  • putrec()
  • readmemo()
  • readrec()
  • recno()
  • recno()
  • recnr()
  • regenall()
  • regenind()
  • relation()
  • rendb()
  • reopendb()
  • revmarks()
  • setalias()
  • setauto()
  • setfield()
  • setfields()
  • setfilter()
  • setmark()
  • setmarks()
  • setrecord()
  • setrfield()
  • sortmark()
  • treeinfo()
  • unlock()
  • writerec()
    Text functions
    Home    Overview    Search    Impressum    Contact    Members
    Topic complex Table functions
    Function getmarks()
    Short Saves a marking list
    Syntax GETMARKS(db : INTEGER; VAR marks) : INTEGER
    Parameter db : table handle from OpenDB
    marks : MARKS | INTEGER[] | REAL[] | TBITS[]
    Return 0 : operation successful
    else : error code (44 wrong type)
    See also:
    putmarks() genindex() getmarksauto() putmarksauto()
    Description In some cases you have to catch the marking list, because e.g. another selection to the table has to be made short-dated. For this purpose EASY has the functions »getmarks« and »putmarks«. These functions can be called with different arguments:

    VAR marks : MARKS
    getmarks(db,marks) // saves the marking list of db in marks
    putmarks(db,marks) // restores the saved marking list

    Tip: putmarks overwrites the actual marking list of db.

    The data type MARKS can only be used by these two functions. The big advantage to use a variable of the type MARKS is

    * only the really needed size of memory is used
    * the sorting within the marking list is kept

    But the marking list can also be saved in an INTEGER or REAL array. Here the programmer has to make sure that the REAL array has enough elements to save the whole list:

    VAR marks : INTEGER[]
    ...
    initarray(marks[nmarks(db)])
    getmarks(db,marks)
    putmarks(db,marks)

    After »getmarks(db,marks)« in »marks« there are the physical record numbers of the marking list. Here a procedure where the marking list is saved in an external text file:

    PROCEDURE SaveMarks(db : INTEGER);
    VAR text,i : INTEGER;
    VAR marks : INTEGER[];
      initarray(marks[nmarks(db)]);
      getmarks(db,marks);
      IF text:=rewrite('marks_save') THEN
        nloop(i,high(1,marks)-1,writeln(text,marks[i]));
        close(text)
      END
    ENDPROC

    Also the use of »getmarks« and »putmarks« with a REAL array keeps the order. The advantage is that the record numbers are there immediately handy and manipulable.

    Finally there is the possibility to use a variable of the type TBITS. To work correctly this field has to dimensioned that the it can map whole table:

    VAR marks : TBITS[]
    ...
    initarray(marks[filesize(db)])
    getmarks(db,marks)
    putmarks(db,marks)

    Here is after »getmarks(db,marks)«, that

    * marks[x]=1 if the record with the number x is in the marking list
    * marks[x]=0 otherwise

    Thus »marks« is a image of the subset of the table that is specified by the marking list. And as with every set the orders is lost! First of all the advantage of the use of TBITS is that with the functions

    * bitand(b_field1,b_field2)
    * bitor(b_field1,b_field2)
    * bitandnot(b_field1,b_field2)

    the most important set operations can be performed very efficiently. All three functions return the cardinality (number of 1) of »b_field_1« after the particular operation.

    bitand: b_feld1 := b_feld1 intersected with b_feld2
    bitor: b_feld1 := b_feld1 merged with b_feld2
    bitandnot: b_feld1 := b_feld1 intersected with the compliment of b_feld2 (difference in quantities)

    Working with the datatype TBITS is so efficient, that for example the fulltext search accesses basically to it(»markbits«).
    You will always use it if more than one - logical linked - selections to a table are executed.

    User comments:
    Write a comment:
    Name
    EMail
    Subject
    Text (Switch mode)

    Choose between
    the normal and the
    advanced editor.
    The advanced editor
    runs in IE 5+ and
    Mozilla 1.4+ only
    SPAM-Protection Please enter tdbengine in this field.

    tdbengine chat
    irc.tdbengine.org
    #tdbengine

       Copyright © 2003-2004 tdb Software Service GmbH
       Alle rechte vorbehalten. / All rights reserved
       Last changed: 21.10.2004
    {Fehler für :execmacro{execmacro="sessionspy"}