Difference between revisions of "TPSQL/de"

From Free Pascal wiki
Jump to navigationJump to search
 
m (ß -> ss)
 
(4 intermediate revisions by one other user not shown)
Line 24: Line 24:
 
   - ClientEncoding Eigenschaft zur TPSQLDatabase class hinzugefügt.  
 
   - ClientEncoding Eigenschaft zur TPSQLDatabase class hinzugefügt.  
 
* Version 0.4.2 2005/06/03  
 
* Version 0.4.2 2005/06/03  
   - Some changes to destroy method of TPSQLDatabase/TPSQLDataset for avoiding exception
+
   - Einige Änderungen an der destroy Methode von TPSQLDatabase/TPSQLDataset zur Vermeidung von Exceptions
 
     when closing IDE/project with components in Active/Connected status.
 
     when closing IDE/project with components in Active/Connected status.
   - Base path in archived files changed from 'usr/share/lazarus/components/psql' to 'psql'
+
   - Base path in archived files geändert von 'usr/share/lazarus/components/psql' zu 'psql'
 
* Version 0.4.6 2005/06/06
 
* Version 0.4.6 2005/06/06
 
   - Executing queries that doesn't return data column now raises an exception.
 
   - Executing queries that doesn't return data column now raises an exception.
   - commandQuery function added (see Usage section).
+
   - commandQuery Funktion hinzugefügt (siehe Verwendung Abschnitt).
   - beginTransaction/commitTransaction/rollbackTransaction support added (see Usage section).
+
   - beginTransaction/commitTransaction/rollbackTransaction Unterstützung hinzugefügt (siehe Verwendung Abschnitt).
   - More ClientEncoding entities added.
+
   - Weitere ClientEncoding Entitäten hinzugefügt.
  
 
=== Abhängigkeiten / Systemvoraussetzungen ===
 
=== Abhängigkeiten / Systemvoraussetzungen ===
Line 42: Line 42:
  
 
=== Installation ===
 
=== Installation ===
* In the lazarus/components directory, untar (unzip) the files from psql-laz-package-<version>.tar.gz file. The psql folder will be created.
+
* Im lazarus/components Verzeichnis entpacken sie die Dateien aus der psql-laz-package-<version>.tar.gz Datei. Der psql Ordner wird erzeugt.
* Open lazarus
+
* Öffnen sie Lazarus
* Open the package psql_laz.lpk with Component/Open package file (.lpk)
+
* Öffnen sie das Package psql_laz.lpk unter Komponenten -> Paketdatei (.lpk) öffnen ...
* Click on Compile
+
* (Klicken sie auf Kompilieren nur dann, wenn sie das Package nicht in die IDE installieren wollen)
* Click on Install and answer 'Yes' when you are asked about Lazarus rebuilding. A new tab named 'PSQL' will be created in the components palette.
+
* Klicken sie auf Installieren und antworten mit 'Ja' wenn sie gefragt werden, ob Lazarus neu erstellt werden soll. Ein neuer Tab namens 'PSQL' wird in der Komponentenpalette erzeugt.
  
'''Important note for Win32 users.'''
+
'''Wichtige Anmerkung für Win32 Benutzer.'''
  In case you experience some difficults in compiling the Pascal files in the package, you may need
+
  In dem Fall, dass sie einige Schwierigkeiten beim Kompilieren der Pascal Dateien im Package erleben, mögen sie den folgenden Pfad:  
to add the following path:  
 
 
    
 
    
 
  <some-drive>:<some-path>\lazarus\lcl\units\i386-win32  
 
  <some-drive>:<some-path>\lazarus\lcl\units\i386-win32  
  (ie: c:\programs\lazarus\lcl\units\i386-win32)
+
  (d.h.: c:\programs\lazarus\lcl\units\i386-win32)
 
    
 
    
  to the 'Other unit files ...' in 'Paths' tab of 'Compiler Options' of the lazarus package manager 
+
  zu 'Andere Unitdateien' in 'Pfade' der 'Compilereinstellungen' des Lazarus Packagemanager Fenster hinzufügen.
window.
 
  
 
=== Verwendung ===
 
=== Verwendung ===
Drop a TPSQLDatabase component on a form, for any different PostgreSQL database your application needs to connect to.
+
Legen sie eine TPSQLDatabase Komponente auf einem Formular ab, für jede verschiedene PostgreSQL Datenbank, mit der sich ihre Anwendung verbinden muss.
Mandatory property of this component you have to set are:
+
Zwingende Eigenschaften dieser Komponente, die sie setzen müssen, sind:
  
* DatabaseName : The name of the PostgreSQL database that your application needs to connect to.
+
* DatabaseName : Der Name der PostgreSQL Datenbank, mit der sich ihre Anwendung verbinden muss.
* HostName : the IP address or the URL of the PC hosting the PostgreSQL server.
+
* HostName : Die IP Adresse oder die URL des PC's, auf dem der PostgreSQL Server gehostet ist.
* UserName : The name of an user having permission to access to host/database.
+
* UserName : Der Name eines Benutzers, der Zugriffsrechte auf Host/Datenbank hat.
  
Optionally you may need to set Password property for correct connection to server. Then,  
+
Optional müssen sie evtl. die Password Eigenschaft setzen für eine korrekte Verbindung zum Server. Dann,  
to activate the connection, you neet to set the Connected property to 'True'. An exception will
+
um die Verbindung zu aktivieren, müssen sie die Connected Eigenschaft auf 'True' setzen. Eine Exception wird ausgelöst, wenn die Verbindung fehlgeschlagen ist (falsche Parameter, Benutzer ohne Zugriffsrechte,
be raised if connection failed (wrong parameters, user with no permission to access the host/database,
+
Netzwerkfehler oder der PostgreSQL Server ist nicht aktiv). Setzen sie die Eigenschaft auf 'False' um die Verbindung zu schließen.
network errors or PostgreSQL server not active). Set this property to 'False' for closing connection.
 
  
'''- Note about the ClientEncoding property.'''
+
'''- Anmerkung über die ClientEncoding Eigenschaft.'''
  
  The ClientEncoding property allows user to set a character set for the client
+
  Die ClientEncoding Eigenschaft erlaubt dem Benutzer to set a character set for the client
 
  application different from the one defined for the database. The PostgreSQL server
 
  application different from the one defined for the database. The PostgreSQL server
 
  make a 'translation' between the two sets.  However a "ClientEncoding change failed"  
 
  make a 'translation' between the two sets.  However a "ClientEncoding change failed"  
Line 79: Line 76:
 
  a database character set incompatible with the clientencoding you selected. IE,   
 
  a database character set incompatible with the clientencoding you selected. IE,   
 
  the char set 'LATIN9' is not compatible with a  'WIN1250'. You select the default
 
  the char set 'LATIN9' is not compatible with a  'WIN1250'. You select the default
  char set for the whole database cluster when you create it with the command
+
  char set for the whole database cluster when you create it mit dem Kommando
  'initdb', using the -E optionIE.   'initdb -E UNICODE'.  Also, you can define a
+
  'initdb', unter Verwendung der -E Optiond.h.  'initdb -E UNICODE'.  Also, you can define a
 
  different character set for any database you create (different from the  
 
  different character set for any database you create (different from the  
  default one of the whole db cluster),  also with the -E option:
+
  default one of the whole db cluster),  auch mit der -E Option:
 
   
 
   
  IE. 'createdb  -E UNICODE Test'  
+
  d.h. 'createdb  -E UNICODE Test'  
 
    
 
    
                     or
+
                     oder
 
   
 
   
 
  CREATE DATABASE TEST WITH ENCODING 'UNICODE';
 
  CREATE DATABASE TEST WITH ENCODING 'UNICODE';
 
   
 
   
  (note you must  quote the character set name in the 'CREATE DATABASE' command).
+
  (Anmerkung: Sie müssen den character set Namen in Anführungszeichen setzen in dem 'CREATE DATABASE' Kommando).
 
   
 
   
  I suggest to set UNICODE character set as the default for your db cluster (or for the
+
  Ich empfehle, den UNICODE character set als Vorgabe einzustellen für your db cluster (oder für die Datenbank,
  database you create), because it is compatible with the whole set of charset available
+
  die sie erzeugen), weil es kompatibel ist mit the whole set of charset available
 
  for the client, except the MULE_INTERNAL.
 
  for the client, except the MULE_INTERNAL.
  
 
Now you may drop a TPSQLDataset component on the form for any table connection you need. The main property to
 
Now you may drop a TPSQLDataset component on the form for any table connection you need. The main property to
 
set on this component type is the Database one. A dropdown menu allows you to select one of any TDatabase descendant
 
set on this component type is the Database one. A dropdown menu allows you to select one of any TDatabase descendant
component present on form (of course, you must select a TPSQLDatabase component).
+
component present on form (natürlich müssen sie eine TPSQLDatabase Komponente wählen).
  
 
You also need to provide a valid SQL statement in SQL property. Now, you are able to open the TPSQLDataset,
 
You also need to provide a valid SQL statement in SQL property. Now, you are able to open the TPSQLDataset,
 
setting to 'True' the Active property. Several exceptions are provided for signaling failing conditions.
 
setting to 'True' the Active property. Several exceptions are provided for signaling failing conditions.
Please, refer to TDataSet documentation for infos and examples about using the TPSQLDataset component
+
Please, refer to TDataSet documentation für Infos und Beispiele über die Verwendung der TPSQLDataset Komponente
in order to access to SQL retrieved data rows as well as conneting to Data Controls components. However, procedures and functions added to parent class are explained here:
+
in order to access to SQL retrieved data rows as well as conneting to Data Controls components. However, procedures and functions added to parent class sind hier beschrieben:
  
 
- function '''commandQuery ( query : String) : ShortInt'''.  
 
- function '''commandQuery ( query : String) : ShortInt'''.  
  Use this function for submit queries that doesn't returns data columns, as update queries
+
  Verwenden sie diese Funktion für submit queries that doesn't returns data columns, as update queries
  (ie. update, insert, delete etc.). Current dataset is not affected, however it will reflect  
+
  (d.h. update, insert, delete etc.). Current dataset is not affected, however it will reflect  
 
  changes made by execution of commandQuery itself, if it has some influence on current  
 
  changes made by execution of commandQuery itself, if it has some influence on current  
  dataset.Function returns 0 if succeded, -1 if failed. No exceptions are provided.
+
  dataset. Die Funktion gibt 0 zurück, wenn sie erfolgreich war, -1 bei einem Fehlschlag. Exceptions werden nicht unterstütz.
  
 
- procedure '''beginTransaction'''
 
- procedure '''beginTransaction'''
                           Starts a SQL transaction session. Changes to table may be submitted
+
                           Startet eine SQL transaction session. Changes to table may be submitted
 
                           using the commandQuery function.
 
                           using the commandQuery function.
 
- procedure '''commitTransaction'''  
 
- procedure '''commitTransaction'''  
                           Ends a SQL transaction session, commiting changes submitted starting
+
                           Beendet eine SQL transaction session, commiting changes submitted starting
 
                           from last beginTransaction execution.
 
                           from last beginTransaction execution.
 
- procedure '''rollbackTransaction'''
 
- procedure '''rollbackTransaction'''
                           Ends a SQL transaction session, aborting changes.
+
                           Beendet eine SQL transaction session, aborting changes.

Latest revision as of 18:45, 19 October 2010

Deutsch (de) English (en) español (es)

Über

TPSQL ist ein modifizierte-LGPL Package für Lazarus. Es definiert zwei Komponenten, TPSQLDatabase und TPSQLDataset, welche Anwendungen die Verbindung zu PostgreSQL Datenbankservern über TCP/IP Netzwerke erlauben.

Der Download enthält die Komponenten-Pascal-Dateien, die Lazarus Package Datei, Ressourcendateien und die modifizierte-LGPL Lizenz-Textdateien.

Diese Komponenten wurden entwickelt für Anwendungen, die auf Linux oder Win32 Plattformen laufen.

Autor

Antonio d'Avino

Lizenz

Modifizierte LGPL (lesen sie COPYING.modifiedLGPL und COPYING.LGPL die im Package enthalten sind).

Download

Das letzte stabile Release ist zu finden auf der Lazarus CCR Files Seite oder auf den Internetseiten des Autors http://infoconsult.homelinux.net.

Änderungs Log

  • Version 0.4.0 2005/06/01
  • Version 0.4.1 2005/06/02
 - ClientEncoding Eigenschaft zur TPSQLDatabase class hinzugefügt. 
  • Version 0.4.2 2005/06/03
 - Einige Änderungen an der destroy Methode von TPSQLDatabase/TPSQLDataset zur Vermeidung von Exceptions
   when closing IDE/project with components in Active/Connected status.
 - Base path in archived files geändert von 'usr/share/lazarus/components/psql' zu 'psql'
  • Version 0.4.6 2005/06/06
 - Executing queries that doesn't return data column now raises an exception.
 - commandQuery Funktion hinzugefügt (siehe Verwendung Abschnitt).
 - beginTransaction/commitTransaction/rollbackTransaction Unterstützung hinzugefügt (siehe Verwendung Abschnitt).
 - Weitere ClientEncoding Entitäten hinzugefügt.

Abhängigkeiten / Systemvoraussetzungen

  • Lazarus 0.9.6 (FPC 1.9.8)

Status: Stabil

Sachverhalte: Getestet unter Windows (Win2K) und Linux (Mdk 10.1). Datenbankserver: PostgreSQL 8.0.3 (laufend auf beiden Plattformen).

Installation

  • Im lazarus/components Verzeichnis entpacken sie die Dateien aus der psql-laz-package-<version>.tar.gz Datei. Der psql Ordner wird erzeugt.
  • Öffnen sie Lazarus
  • Öffnen sie das Package psql_laz.lpk unter Komponenten -> Paketdatei (.lpk) öffnen ...
  • (Klicken sie auf Kompilieren nur dann, wenn sie das Package nicht in die IDE installieren wollen)
  • Klicken sie auf Installieren und antworten mit 'Ja' wenn sie gefragt werden, ob Lazarus neu erstellt werden soll. Ein neuer Tab namens 'PSQL' wird in der Komponentenpalette erzeugt.

Wichtige Anmerkung für Win32 Benutzer.

In dem Fall, dass sie einige Schwierigkeiten beim Kompilieren der Pascal Dateien im Package erleben, mögen sie den folgenden Pfad: 
 
<some-drive>:<some-path>\lazarus\lcl\units\i386-win32 
(d.h.: c:\programs\lazarus\lcl\units\i386-win32)
 
zu 'Andere Unitdateien' in 'Pfade' der 'Compilereinstellungen' des Lazarus Packagemanager Fenster hinzufügen.

Verwendung

Legen sie eine TPSQLDatabase Komponente auf einem Formular ab, für jede verschiedene PostgreSQL Datenbank, mit der sich ihre Anwendung verbinden muss. Zwingende Eigenschaften dieser Komponente, die sie setzen müssen, sind:

  • DatabaseName : Der Name der PostgreSQL Datenbank, mit der sich ihre Anwendung verbinden muss.
  • HostName : Die IP Adresse oder die URL des PC's, auf dem der PostgreSQL Server gehostet ist.
  • UserName : Der Name eines Benutzers, der Zugriffsrechte auf Host/Datenbank hat.

Optional müssen sie evtl. die Password Eigenschaft setzen für eine korrekte Verbindung zum Server. Dann, um die Verbindung zu aktivieren, müssen sie die Connected Eigenschaft auf 'True' setzen. Eine Exception wird ausgelöst, wenn die Verbindung fehlgeschlagen ist (falsche Parameter, Benutzer ohne Zugriffsrechte, Netzwerkfehler oder der PostgreSQL Server ist nicht aktiv). Setzen sie die Eigenschaft auf 'False' um die Verbindung zu schließen.

- Anmerkung über die ClientEncoding Eigenschaft.

Die ClientEncoding Eigenschaft erlaubt dem Benutzer to set a character set for the client
application different from the one defined for the database. The PostgreSQL server
make a 'translation' between the two sets.  However a "ClientEncoding change failed" 
exception may be the result of a ClientEncoding property change. This may be due to
a database character set incompatible with the clientencoding you selected. IE,  
the char set 'LATIN9' is not compatible with a  'WIN1250'. You select the default
char set for the whole database cluster when you create it mit dem Kommando
'initdb', unter Verwendung der -E Option:  d.h.  'initdb -E UNICODE'.  Also, you can define a
different character set for any database you create (different from the 
default one of the whole db cluster),  auch mit der  -E Option:

d.h. 'createdb  -E UNICODE Test' 
 
                    oder

CREATE DATABASE TEST WITH ENCODING 'UNICODE';

(Anmerkung: Sie müssen den character set Namen in Anführungszeichen setzen in dem 'CREATE DATABASE' Kommando).

Ich empfehle, den UNICODE character set als Vorgabe einzustellen für your db cluster (oder für die Datenbank, 
die sie erzeugen), weil es kompatibel ist mit the whole set of charset available
for the client, except the MULE_INTERNAL.

Now you may drop a TPSQLDataset component on the form for any table connection you need. The main property to set on this component type is the Database one. A dropdown menu allows you to select one of any TDatabase descendant component present on form (natürlich müssen sie eine TPSQLDatabase Komponente wählen).

You also need to provide a valid SQL statement in SQL property. Now, you are able to open the TPSQLDataset, setting to 'True' the Active property. Several exceptions are provided for signaling failing conditions. Please, refer to TDataSet documentation für Infos und Beispiele über die Verwendung der TPSQLDataset Komponente in order to access to SQL retrieved data rows as well as conneting to Data Controls components. However, procedures and functions added to parent class sind hier beschrieben:

- function commandQuery ( query : String) : ShortInt.

Verwenden sie diese Funktion für submit queries that doesn't returns data columns, as update queries
(d.h. update, insert, delete etc.). Current dataset is not affected, however it will reflect 
changes made by execution of commandQuery itself, if it has some influence on current 
dataset. Die Funktion gibt 0 zurück, wenn sie erfolgreich war, -1 bei einem Fehlschlag. Exceptions werden nicht unterstütz.

- procedure beginTransaction

                          Startet eine SQL transaction session. Changes to table may be submitted
                          using the commandQuery function.

- procedure commitTransaction

                          Beendet eine SQL transaction session, commiting changes submitted starting
                          from last beginTransaction execution.

- procedure rollbackTransaction

                          Beendet eine SQL transaction session, aborting changes.