REFRESH generates an error

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
User avatar
tkszeos
Junior Boarder
Junior Boarder
Posts: 35
Joined: 26.08.2005, 21:45

REFRESH generates an error

Post 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
nostradumbass
Junior Boarder
Junior Boarder
Posts: 27
Joined: 22.05.2008, 23:54

Post 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
User avatar
tkszeos
Junior Boarder
Junior Boarder
Posts: 35
Joined: 26.08.2005, 21:45

Post 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.
You do not have the required permissions to view the files attached to this post.
nostradumbass
Junior Boarder
Junior Boarder
Posts: 27
Joined: 22.05.2008, 23:54

Post 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
User avatar
tkszeos
Junior Boarder
Junior Boarder
Posts: 35
Joined: 26.08.2005, 21:45

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
User avatar
tkszeos
Junior Boarder
Junior Boarder
Posts: 35
Joined: 26.08.2005, 21:45

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Locked