Page 1 of 1
REFRESH generates an error
Posted: 11.09.2010, 23:16
by tkszeos
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
Posted: 12.09.2010, 17:57
by nostradumbass
Can you upload the source code?
I can have a look - my work environment is D2010 and Zeos 7.0
Only the DFM / PAS files and FDB database file. I already have all the relevant Firebird DLLs from the Zeos SVN trunk.
Thanks
ND
Posted: 12.09.2010, 20:49
by tkszeos
Hello nostradumbass,
as requested, we send DFM / PAS files and FDB database file.
Thanks for your cooperation
P.S.
Sorry for my bad English, I use an automatic translator.
Posted: 12.09.2010, 22:01
by nostradumbass
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.
Code: Select all
SELECT A.ID, B.Address FROM Person A INNER JOIN Address B ON A.ID = B.ID
I believe this (2) is a major reason that your problem is occurring.
Regards,
ND
Posted: 13.09.2010, 16:25
by tkszeos
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
Posted: 19.09.2010, 21:59
by mdaems
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
Posted: 20.09.2010, 20:44
by tkszeos
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:
Code: Select all
if (Pos ('', temp)> 0) or (Pos ('-', Temp)> 0) then
with the following:
Code: Select all
if (Pos ('', temp)> 0) or (Pos ('-', Temp)> 0) or (Pos ('.', Temp)> 0) then
After several tests everything seems to work properly.
I do not know if this is the ultimate solution.
Thanks
Nicola
Posted: 13.10.2010, 21:59
by mdaems
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