Difference between revisions of "postgres/es"

From Free Pascal wiki
Jump to navigationJump to search
(New page: == Overview - interface to PostGreSQL == You can use Free Pascal to access a PostGreSQL database server from Linux. (for more info on PostGreSQL, see their home page.) Interfacing is ve...)
 
Line 1: Line 1:
== Overview - interface to PostGreSQL ==  
+
== Overview - interface con PostGreSQL ==  
  
You can use Free Pascal to access a PostGreSQL database server from Linux. (for more info on PostGreSQL, see their home page.)
+
Se puede utilizar FreePascal para acceder a una base de datos PostGreSQL desde Linux. (para más información sobre PostGreSQL, visitar su página web).
  
Interfacing is very easy, all you need to do is compile some units, and use these units in your program. You need to specify the place of the PostGreSQL client Library (libpq) when compiling, and that is it. the provided units take care of the rest.
+
Realizar el interface es muy fácil, todo lo que necesitas para ello es compilar algunas unidades para posteriormente utilizarlas en el programa. Se necesita especificar el lugar donde se encuentra la librería cliente de PostGreSQL(libpq.dll)cuando se procede a realizar la compilación y poco más.
 +
 
 +
La unidad principal se llama '''postgres''', y normalmente es la única unit adicional que requiere que sea añadida en la clausula uses para lograr dicho interface.
  
The main unit is called '''postgres''', normally this is the only unit you must include in your uses clause.
 
 
== Requirements ==  
 
== Requirements ==  
 
You need at least version 0.99.5 of Free Pascal. The headers are translated from PostGreSQL version 6.3.1. Using an earlier version may not work.
 
You need at least version 0.99.5 of Free Pascal. The headers are translated from PostGreSQL version 6.3.1. Using an earlier version may not work.

Revision as of 01:30, 5 April 2009

Overview - interface con PostGreSQL

Se puede utilizar FreePascal para acceder a una base de datos PostGreSQL desde Linux. (para más información sobre PostGreSQL, visitar su página web).

Realizar el interface es muy fácil, todo lo que necesitas para ello es compilar algunas unidades para posteriormente utilizarlas en el programa. Se necesita especificar el lugar donde se encuentra la librería cliente de PostGreSQL(libpq.dll)cuando se procede a realizar la compilación y poco más.

La unidad principal se llama postgres, y normalmente es la única unit adicional que requiere que sea añadida en la clausula uses para lograr dicho interface.

Requirements

You need at least version 0.99.5 of Free Pascal. The headers are translated from PostGreSQL version 6.3.1. Using an earlier version may not work. Installation The prostgres unit comes with the Free Pascal packages, and is distributed together with the compiler. This contains a directory postgres with the units, a test program and a makefile. cd to the directory and edit the Makefile to set the variables for your system. You must provide only 1 thing:

  1. The directory where the libpq library resides, usually /usr/local/pgsql/lib

Typing

make

Should compile the units and the program. If compilation was succesfull, you can install with

make install

(Remember to set the directory where the units should be installed.)

You can then test the program by running

make test

This will:

  • Run the test program testpg. It is a straightforward pascal translation of the example program in the PostGreSQL programmers' guide.
  • Run a script to create a table in a database, and fill it with some data. (the psql program should be in your PATH for this) . By default, the used database is testdb.
  • Run the testprogram testemail
  • Run a shell script again to remove the created table.

You will see a lot of messages on your screen, giving you feedback and results. If something went wrong, make will inform you of this. Future plans The interface to PostGreSQL is a pure translation of the PostGreSQL C header files. This means that the used functions are rather un-pascalish. It would be great to have an OOP interface for it, A la Delphi. This interface is being worked on.

Go to back Packages List