Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-02

Access to PostgreSQL

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pino Zollo

Hi to the list.

I am experimenting the features of lazarus, so I made a small program for reading from a PostgreSQL database.

It happens the following problem:

Fields of type "text" are shown as (blob)
Fields of type "real" are mis-interpreted values E-315 !!

Others fields appear correctly.

My program uses :
    Datasource1: TDatasource;
    DBGrid1: TDBGrid;
    psqlprova: TPQConnection;
    Query1: TSQLQuery;
    Transazione1: TSQLTransaction;

This is what psql correctly shows.
------------------
test=# SELECT call, name, qth, dxcc, qso_date, time_on, band, distance, freq FROM qso;

call | name | qth | dxcc | qso_date | time_on | band | distance | freq --------+---------+---------+------+------------+----------+-------+----------+---------- Dummy | | | | 2000-01-01 | | 20m | | I1BRT | Carlo | | 248 | 2009-10-05 | 19:30:00 | 600m | 10234 | 0.555542 IK1CHE | Alberto | Andrate | 248 | 2002-10-14 | 19:56:50 | 2190m | 10234 | 0.135546 YV4AB | | | 148 | 2009-12-21 | 22:43:07 | 20m | 13199 | 14.2 CO2NO | | | 70 | 2009-12-21 | 22:52:15 | 20m | 5918 | 14.2 (5 rows)
----------------

The attached .png shows what my program represents.

Thanks for your suggestions.

Pino

"In the universe there is no time existing as a physical reality, there is no past, no present and no future" "Time is a mind construction into which one experiences motion" "Time is a flow of irreversible material changes" -Davide Fiscaletti Key ID: 0xF6768208 Key fingerprint = B16D 0A7C 5B29 A334 CE6A 71F6 EAF8 3D88 F676 8208 Key server: hkp://wwwkeys.eu.pgp.net -------------- next part -------------- A non-text attachment was scrubbed... Name: psql3.png.zip Type: application/x-zip Size: 26062 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100219/e0d1ed93/attachment-0001.bin>

Reply by email

Marc Weustink
to Pino Zollo
Pino Zollo wrote 8 lines
Hi to the list. I am experimenting the features of lazarus, so I made a small program for reading from a PostgreSQL database. It happens the following problem: Fields of type "text" are shown as (blob)

True, iirc strings longer than 255 chars are teruned as blob.

Fields of type "real" are mis-interpreted values E-315 !!

How did you define those columns in the DB ?

Marc

PS. zipping an png is not really usefull.

Reply by email

Pino Zollo

Il sabato 20 febbraio 2010 08:00:00
ha scritto:

Show quoted text 39 lines
Send Lazarus mailing list submissions to To subscribe or unsubscribe via the World Wide Web, visit http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus or, via email, send a message with subject or body 'help' to You can reach the person managing the list at When replying, please edit your Subject line so it is more specific than "Re: Contents of Lazarus digest..." Today's Topics: 1. Re: Access to PostgreSQL (Marc Weustink) ---------------------------------------------------------------------- Message: 1 Date: Sat, 20 Feb 2010 00:39:02 +0100 From: Marc Weustink Subject: Re: [Lazarus] Access to PostgreSQL To: Lazarus mailing list Message-ID: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Pino Zollo wrote: > Hi to the list. > > I am experimenting the features of lazarus, so I made a small program for > reading from a PostgreSQL database. > > It happens the following problem: > > Fields of type "text" are shown as (blob)

Hi Marc,

True, iirc strings longer than 255 chars are teruned as blob.

They are defined as TEXT....as you can see in the psql results, some field is empty and still I get a (blob).

Show quoted text 5 lines
> Fields of type "real" are mis-interpreted values E-315 !! How did you define those columns in the DB ?

TEXT and REAL

Then I noticed that also times are returned without seconds.

It seems a lot of bugs !

I wonder if there is around some tutorial with simple examples about DB with Lazarus in Linux....and if it is any useful Lazarus at all.

Marc PS. zipping an png is not really usefull.

Not for who, like me, access to Internet via a cel-phone in GPRS and pays 3 $ for a total of 5Mb (Received+Transmitted)...
So is the life here in the country side of Paraguay !

Many thanks

Pino

"In the universe there is no time existing as a physical reality, there is no past, no present and no future" "Time is a mind construction into which one experiences motion" "Time is a flow of irreversible material changes" -Davide Fiscaletti Key ID: 0xF6768208 Key fingerprint = B16D 0A7C 5B29 A334 CE6A 71F6 EAF8 3D88 F676 8208 Key server: hkp://wwwkeys.eu.pgp.net

Reply by email

Marc Weustink
to Pino Zollo
Pino Zollo wrote 16 lines
> Pino Zollo wrote: >> Hi to the list. >> >> I am experimenting the features of lazarus, so I made a small program for >> reading from a PostgreSQL database. >> >> It happens the following problem: >> >> Fields of type "text" are shown as (blob) Hi Marc, > True, iirc strings longer than 255 chars are teruned as blob. They are defined as TEXT....as you can see in the psql results, some field is empty and still I get a (blob).

Correct. A grid cannot show blobs. In order to know it is empty, it must read it first. So you will always see (blob). This is why I for my current project at work choose a varchar(255) (or shorter) for text, since it mostly contained labels and captions. These will be returned as string.

>> Fields of type "real" are mis-interpreted values E-315 !! > How did you define those columns in the DB ? TEXT and REAL

did you try DOUBLE ?

Then I noticed that also times are returned without seconds. It seems a lot of bugs !

I think you just hit some

I wonder if there is around some tutorial with simple examples about DB with Lazarus in Linux....and if it is any useful guess so, but I don't know. I've not done any serious DB programming

in Lazarus (thats my daytime job in Delphi, where we use zeos+postgres)

> PS. zipping an png is not really usefull. Not for who, like me, access to Internet via a cel-phone in GPRS and pays 3 $ for a total of 5Mb (Received+Transmitted)...

Srry, I didn't realize that you can compress .png more.

So is the life here in the country side of Paraguay !

:)

Marc

Reply by email