Zeos tutorial/de

From Lazarus wiki
Jump to navigationJump to search

Überblick

Dieses Tutorial ist über das Erhalten, Installieren und Verwenden von Zeoslib mit Lazarus und FPC.

Das Zeos Team hat vor kurzem ein neues Forum erstellt. Bitte besuchen sie das neue Forum für mehr Informationen über ZeosLib und um Fragen zu stellen / zu beantworten über die Verwendung von Zeos und um Bugs zu melden. Das neue Forum ist hier zu finden Forum für ZeosLib oder hier Zeos Forum

Erhalten von Zeos

Zeos has recently been ported to Lazarus and there are no releases yet that officially support it but you can easily get it from CVS if you follow these steps:

  • Set the system path to include your cvs client (if necessary) depending on what client you chose or configure your GUI client to use this CVSROOT -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/zeoslib.
  • If you have configured your system path open a terminal/console/dosbox and go to the directory where you store your cvs and type:
    cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/zeoslib checkout zeosdbo_rework
  • You should see some progress, after all files have been downloaded go to the zeosdbo_rework directory and have a look at what it contains.
  • For every day usage do not use checkout but instead go to the zeosdbo_rework directory and type cvs -z3 update -P

Installieren der Komponenten

Dies ist ein komplizierter Teil. Daher sollten sie etwas Geduld haben und diesen Teil sorgfältig lesen.

  • Starten sie eine Instanz von Lazarus.
  1. Benutzen sie Komponenten/Paketdatei (.lpk) öffnen im Hauptmenü.
  2. Gehen si zu zeosdbo_rework\packages\lazarus\ und öffnen ZCore.lpk
  3. Drücken sie [Kompilieren] (und warten ...)
  4. Drücken sie [Installieren]
  5. Eine Meldung wird erscheinen, um sie zu informieren, daß dies ein Laufzeit Package ist, welches nicht installiert werden kann.
  6. Drücken sie [Ignorieren]
  7. Sie werden gefragt, ob sie Lazarus rekompileren wollen.
  8. Antworten sie [Nein]
  9. Schließen sie das Installationsformular.
  • Wiederholen sie die Schritte 1 bis 9 für die folgenden Packages (anstelle von Zcore.lpk öffnen):
    • - ZParseSql.lpk
    • - ZPlain.lpk
    • - ZDbc.lpk
  • Jetzt wiederholen sie die Schritte 1 bis 6 für das Package ZComponent.lpk
  • Sie werden gefragt, ob sie Lazarus rekompileren wollen.
  • Antworten sie diesmal mit [Yes] .
  • Warten sie bis die Kompilierung beendet ist. Lazarus sollte sich danach selbst neu starten.
  • Wenn alles ok ist, sollten sie jetzt den [Zeos Access] Tab in der Komponentenpalette sehen.

Anmerkungen

Currently Zeos CVS for Lazarus has broken packages. Some comments from IgD:

Using a fresh install of Laz 0.9.10 (latest stable version) I was able to install ZeosLib dated 13 Oct 05. First fix the following bugs in ZeosLib:

  • 1. Change ZplainPostgreSql81.pas to ZPlanPostgresSql8x.pas in zplain.lpk
<Item22>
  <Filename Value="../../src/plain/ZPlainPostgreSql81.pas"/>
  <UnitName Value="ZPlainPostgreSql8x"/>
</Item22>

  • 2. Fix the following typos in zdbc.lpk:

a. Remove extra "/" from "build/" (remove the one that is inside the quotes)

<SearchPaths>
  <OtherUnitFiles Value="../../src/dbc/"/>
  <UnitOutputDirectory Value="build/"/>
</SearchPaths>

b. Add missing quote to unitname value

<Item43>
  <Filename Value="../../src/dbc/ZDbcASA.pas"/>
  <UnitName Value="ZDbcASA/>
</Item43>

Now, here are the installation instructions:

With Lazarus, open each of the zeos packages via Components/Open Package File in the following order:

  1. zcore.lpk
  2. zparsesql.lpk
  3. zplain.lpk
  4. zdbc.lpk


Then finally open zcomponent.lpk and compile and install this package.

Note: The first four packages only need to be compiled and cannot be installed.

--Forest 17:41, 2 Nov 2005 (CET)

Erstellen ihrer ersten Zeos Anwendung

  • Legen sie eine ZConnection ab (auf ihrem Formular).
    • Setzen sie ihren User, Password, Host, Port und Protocol (und jeden anderen Parameter falls benötigt).
    • Setzen sie Connected auf True.
  • Legen sie eine ZQuery ab (nicht mit ZReadOnlyQuery verwechseln).
    • Setzen sie Connection auf ihre aktive ZConnection.
    • Setzen sie die SQL Eigenschaft auf etwas wie SELECT * FROM MyTable
    • Setzen sie Active auf True.
  • Legen sie eine DataSource vom [Data Access] Tab ab.
    • Setzen sie DataSet auf ihre aktive ZQuery.
  • Legen sie ein DBGrid vom [Data Controls] Tab ab.
    • Setzen sie Datasource auf ihre DataSource.
    • Wenn alles ok ist, sollten sie jetzt die Datensätze aus ihrer Tabelle sehen.

Mehr Informationen über das Arbeiten mit Zeos

Hier können sie einige wirklich hilfreiche Artikel finden, welche die Verwendung von Zeos beschreiben und seine Interna, einige von ihnen handeln auch über Delphi spezifischen Stoff aber meistens können die gleichen Techniken ebenfalls in Lazarus verwendet werden.


Bitte ergänzen sie diesen Bereich

Mögliche Bugs und Probleme

  1. I have noticed that somethimes when buliding Lazarus it cannot find some Zeos files, as a quick workaround try this:
    • Use Components/Package Graph from the main menu.
    • Open the ZComponent package.
    • Right Click on the Files item in the list.
    • Choose [Recompile all required].
    • When asked "Re-Compile this and all required packages?" answer [Yes].
    • Recompile Lazarus normally (with packages).

  2. There is a bug in FPC's AnsiStrComp wich causes unreliable PChar comparison, this is obvious when using a DBGrid to edit data, AnsiStrComp('abc', 'abcd') can't detect them as being different but it detects AnsiStrComp('abd', 'abcd') ignoring multiple chars from the second string. This bug was found by Jesusrmx. It will probably be fixed soon, see Bug Report.