Обсуждение: pg & Delphi

Поиск
Список
Период
Сортировка

pg & Delphi

От
Kitter Georgiy
Дата:
Good day.
 I want to enter Postges into project,
which has so rectriction, that client should be written on Delphi (CBuilder). Please, prompt me how to adjust Delphi to
usePostgres.
 


Dmitry Turin
SQL4      (4.2.0)  http://sql40.chat.ru
HTML6     (6.4.0)  http://html60.chat.ru
Unicode2  (2.0.1)  http://unicode2.chat.ru
Computer2 (2.0.3)  http://computer20.chat.ru


Re: pg & Delphi

От
Daniel Drotos
Дата:
On Tue, 28 Aug 2007, Kitter Georgiy wrote:

> which has so rectriction, that client should be written on Delphi (CBuilder).
>  Please, prompt me how to adjust Delphi to use Postgres.

We use pgExpress driver from http://vitavoom.com It is commercial, but 
cheep and works well. You can try ODBC as well, but it is too slow.

Daniel


Re: pg & Delphi

От
Richard Huxton
Дата:
Kitter Georgiy wrote:
> Good day.
> 
>   I want to enter Postges into project,
> which has so rectriction, that client should be written on Delphi (CBuilder).
>   Please, prompt me how to adjust Delphi to use Postgres.

You should be able to connect via ODBC. Googling "PostgreSQL Delphi" 
seems to give some useful links.

--   Richard Huxton  Archonet Ltd


Re: pg & Delphi

От
sergio carrasco
Дата:
--- Kitter Georgiy <sql4-en@narod.ru> escribió:

> Good day.
> 
>   I want to enter Postges into project,
> which has so rectriction, that client should be
> written on Delphi (CBuilder).
>   Please, prompt me how to adjust Delphi to use
> Postgres.
> 

You can to use:

ZeoslibDBO (free, but it hasn´t ssl soport). I test it
and work fine.

http://downloads.sourceforge.net/zeoslib/ZEOSDBO-6.6.1_beta.zip?modtime=1172471217&big_mirror=0

PostgresDAC (free trial, it has ssl soport). I use it
and work very fine-fast.

http://www.microolap.com/downloads/postgresdac/pg.zip


They are use as the BDE component.

Good luck !


SACL


     ____________________________________________________________________________________
¡Sé un mejor besador!
Compartí todo lo que sabés sobre besos en http://ar.yahoo.com/promos/mejorbesador.html


Re: pg & Delphi

От
"Josh Tolley"
Дата:
On 8/28/07, Richard Huxton <dev@archonet.com> wrote:
> Kitter Georgiy wrote:
> > Good day.
> >
> >   I want to enter Postges into project,
> > which has so rectriction, that client should be written on Delphi (CBuilder).
> >   Please, prompt me how to adjust Delphi to use Postgres.
>
> You should be able to connect via ODBC. Googling "PostgreSQL Delphi"
> seems to give some useful links.
>

Delphi should let you use dlls written in other languages (it did when
I used Delphi last, which has been years). So I'd just use libpq.dll.

-Josh


Re: pg & Delphi

От
Dmitry Turin
Дата:
Very thanks to all.
Some questions:

RH> You should be able to connect via ODBC.
I don't know Delphi well (i used only BDE).
What Delphi's object should be used to connect via ODBS
(instead of BDE-components TTable, TDatabase) ?

JT> Delphi should let you use dlls written in other languages.
JT> So I'd just use libpq.dll.
Similarly, What Delphi's object should be used to connect via libpq.dll
(instead of BDE-components TTable, TDatabase -
i'd like to know all ways to connect Postgres and Delphi)?


Dmitry Turin
SQL4      (4.3.0)  http://sql40.chat.ru
HTML6     (6.4.0)  http://html60.chat.ru
Unicode2  (2.0.1)  http://unicode2.chat.ru
Computer2 (2.0.3)  http://computer20.chat.ru


Re: pg & Delphi

От
"Josh Tolley"
Дата:
On 9/1/07, Dmitry Turin <sql4-en@narod.ru> wrote:
> Very thanks to all.
> Some questions:
>
> RH> You should be able to connect via ODBC.
> I don't know Delphi well (i used only BDE).
> What Delphi's object should be used to connect via ODBS
> (instead of BDE-components TTable, TDatabase) ?
>
> JT> Delphi should let you use dlls written in other languages.
> JT> So I'd just use libpq.dll.
> Similarly, What Delphi's object should be used to connect via libpq.dll
> (instead of BDE-components TTable, TDatabase -
> i'd like to know all ways to connect Postgres and Delphi)?

If I remember correctly, when I was doing MySQL and Delphi (again,
it's been years), we didn't use components to talk to the database --
instead, we simply called functions out of libmysql.dll. Were I doing
the same thing with PostgreSQL today, I'd call functions directly from
libpq.dll.

-Josh/eggyknap


Constraints for grouping

От
PostgreSQL Admin
Дата:
I have a question that I've thought in my head about using triggers, but
I figure to ask people that do SQL more than I.  So, I have a table that
I want two columns.

(1) A featured column which is for only 1 row, once it switched to
another row than all other rows must be false
            title              | author_id | categories | featured
--------------------------------+-----------+------+-----Thierry Beta Release           |         3 |         11 |
TrueDifferentApproach  |         3 |         11 |Ottawa Does Not Heart Hip-Hop  |         3 |         11 |
 

(2) A featured column by category and only allow category_feature equal
to the number of categories.

Is SQL the way to go (and how - ideas), or should I use python for the
heavy lifting?

Thanks for any input,
J


Re: Constraints for grouping

От
Richard Broersma Jr
Дата:
--- PostgreSQL Admin <postgres@productivitymedia.com> wrote:
> I have a question that I've thought in my head about using triggers, but
> I figure to ask people that do SQL more than I.  So, I have a table that
> I want two columns.
> 
> (1) A featured column which is for only 1 row, once it switched to
> another row than all other rows must be false
> 
>              title              | author_id | categories | featured
> --------------------------------+-----------+------+-----
>  Thierry Beta Release           |         3 |         11 | True
>  Different Approach  |         3 |         11 |
>  Ottawa Does Not Heart Hip-Hop  |         3 |         11 |
> 
> (2) A featured column by category and only allow category_feature equal
> to the number of categories.
> 
> Is SQL the way to go (and how - ideas), or should I use python for the
> heavy lifting?

Are you saying that you have two featured columns? One column for category features and the other
for article feature?

If I understand you correctly, Item 1 can be achieved nicely with partial indexes.
for example, if you only want to allow one row in the entire table to have "feature"= true:

CREATE INDEX Only_one_row_true         ON Your_table ( featured )      WHERE featured = true;

Or if you want to only allow 1 featured article per catagory then:

CREATE INDEX Only_one_row_true_per_catagory         ON Your_table ( catigories, featured )      WHERE featured = true;

This will ensure that the sum( featured = true ) <= sum( unique( catagories )).

Regards,
Richard Broersma Jr.


Re: Constraints for grouping

От
Richard Broersma Jr
Дата:
OOPS!
--- Richard Broersma Jr <rabroersma@yahoo.com> wrote:
> CREATE UNIQUE INDEX Only_one_row_true
>           ON Your_table ( featured )
>        WHERE featured = true;
> 
> Or if you want to only allow 1 featured article per catagory then:
> 
> CREATE UNIQUE INDEX Only_one_row_true_per_catagory
>           ON Your_table ( catigories, featured )
>        WHERE featured = true;

I forgot the unique part of the DDL.

Regards,
Richard Broersma Jr.


Re: Constraints for grouping

От
PostgreSQL Admin
Дата:
> --- Richard Broersma Jr <rabroersma@yahoo.com> wrote:
>   
>> CREATE UNIQUE INDEX Only_one_row_true
>>           ON Your_table ( featured )
>>        WHERE featured = true;
>>
>> Or if you want to only allow 1 featured article per catagory then:
>>
>> CREATE UNIQUE INDEX Only_one_row_true_per_catagory
>>           ON Your_table ( catigories, featured )
>>        WHERE featured = true;
>>     
>
> I forgot the unique part of the DDL.
>
> Regards,
> Richard Broersma Jr.
>
>   
Thanks for the information.  I will check it out and get back to you.

Thanks again,
J