Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, February 2005
Qt 3.3.4 and PostgreSQL 8.0.1


Message 1 in thread

I am using Qt 3.3.4 under Windows and tried to configure it to use the 
PostgreSQL SQL driver. However it seams Qt only supports PostgreSQL 6.x 
and 7.x.

Can anyone provide some information how to get PostgreSQL 8.x supported 
within Qt?

Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

-- 
 [ signature omitted ] 

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Message 2 in thread

Qt3.3.4 works fine with PG8.0.1 using the PSQL7 driver.

It's not a great driver in some respects, and doesn't
take advantage of the version 3 protocol at all, but it
works fine. I'm developing with it on OS X and linux at
the moment.

Cheers,
  Steve

On Sat, Feb 19, 2005 at 12:36:24PM +0100, Rainer Wiesenfarth wrote:
> Date: Sat, 19 Feb 2005 12:36:24 +0100
> From: Rainer Wiesenfarth <Rainer.Wiesenfarth@xxxxxxxx>
> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Qt 3.3.4 and PostgreSQL 8.0.1
> Reply-To: Rainer.Wiesenfarth@xxxxxxxx
> 
> 
> I am using Qt 3.3.4 under Windows and tried to configure it to use the 
> PostgreSQL SQL driver. However it seams Qt only supports PostgreSQL 6.x 
> and 7.x.
> 
> Can anyone provide some information how to get PostgreSQL 8.x supported 
> within Qt?
> 
> Best Regards / Mit freundlichen Grüßen
> Rainer Wiesenfarth
> 
> -- 
> INPHO GmbH   *   Smaragdweg 1   *   70174 Stuttgart   *   Germany
> phone: +49 711 2288 10              *  fax: +49 711 2288 111
> mailto:Rainer.Wiesenfarth@xxxxxxxx  *  www.inpho.de
> Leader in Photogrammetry and Digital Surface Modelling
> You will meet INPHO at www.inpho.de/events.htm


Message 3 in thread

Steve Atkins schrieb:
> Qt3.3.4 works fine with PG8.0.1 using the PSQL7 driver.
> (...)
> 
> On Sat, Feb 19, 2005 at 12:36:24PM +0100, Rainer Wiesenfarth wrote:
> > (...)
> > Can anyone provide some information how to get PostgreSQL 8.x supported 
> > within Qt?
> >  (...)

Thanks Steve, finally I got it working. There are some pitfalls with it 
that might (or might not) be Windows-related. Thus I have a 
"micro-HowTo" for people trying to use PostgreSQL 8.x wit Qt on Windows 
(tried with MSVC 6, PostGreSQL 8.0.1, and Qt 3.3.4):

- you need both the binary (installable) version of PostgreSQL and the
   source code, the latter for some of the include files Qt searches for
- Install the binary. The directory used here is referred to as "BINDIR"
   from now on
- Extract the source. The directory used here is refferes to as "SRCDIR"
   from now on
- in BINDIR\lib\ms: copy libpq.lib to libpqdll.lib as the Qt installer
   searches for the latter
- in SRCDIR\src\include: copy pg_config.h.win32 to pg_config.h as the
   include files used by the Qt SQL driver depend on a proper
   configuration
- set the INCLUDE environment variable to contain BINDIR\include and
   SRCDIR\src\include
- set the LIB environment variable to contain BINDIR\lib\ms
- Qt should now configure and build ok

Some restrictions (those might be mentioned in the docs, though I did 
not read them):
! PostgreSQL data base names must not contain whitespace characters.
   Otherwise the connection will fail.
! PostgreSQL table and column name must be completely lowercase.
   Otherwise the table/column will not be found by the Qt driver.

Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

-- 
 [ signature omitted ] 

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Message 4 in thread

Hi,

> Thanks Steve, finally I got it working. There are some pitfalls with it 
> that might (or might not) be Windows-related. Thus I have a 
> "micro-HowTo" for people trying to use PostgreSQL 8.x wit Qt on Windows 
> (tried with MSVC 6, PostGreSQL 8.0.1, and Qt 3.3.4):
> [...]

I believe these are not Qt issues. Rather it looks like PostgreSQL
hadn't been properly installed.

> Some restrictions (those might be mentioned in the docs, though I did 
> not read them):
> ! PostgreSQL data base names must not contain whitespace characters.
>   Otherwise the connection will fail.
> ! PostgreSQL table and column name must be completely lowercase.
>   Otherwise the table/column will not be found by the Qt driver.

It looks like one connects to a PostgreSQL database using PQconnectdb as
described here:
http://pgsqld.active-venture.com/libpq-connect.html
This page reads:
	Each parameter setting is in the form keyword = value. To
	write an empty value or a value containing spaces, surround
	it with single quotes, e.g., keyword = 'a value'

I had a look at file src/sql/drivers/psql/qsql_psql.cpp and it looks
like QPSQLDriver::open() doesn't surround values containing spaces with
single quotes.

I suggest you contact qt-bugs@xxxxxxxxxxxxx or the Trolltech help desk
to have this fixed.

--
 [ signature omitted ] 

Message 5 in thread

Hi,

> ! PostgreSQL table and column name must be completely lowercase.
>   Otherwise the table/column will not be found by the Qt driver.

It looks like PostgreSQL converts all names to lowercase, at least
unquoted ones:
http://www.informit.com/articles/article.asp?p=31206
I'm referring to paragraph:
	Quoted names are case-sensitive. "1040Forms" and "1040FORMS"
	are two distinct names. Unquoted names are converted to
	lowercase, as shown here:
	[...]

Now I'm not sure whether Qt should work around this issue by quoting
names, or follow the PostgreSQL rules. In any case that doesn't look
like a bug, rather it looks like a design decision. What do you think?
If you'd rather see the Qt driver work around normal PostgreSQL
operation, I suggest you contact qt-bugs@xxxxxxxxxxxxx or the Trolltech
help desk and ask them to look into this.

--
 [ signature omitted ] 

Message 6 in thread

Hello,

On Sunday 20 February 2005 20:22, Rainer Wiesenfarth wrote:
> Thanks Steve, finally I got it working. There are some pitfalls with it
> that might (or might not) be Windows-related. Thus I have a
> "micro-HowTo" for people trying to use PostgreSQL 8.x wit Qt on Windows
> (tried with MSVC 6, PostGreSQL 8.0.1, and Qt 3.3.4):

[...]

thank you for the information. We fixed this issue for Qt 4 a while ago, so 
you can build the plugin by just downloading the client and install the 
development headers.

I'll look into the issues with quoting and mixed case identifiers.

Best regards,
Harald


Message 7 in thread

Is Qt3.2.1 works fine with PG8.0.1 using the PSQL7 driver?





-----Original Message-----
From: owner-qt-interest@xxxxxxxxxxxxx
[mailto:owner-qt-interest@xxxxxxxxxxxxx] On Behalf Of Steve Atkins
Sent: Sunday, February 20, 2005 3:40 PM
To: Rainer Wiesenfarth
Cc: qt-interest@xxxxxxxxxxxxx
Subject: Re: Qt 3.3.4 and PostgreSQL 8.0.1

Qt3.3.4 works fine with PG8.0.1 using the PSQL7 driver.

It's not a great driver in some respects, and doesn't take advantage of the
version 3 protocol at all, but it works fine. I'm developing with it on OS X
and linux at the moment.

Cheers,
  Steve

On Sat, Feb 19, 2005 at 12:36:24PM +0100, Rainer Wiesenfarth wrote:
> Date: Sat, 19 Feb 2005 12:36:24 +0100
> From: Rainer Wiesenfarth <Rainer.Wiesenfarth@xxxxxxxx>
> User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Qt 3.3.4 and PostgreSQL 8.0.1
> Reply-To: Rainer.Wiesenfarth@xxxxxxxx
> 
> 
> I am using Qt 3.3.4 under Windows and tried to configure it to use the 
> PostgreSQL SQL driver. However it seams Qt only supports PostgreSQL 
> 6.x and 7.x.
> 
> Can anyone provide some information how to get PostgreSQL 8.x 
> supported within Qt?
> 
> Best Regards / Mit freundlichen Grüßen Rainer Wiesenfarth
> 
> -- 
> INPHO GmbH   *   Smaragdweg 1   *   70174 Stuttgart   *   Germany
> phone: +49 711 2288 10              *  fax: +49 711 2288 111
> mailto:Rainer.Wiesenfarth@xxxxxxxx  *  www.inpho.de Leader in 
> Photogrammetry and Digital Surface Modelling You will meet INPHO at 
> www.inpho.de/events.htm

--
 [ signature omitted ]