REFRESH generates an error
Moderators: gto, EgonHugeist, olehs
REFRESH generates an error
I am running Firebird 1.5. I have a table with a field "P. Iva" - everything is working fine but if I specifically call .REFRESH it generates an error "Project XXX raised exception class EDatabaseError with message 'TABLE: Field 'P' not found'.
I use ZEOS 7.0 on DELPHI 2010
Nicola
I use ZEOS 7.0 on DELPHI 2010
Nicola
-
- Junior Boarder
- Posts: 27
- Joined: 22.05.2008, 23:54
-
- Junior Boarder
- Posts: 27
- Joined: 22.05.2008, 23:54
Hi Nicola,
1. If this was previously working with Zeos 6.6.6, then it is a bug in Zeos 7.
2. You should not use "." character in field names, because it has special meaning in SQL Syntax ie it is used as a qualifier for aliases
eg.
I believe this (2) is a major reason that your problem is occurring.
Regards,
ND
1. If this was previously working with Zeos 6.6.6, then it is a bug in Zeos 7.
2. You should not use "." character in field names, because it has special meaning in SQL Syntax ie it is used as a qualifier for aliases
eg.
Code: Select all
SELECT A.ID, B.Address FROM Person A INNER JOIN Address B ON A.ID = B.ID
Regards,
ND
Hi ND,
1) The error is also present in earlier versions of Zeos.
2) I do not think is a problem with the syntax of Firebird. In fact the error does not occur when entering, modifying or searching data. Again, the same problem does not occur if the field name is "P. iva" instead of "P.iva", ie if the point is followed by a space.
Thanks anyway
Nicola
1) The error is also present in earlier versions of Zeos.
2) I do not think is a problem with the syntax of Firebird. In fact the error does not occur when entering, modifying or searching data. Again, the same problem does not occur if the field name is "P. iva" instead of "P.iva", ie if the point is followed by a space.
Thanks anyway
Nicola
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
tkszeos,
I'm not a FB user, sorry, but I might be able to help you pinpoint the problem area of zeoslib code.
First thing you should do is add a TZSQLMonitor to your project and write a log of all SQL sent to the server.
Second thing to check is the call stack at the moment the error is shown. This tells at exactly which operation the error is happening.
For this specific case it looks like there's a problem when matching the data fields from the refreshed resultset to the column names of the original resultset.
As I don't know the table structure of your test project (not using FB, remember) I'm just guessing, but I have the impression from nostradrumbass is correct. I know for sure the builtin sql parser from zeoslib isn't prepared for field names including '.'. If this has an effect for your case isn't sure. As you're using 'select *' it shouldn't make a difference for the query execution itself. However mapping columns with resultset on refresh is more difficult and complex.
How to continue : look where this error is called. Printing the call stack when the massage is on your screen might help us a lot.
Mark
I'm not a FB user, sorry, but I might be able to help you pinpoint the problem area of zeoslib code.
First thing you should do is add a TZSQLMonitor to your project and write a log of all SQL sent to the server.
Second thing to check is the call stack at the moment the error is shown. This tells at exactly which operation the error is happening.
For this specific case it looks like there's a problem when matching the data fields from the refreshed resultset to the column names of the original resultset.
As I don't know the table structure of your test project (not using FB, remember) I'm just guessing, but I have the impression from nostradrumbass is correct. I know for sure the builtin sql parser from zeoslib isn't prepared for field names including '.'. If this has an effect for your case isn't sure. As you're using 'select *' it shouldn't make a difference for the query execution itself. However mapping columns with resultset on refresh is more difficult and complex.
How to continue : look where this error is called. Printing the call stack when the massage is on your screen might help us a lot.
Mark
Hi Mark,
I think I found, though perhaps empirically, a solution to the problem. I substituted in the function "DefineKeyFields", of the "ZDatasetUtils.pas" file, the row:
with the following:
After several tests everything seems to work properly.
I do not know if this is the ultimate solution.
Thanks
Nicola
I think I found, though perhaps empirically, a solution to the problem. I substituted in the function "DefineKeyFields", of the "ZDatasetUtils.pas" file, the row:
Code: Select all
if (Pos ('', temp)> 0) or (Pos ('-', Temp)> 0) then
Code: Select all
if (Pos ('', temp)> 0) or (Pos ('-', Temp)> 0) or (Pos ('.', Temp)> 0) then
I do not know if this is the ultimate solution.
Thanks
Nicola
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
To be honest, I don't think it's the ultimate solution. I suppose there may be more characters that cause strange behaviour when used as part of a field name. But having the space and dot escaped will probably do a good job already. There's a chance this problem can be solved using IdentifierConvertor.Quote(temp) where identifierconverter is a TZDefaultIdentifierConvertor or a descendant for the database in use.
If you want to explore that path, please do so.
Meanwhile, I added your little change to testing branch and ran the test suite. It's not breaking anything, so I guess your change is safe enough. Committed to testing branch. (SVN rev. 830)
Mark
If you want to explore that path, please do so.
Meanwhile, I added your little change to testing branch and ran the test suite. It's not breaking anything, so I guess your change is safe enough. Committed to testing branch. (SVN rev. 830)
Mark