Page 1 of 1

"Column does not belong to referenced table"

Posted: 06.12.2008, 13:25
by Marius2
After years of using the standard DBX for firebird databases we want to switch completely to Zeos db. However we have some problems concerning "Column does not belong to referenced table" in combination with double quotes in sql statements.

Is there a parameter i can use to avoid this error? We have a huge lot of sql using double quotes so i rather not change it (it will take weeks to change and test it)


Sql='select tablename from locktable where tablename="Lms Menu" and identifier=0'

When executing with Protocol 'firebird-2.0' i get a EZSQLException saying:
SQL Error:_ Dynamic SQL Error SQL error code = -206 Column unknown Lms Menu At line 1, column 60. Error Code:_-206. Column does not belong to referenced table The SQL:_select tablename from locktable where tablename="Lms Menu" and identifier=0

Thanks,
Marius

Posted: 06.12.2008, 14:09
by mdaems
Hi, you're still using SQL dialect 1 (Interbase-5 standard) for your queries. (See http://www.ibphoenix.com/main.nfs?a=ibp ... ql_dial_ds)

Normally you should be able to set this by ZConnection.Properties.Add('dialect=1') or ZConnection.Properties.Add('isc_dpb_sql_dialect=1')

Mark

Posted: 06.12.2008, 16:12
by Marius2
Thank you very much, you saved my saterday! It now perfectly works with Properties.Values['dialect']:='1';

I should have known this little "joke" with the dialect, but since we alway's develop with dialect1 for over 10 years now i totally forgotten about it.

Posted: 07.12.2008, 09:28
by mdaems
On the other hand : when you decide it's time to change to Zeoslib it might as well be time to change this 'bad' habit...

Enjoy zeoslib!

Mark

Posted: 07.12.2008, 19:50
by Marius2
Everything works just fine in dialect 1. We have at least 10 legacy interbase db's out there with over 1 Gb data, it would be costly and no fun to convert them just because *we* thinks dialect-1 is a bad habit :P

Why do you think dialect-1 is a bad habit anywhay? What will be the benefits of dialect 3 in comparison? And what will be the problems when switching? Any tools out there who convert the db automaticly? Any performance inprovements after converting?

Btw; AFAIK dialect 3 introduces a new stuff like int64, but other then that not much. More importantly i know i lose the ability to use double quote in my sql, in other words a lot of (test) work with none or little benefits. Or i'm i mistaken?

Posted: 07.12.2008, 21:55
by mdaems
Well,

I'm not a Fb expert so I can't give a right answer...
As I understand it it's just OOLLDD. Being a mainframe developer myself until some years ago, I know this doesn't have to be bad, but I don't think anyone still thinks it's the way to go in the future. Having to deal with old legacy databases I agree it may be better to keep it like it is as long as everything just works.
Concerning zeoslib : I think it may lead to some situations where query parsing makes mistakes (by thinking the double quoted strings are quoted identifiers).

Mark

Posted: 08.12.2008, 19:20
by Marius2
Fair ;) but new aint better, that "silly" old mainframe still works faster and better as most modern computers!

Anywhay, if the parser goes bananas its an error as i clearly have setup a dialect 1 db, and i cant go back now because DBX was randomly returning errors in dbexpint.dll (stupid nil pointers after thousands of queries) so i serious hope the parse / quote problem does not occur (or i'll be in big problems).

To be honoust i'm really afraid of switching from dialect 1 to 3. Converting will be relative smple, but we got a serious load of sql in our applications, most of it is automatic generated by a framework, but i worry the most about the handcrafted and not so often used queries.

The product is just becoming so large its difficult to test as a whole (a lot of seperate modules and applications)