Hello
I use zeos 7.1.3 (before version i cant install)
Lazarus 1.2.4
Windows and Linux
I have a new big problem,
i have querys ans stored procedures returns varchar and use functions like initcap, in before versions (7.0) all was ok but now i have the problem :
The problem:
i execute the query, for example:
select cast( initcap(name) as varchar ) as Name From People
the query execute, but when i display in DBgrid, it shows (Memo)
that problem only occur in 7.1.* (7.2alpha) versions
how can i solved that problem?
Zeos Problem with PostgreSQL
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Zeos Problem with PostgreSQL
Hello Christian,
Thought you did broke with Zeos?-> did read your two latest threads in the LCL forum.
Welcome back! Not lucky with the SQLDB performance
Is this the bug you was talking about?
So this is NOT a bug it is a wanted behavior!:
Varchar(no specified length) Should be used as Memo. We had to many bugreports for string trunkations(until 7.0 we used 255 chars by default)
Two solutions:
1. Fall back too old behavior by:
Add 'Undefined_Varchar_AsString_Length=255' to the TZConnection.Properties
2. Simply give the Varchar cast a length like "cast(x as Varchar(Your expected length)).."
Hope you're lucky now...
Thought you did broke with Zeos?-> did read your two latest threads in the LCL forum.
Welcome back! Not lucky with the SQLDB performance
Is this the bug you was talking about?
So this is NOT a bug it is a wanted behavior!:
Varchar(no specified length) Should be used as Memo. We had to many bugreports for string trunkations(until 7.0 we used 255 chars by default)
Two solutions:
1. Fall back too old behavior by:
Add 'Undefined_Varchar_AsString_Length=255' to the TZConnection.Properties
2. Simply give the Varchar cast a length like "cast(x as Varchar(Your expected length)).."
Hope you're lucky now...
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: Zeos Problem with PostgreSQL
not lucky at all,
i tested lie you tell me, The query works as i spected, but not the stored procedures.
Look this issue:
CREATE TABLE DEMO(
demoid serial,
demotext varchar(50),
primary key(demoid)
);
insert into demo(demoid,demotext) values(1,'My first text'),(2,'My second text');
CREATE OR REPLACE FUNCTION f_demotext(id integer)
RETURNS TABLE(thetext VARCHAR(50)) AS
$BODY$
DECLARE
BEGIN
RETURN query EXECUTE( 'Select cast(initcap(demotext) as varchar(50) ) as thetext from DEMO where demoid=' || $1 );
END
$BODY$
LANGUAGE plpgsql
select * from f_demotext(1)
if we display it in a dbgrid still showing "(memo)"
Lazarus 1.2.4
Zeos 7.2 (alfa)
i tested lie you tell me, The query works as i spected, but not the stored procedures.
Look this issue:
CREATE TABLE DEMO(
demoid serial,
demotext varchar(50),
primary key(demoid)
);
insert into demo(demoid,demotext) values(1,'My first text'),(2,'My second text');
CREATE OR REPLACE FUNCTION f_demotext(id integer)
RETURNS TABLE(thetext VARCHAR(50)) AS
$BODY$
DECLARE
BEGIN
RETURN query EXECUTE( 'Select cast(initcap(demotext) as varchar(50) ) as thetext from DEMO where demoid=' || $1 );
END
$BODY$
LANGUAGE plpgsql
select * from f_demotext(1)
if we display it in a dbgrid still showing "(memo)"
Lazarus 1.2.4
Zeos 7.2 (alfa)
Re: Zeos Problem with PostgreSQL
i use PostgreSQL, 9.1 and 9.3
thanks for reading me.
thanks for reading me.
Re: Zeos Problem with PostgreSQL
Using 'Undefined_Varchar_AsString_Length=255' works fine, but my question is why dont works with a Store procedure using VARCHAR(50) (without 'Undefined_Varchar_AsString_Length=255)
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Zeos Problem with PostgreSQL
Have no idea yet. I'll add your testcase(btw thank you for that) this weekend and check what's going wrong with the TZPosgresSQLCallable stmt.
But i have NO time before comming weekend.. I'll notify you if i found a patch.
But i have NO time before comming weekend.. I'll notify you if i found a patch.
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: Zeos Problem with PostgreSQL
Thanks a lot
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Zeos Problem with PostgreSQL
Hi,
did debug me in. Zeos is not able to determine the field-lengths because the PostgreSQL function pgfsize returns -1(no limit) as field-length while the fieldtype (OID 1043-> varchar) is correct. IMPO is it not an issue with your cast funtion, NOPE, the more i think it is an issue with the StoredProcedure you are using.
I do not see a solution from our side. Switching back to old behavior makes trouble if you would expect more than 255 characters as field-length.. Nope i'm against that.
All i can offer would be a little patch to use the suggested 'Undefined_Varchar_AsString_Length=your_length' option for the TZAbstractDataSet-descendants too. So you don't need a global option. What do you think?
did debug me in. Zeos is not able to determine the field-lengths because the PostgreSQL function pgfsize returns -1(no limit) as field-length while the fieldtype (OID 1043-> varchar) is correct. IMPO is it not an issue with your cast funtion, NOPE, the more i think it is an issue with the StoredProcedure you are using.
I do not see a solution from our side. Switching back to old behavior makes trouble if you would expect more than 255 characters as field-length.. Nope i'm against that.
All i can offer would be a little patch to use the suggested 'Undefined_Varchar_AsString_Length=your_length' option for the TZAbstractDataSet-descendants too. So you don't need a global option. What do you think?
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/