home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / database / tdb / demo / units02.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-06-29  |  2.7 KB  |  69 lines

  1. { ──────────────────────────────────────────────────────────────── }
  2. {   DEMOPROGRAMM FEHLERBEHANDLUNG DURCH DEFINITION ERROR-HANDLER   }
  3. { ──────────────────────────────────────────────────────────────── }
  4. { Versucht, für das Feld "Name" der Datenbank "DBDEMO06.DBF" einen }
  5. { Index zu erzeugen - was natürlich nicht klappt, da ich ja den    }
  6. { Error-Handler ausprobieren will ...                              }
  7. { ──────────────────────────────────────────────────────────────── }
  8. {       (c)  1992  by  Aurora  featuring  M.J. Schwaiger           }
  9. { ──────────────────────────────────────────────────────────────── }
  10. {      History:                                                    }
  11. { 1992-04-28   MS   Interfacefestlegung und Implementierung.       }
  12. { ──────────────────────────────────────────────────────────────── }
  13.  
  14. PROGRAM Units02;
  15.  
  16. {$UNDEF Windows}
  17. {$UNDEF Vision}
  18.  
  19.   USES
  20. {$IFDEF Windows}
  21.     WINCRT,
  22. {$ENDIF}
  23.     DbTypes,                { Enthält die Typdefinitionen für alle }
  24.                             { Module des Datenbanksystems TDB.     }
  25.     Error,                  { Fehlerbehandlungsroutinen, -handler  }
  26.     Units02a,                                     { Fehlerhandler  }
  27.     TDB;                    { Die eigentlichen Datenbank-Objekte.  }
  28.  
  29.  
  30.   VAR
  31.     DB             : PDataBase;                  { Datenbankobjekt }
  32.     Index1         : PIndex;                        { Indexobjekte }
  33.     CI             : TIdxCreateInfo;
  34.                           { Wird zum Initialisieren Index benötigt }
  35.  
  36.   BEGIN                                            { Hauptprogramm }
  37.     InstallHandlers;
  38.     SetUser ('Aurora / Markus Schwaiger');
  39.     SetLogMode (LmSafe);
  40.  
  41.     WRITELN (MEMAVAIL);
  42.  
  43.    { Speicherallozierung und Initialisierung des Datenbankobjektes }
  44.     DB := NEW (PDataBase,
  45.           Use ('C:\xyz$$@@.DBF')); { Wenn's die Datenbank gibt ... }
  46.  
  47.     IF (GetErr = 0) AND (DB^.Count > 0) THEN      { Keine Fehler ? }
  48.     BEGIN                                  { Wird nie ausgeführt ! }
  49.       CI.AField := 'STRASSE';                    { Auf Feld "Name" }
  50.       CI.Typ := NTX;                           { Typ Clipper-Index }
  51.       CI.IndexLen := 40;               { Schlüssellänge 20 Zeichen }
  52.       CI.KeyBuild := 'STRASSE';             { dBase-"Bauanleitung" }
  53.  
  54.                           { Initialisierung / Erstellung Indexfile }
  55.       Index1 := NEW (PIndex, Create ('UNITS02', CI, DB));
  56.  
  57.  
  58.       DB^.IndexOn ('STRASSE', Index1);
  59.  
  60.       DISPOSE (DB, Close);   { Index wird automatisch mit gelöscht ! }
  61.     END; { IF (GetErr = 0) AND ... }
  62.  
  63.     WRITELN (MEMAVAIL);
  64.  
  65.     WRITELN;
  66.     WRITE ('Weiter mit Taste ...');
  67.     READLN;
  68.   END. { PROGRAM Units02 }
  69.