Question about returned the data by the query
Question about returned the data by the query
Hi,
I use Delphi7+Zeos 7.
I have some query including construction - concat(f1," ",f2) as F , where f1 or f2 field by date or time. After query opening in ZQuery, field F have type - bytes. Version late 7.0 return type - string. When f1 and f2 not date or time return type - string. It is correct operation of ZQuery?
I use Delphi7+Zeos 7.
I have some query including construction - concat(f1," ",f2) as F , where f1 or f2 field by date or time. After query opening in ZQuery, field F have type - bytes. Version late 7.0 return type - string. When f1 and f2 not date or time return type - string. It is correct operation of ZQuery?
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Question about returned the data by the query
Which Database are you using?
Something to reproduce would be nice too!
Something to reproduce would be nice too!
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: Question about returned the data by the query
I am use MySQL 4.1.16
Query - select concat(f1," ",f2) as A, f1,f2 from t1
Table have 1 row
f1 - 0000-00-00 - type DATE
f2 - 0000-00-00 - type VARCHAR
In manual by concat "...If the arguments include any binary strings, the result is a binary string...."
Query - select concat(f1," ",f2) as A, f1,f2 from t1
Table have 1 row
f1 - 0000-00-00 - type DATE
f2 - 0000-00-00 - type VARCHAR
In manual by concat "...If the arguments include any binary strings, the result is a binary string...."
Re: Question about returned the data by the query
nil
Last edited by warcan on 17.10.2014, 13:05, edited 1 time in total.
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Question about returned the data by the query
Shouldn't you convert the DateTime-Value to a string and than do your concatations?
something like
something like
Code: Select all
select concat(Cast(f1 as varchar(10))," ",f2) as A, f1,f2 from t1
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: Question about returned the data by the query
I'm not looking for a solution, I wonder, which Zeos version works correctly v.6.6.6 or v.7?
The thing is that in User Manual by mysql it is stated:
The thing is that in User Manual by mysql it is stated:
- Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form;
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Question about returned the data by the query
You are running into a known old MySQL issue..
Just see http://jondowdle.com/mysql-concat-and-mixed-types/
There are more threads to find if you simply google the issue.
I did check your exmple with MySQL5.6 and i got the results you expect:
I remember a MySQL side which did describe the fix.. But i don't know the URL any more
So 6.6.6 was wrong and 7up is fixed for binary fields (which simply was missing on 6.6.6 AFAIK)
Just see http://jondowdle.com/mysql-concat-and-mixed-types/
There are more threads to find if you simply google the issue.
I did check your exmple with MySQL5.6 and i got the results you expect:
Code: Select all
//http://zeoslib.sourceforge.net/viewtopic.php?f=38&t=18791
procedure TZTestCompMySQLBugReport.Test38_18791;
var
Query: TZQuery;
begin
Query := CreateQuery;
Query.SQL.Text := 'select concat(p_begin_work," ",p_name) as A, p_begin_work,p_name from people';
try
Query.Open;
CheckStringFieldType(Query.Fields[0].DataType, Query.Connection.DbcConnection.GetConSettings);
CheckEquals('09:00:00 Vasia Pupkin', Query.Fields[0].AsString);
finally
Query.Free;
end;
end;
So 6.6.6 was wrong and 7up is fixed for binary fields (which simply was missing on 6.6.6 AFAIK)
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: Question about returned the data by the query
Thank you very much for your reply and your time. I'll have to recheck all query for correctness display by using zeos v7.
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Question about returned the data by the query
Or you update MySQL and the bug is fixed..
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: Question about returned the data by the query
A lot of thanks for the advice.