Zeos + Postgresql + D2005

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
stepel
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 11.05.2010, 12:57

Zeos + Postgresql + D2005

Post by stepel »

Hi,

i have problem with CAST expression AS type commend. I use TZQuery and i want to get TStringField fileds from column (type - text).

So i try:


SELECT
CAST (vname AS varchar(100)),CAST(vvalue AS varchar(100)), id
FROM schemat.baza WHERE vname ~* :var_name ORDER BY vname,id

and i get :
vname - TStringField
vvalue - TMemoField
id - TIntegerField

why vvalue isn't TStringField?

When i use:

SELECT
id,CAST (vname AS varchar(100)),CAST(vvalue AS varchar(100))
FROM schemat.baza WHERE vname ~* :var_name ORDER BY vname,id

where id is on the first place i get :

id - TIntegerField
vname - TMemoField
vvalue - TMemoField

Any ideas?
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Can you provide the table declaration?
stepel
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 11.05.2010, 12:57

Post by stepel »

we don't need it ;) i solved that problem.

in table declaration is:
(
id serial NOT NULL,
vname text,
vvalue text,
CONSTRAINT pk_eknr_cfg PRIMARY KEY (id)
)

but the solution is:

SELECT
CAST (vname AS varchar(100)) AS vname,CAST(vvalue AS varchar(100)) AS vvalue, id
FROM schemat.baza WHERE vname ~* :var_name ORDER BY vname,id

In BDE it wasn't problem when i used CAST without new column name. But in that situation (zeos) it seems to be important.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

It may be because the parser has a problem with the 'AS' within the Cast expression that's solved by adding the second AS before the alias name.

Mark
Image
stepel
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 11.05.2010, 12:57

Post by stepel »

Yes maybe, but the most important is that everything work :)
Post Reply