Hi,
i have a simple question:
I have a varchar or char field and the data only contains blanks:
STR_FIELD = ' '
If i use pQuery.FieldByName('STR_FIELD').AsString the result is
an empty string ''. That means, the blank will be completly ignored.
If i change the type of the field to text, the FieldByName - call gives me the correct result.
So what can i do? I can not change the fieldtype in the hole database from varchar to text but i urgently need the information about the blank!
Are there any ideas or fixes for this problem?
Handling of varchar/char - Fields
Moderators: EgonHugeist, mdaems
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
What database are you using? If the field is varchar, it's normal that trailing (=all here) spaces are removed from the string by the database. (At least for oracle and mysql, as far as I know.) For a Char, this is not true, so maybe we should do the test ourselves. I move this post to the bug reports forum. (Our todo list for bugs) Please keep an eye on it...
Mark
Mark
-
- Fresh Boarder
- Posts: 3
- Joined: 08.01.2007, 11:22
- Location: Centurion, South Africa
Hi
I'm looking at using Zeos instead of dbexpress in Delphi and Kylix. I'm impressed so far. Keep up the good work.
Using:
Under Windows:
Windows 98se
Delphi 7
MySql 5.0 & 4.0
Under Linux:
Mandriva 2006.0
Kylix 3
MySql 4.1
My problem:
In a dbgrid box I can view all the records in my db when I use dbexpress.
With Zeos the char & varchar fields shown in the dbgrid but they are just blank. The date, int and float fields are all displayed correctly.
When I copy the exact same program from the Windows machine to the Linux machine and compile it under Kylix all the fields are displayed.
In the program I use as my hostname 192.168.3.1. This is the Windows machine address. When I connect from the Linux machine it is therefore reading the information from the same db.
I have tried with mysql, mysql-4.1, mysql-5 protocols. Same result.
Tried with MySql 4 and MySql 5 servers with the same result.
Nico
I'm looking at using Zeos instead of dbexpress in Delphi and Kylix. I'm impressed so far. Keep up the good work.
Using:
Under Windows:
Windows 98se
Delphi 7
MySql 5.0 & 4.0
Under Linux:
Mandriva 2006.0
Kylix 3
MySql 4.1
My problem:
In a dbgrid box I can view all the records in my db when I use dbexpress.
With Zeos the char & varchar fields shown in the dbgrid but they are just blank. The date, int and float fields are all displayed correctly.
When I copy the exact same program from the Windows machine to the Linux machine and compile it under Kylix all the fields are displayed.
In the program I use as my hostname 192.168.3.1. This is the Windows machine address. When I connect from the Linux machine it is therefore reading the information from the same db.
I have tried with mysql, mysql-4.1, mysql-5 protocols. Same result.
Tried with MySql 4 and MySql 5 servers with the same result.
Nico
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi Nico,
I never had this kind of trouble in this configuration. Not using Win98, however. Do you have a very stupid example project that shows the problem? Just 1 connection, zquery, datasource and grid? Database name : zeoslib or test. Please provide a small dataset loading script with create table command. (eg by taking a backup)
Can you also tell which version of zeoslib you are using?
Mark
BTW : can you please register to the bug tracker instead of hijacking this thread? So we can finally get rid of this forum in a reasonable time.
I never had this kind of trouble in this configuration. Not using Win98, however. Do you have a very stupid example project that shows the problem? Just 1 connection, zquery, datasource and grid? Database name : zeoslib or test. Please provide a small dataset loading script with create table command. (eg by taking a backup)
Can you also tell which version of zeoslib you are using?
Mark
BTW : can you please register to the bug tracker instead of hijacking this thread? So we can finally get rid of this forum in a reasonable time.