Sign in Join
Wiki copytemporary

TPSQL/es: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11### Acerca de
22
33TPSQL e un paquete modificado bajo LGPL para Lazarus. Define dos componentes, TPSQLDatabase y TPSQLDataset, permitiendo a las aplicaciones conectar con servidores de bases de datos PostgreSQL en redes que utilizan TCP/IP.
44
55La descarga contiene los ficheros de componentes Pascal, el fichero de paquete para Lazarus y los ficheros de recursos junto con los ficheros de texto que describen la licencia modified-LGPL.
66
77Este componente fué diseñado para su utilización en aplicaciones corriendo bajo plataformas Linux y Win32.
88
99### Autor
1010
1111Antonio d'Avino
1212
1313### Licencia
1414
1515LGPL modificada (leer COPYING.modifiedLGPL y COPYING.LGPL que se incluyen en el paquete).
1616
1717### Descarga
1818
1919La última versión estable se puede encontrar en [Lazarus CCR Files page](http://sourceforge.net/project/showfiles.php?group_id=92177&package_id=98986) o en la página web del autor [<http://infoconsult.homelinux.net>](http://infoconsult.homelinux.net).
2020
2121### Historial de cambios
2222
2323- Version 0.4.0 2005/06/01
2424- Version 0.4.1 2005/06/02
2525
2626` - ClientEncoding property added to TPSQLDatabase class. `
2727
2828- Version 0.4.2 2005/06/03
2929
3030` - Some changes to destroy method of TPSQLDatabase/TPSQLDataset for avoiding exception`\
3131`   when closing IDE/project with components in Active/Connected status.`\
3232` - Base path in archived files changed from 'usr/share/lazarus/components/psql' to 'psql'`
3333
3434- Version 0.4.6 2005/06/06
3535
3636` - Executing queries that doesn't return data column now raises an exception.`\
3737` - commandQuery function added (see Usage section).`\
3838` - beginTransaction/commitTransaction/rollbackTransaction support added (see Usage section).`\
3939` - More ClientEncoding entities added.`
4040
4141### Dependencias / Requerimientos del sistema
4242
4343- Lazarus 0.9.6 (FPC 1.9.8)
4444
4545Stado: estable
4646
4747Issues: Testeado bajo Windows (Win2K) y Linux (Mdk 10.1). Servidor de base de datos: PostgreSQL 8.0.3 (corriendo en ambas plataformas).
4848
4949### Instalación
5050
5151- In the lazarus/components directory, untar (unzip) the files from psql-laz-package-\<version\>.tar.gz file. The psql folder will be created.
5252- Open lazarus
5353- Open the package psql_laz.lpk with Component/Open package file (.lpk)
5454- (Click on Compile only if you don't want to install the component into the IDE)
5555- 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.
5656
5757**Nota importante para los usuarios de Win32.**
5858
5959`En caso de experimentar dificultades a la hora de compilar los ficheros Pascal del paquete, puede que se necesite añadir  la siguiente trayectoria:`\
60-\
60+
6161` `\
6262`<some-drive>:<some-path>\lazarus\lcl\units\i386-win32 `\
6363`(ie: c:\programs\lazarus\lcl\units\i386-win32)`\
6464` `\
6565`to the 'Other unit files ...' in 'Paths' tab of 'Compiler Options' of the lazarus package manager   `\
6666`window.`
6767
6868### Usage
6969
7070Drop a TPSQLDatabase component on a form, for any different PostgreSQL database your application needs to connect to. Mandatory property of this component you have to set are:
7171
7272- DatabaseName : The name of the PostgreSQL database that your application needs to connect to.
7373- HostName : the IP address or the URL of the PC hosting the PostgreSQL server.
7474- UserName : The name of an user having permission to access to host/database.
7575
7676Optionally you may need to set Password property for correct connection to server. Then, to activate the connection, you neet to set the Connected property to 'True'. An exception will be raised if connection failed (wrong parameters, user with no permission to access the host/database, network errors or PostgreSQL server not active). Set this property to 'False' for closing connection.
7777
7878**- Note about the ClientEncoding property.**
7979
8080`The ClientEncoding property allows user to set a character set for the client`\
8181`application different from the one defined for the database. The PostgreSQL server`\
8282`make a 'translation' between the two sets.  However a "ClientEncoding change failed" `\
8383`exception may be the result of a ClientEncoding property change. This may be due to`\
8484`a database character set incompatible with the clientencoding you selected. IE,  `\
8585`the char set 'LATIN9' is not compatible with a  'WIN1250'. You select the default`\
8686`char set for the whole database cluster when you create it with the command`\
8787`'initdb', using the -E option:  IE.   'initdb -E UNICODE'.  Also, you can define a`\
8888`different character set for any database you create (different from the `\
8989`default one of the whole db cluster),  also with the  -E option:`\
90-\
90+
9191`IE. 'createdb  -E UNICODE Test' `\
9292` `\
9393`                    or`\
94-\
94+
9595`CREATE DATABASE TEST WITH ENCODING 'UNICODE';`\
96-\
96+
9797`(note you must  quote the character set  name in the 'CREATE DATABASE' command).`\
98-\
98+
9999`I suggest to set UNICODE character set as the default for your db cluster (or for the`\
100100`database you create), because it is compatible with the whole set of charset available`\
101101`for the client, except the MULE_INTERNAL.`
102102
103103Now 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 (of course, you must select a TPSQLDatabase component).
104104
105105You 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 for infos and examples about using the TPSQLDataset component 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:
106106
107107\- function **commandQuery ( query : String) : ShortInt**.
108108
109109`Use this function for submit queries that doesn't returns data columns, as update queries`\
110110`(ie. update, insert, delete etc.). Current dataset is not affected, however it will reflect `\
111111`changes made by execution of commandQuery itself, if it has some influence on current `\
112112`dataset.Function returns 0 if succeded, -1 if failed. No exceptions are provided.`
113113
114114\- procedure **beginTransaction**
115115
116116`                          Starts a SQL transaction session. Changes to table may be submitted`\
117117`                          using the commandQuery function.`
118118
119119\- procedure **commitTransaction**
120120
121121`                          Ends a SQL transaction session, commiting changes submitted starting`\
122122`                          from last beginTransaction execution.`
123123
124124\- procedure **rollbackTransaction**
125125
126126`                          Ends a SQL transaction session, aborting changes.`
127127
128128---
129129*From the Free Pascal wiki, page "TPSQL/es", as it stood on 2012-05-22 after a change by Iskraelectrica, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
130130Category: Castellano
131131Category: Español

Back to history