Difference between revisions of "Zeos tutorial/de"

From Lazarus wiki
Jump to navigationJump to search
Line 95: Line 95:
 
== Erstellen ihrer ersten Zeos Anwendung ==
 
== Erstellen ihrer ersten Zeos Anwendung ==
  
* Drop a '''ZConnection'''.
+
* Legen sie eine '''ZConnection''' ab (auf ihrem Formular).
** Set your User, Password, Host, Port and Protocol (and any other params if needed).
+
** Setzen sie ihren User, Password, Host, Port und Protocol (und jeden anderen Parameter falls benötigt).
** Set Connected to True.
+
** Setzen sie Connected auf True.
  
* Drop a '''ZQuery''' (<font color=red>do not mistake with ZReadOnlyQuery</font>).
+
* Legen sie eine '''ZQuery''' ab (<font color=red>nicht mit ZReadOnlyQuery verwechseln</font>).
** Set the Connection to your active ZConnection.
+
** Setzen sie Connection auf ihre aktive ZConnection.
** Set the Sql property to something like '''SELECT * FROM MyTable'''
+
** Setzen sie die SQL Eigenschaft auf etwas wie '''SELECT * FROM MyTable'''
** Set Active to True.
+
** Setzen sie Active auf True.
  
* Drop a '''DataSource''' from the '''[Data Access]''' tab.
+
* Legen sie eine '''DataSource''' vom '''[Data Access]''' Tab ab.
** Set the DataSet to your active ZQuery.
+
** Setzen sie DataSet auf ihre aktive ZQuery.
  
* Drop a '''DBGrid''' from the '''[Data Controls]''' tab.
+
* Legen sie ein '''DBGrid''' vom '''[Data Controls]''' Tab ab.
** Set the Datasource to your DataSource.
+
** Setzen sie Datasource auf ihre DataSource.
** If all is ok you should now be able to see the records from your table.
+
** Wenn alles ok ist, sollten sie jetzt die Datensätze aus ihrer Tabelle sehen.
  
 
== Mehr Informationen über das Arbeiten mit Zeos ==
 
== Mehr Informationen über das Arbeiten mit Zeos ==

Revision as of 16:00, 26 November 2005

Ü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

Here you can find some really useful articles explaining Zeos usage and it's internals, some of them also talk about Delphi specific stuff but mostly the same techniques can be used in Lazarus too.


Please complete me :)

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.