I am using ZeosLib 7.1 + Delphi 2009. And have a sql statement like below:
select round(amount / exchange_rate,2) as fieldA from tableA;
but the return type of fieldA just like String, I have set the sub-total of that field on a grid, but the sub-total is empty. I have try to cast it as numeric, but still not work.
Select field with calculation
Moderators: gto, cipto_kh, EgonHugeist
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Select field with calculation
This is because SQLite does not retrieve a type info for the result of a function and we are not able to load any informations by using metadata-informations.
If you want to track root of eval: Just debug TZSQLiteResultSet.Open; in ZDbcSqliteResultset.pas...
Edit: Did read some more SQLite-docs.. found something interesting: http://www.sqlite.org/c3ref/table_column_metadata.html
I'll check if this works an can be used -> it's a Preprocessor define..
If you want to track root of eval: Just debug TZSQLiteResultSet.Open; in ZDbcSqliteResultset.pas...
Edit: Did read some more SQLite-docs.. found something interesting: http://www.sqlite.org/c3ref/table_column_metadata.html
I'll check if this works an can be used -> it's a Preprocessor define..
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: Select field with calculation
Thanks for your reply!
But I have face another problem now.
I need to input some Traditional Chinese into the sqlite DB. For example '當歸', but it become 'vuxk' after saved. So I try to use a TZUpdateSQL object and write my own update sql.
I found that if I write the update sql using param like:
Update tableA set fieldA = :fieldA;
then it become 'vuxk'.
If I write the value directly like:
Update tableA set fieldA = '當歸';
then it works. But I need to update multi-records in one time, so I can't write the value directly like that.
My TZConnection setting is:
ClientCodepage: UTF-8
ControlsCodePage: cCP UTF16
AutoEncodeStrings: True
and I am using Win7 Traditional Chinese.
Thanks!
But I have face another problem now.
I need to input some Traditional Chinese into the sqlite DB. For example '當歸', but it become 'vuxk' after saved. So I try to use a TZUpdateSQL object and write my own update sql.
I found that if I write the update sql using param like:
Update tableA set fieldA = :fieldA;
then it become 'vuxk'.
If I write the value directly like:
Update tableA set fieldA = '當歸';
then it works. But I need to update multi-records in one time, so I can't write the value directly like that.
My TZConnection setting is:
ClientCodepage: UTF-8
ControlsCodePage: cCP UTF16
AutoEncodeStrings: True
and I am using Win7 Traditional Chinese.
Thanks!