TUniQuery.Options.QuoteName Problem in Master Detail
TUniQuery.Options.QuoteName Problem in Master Detail
We are migrating from MyDAC to UniDAC after our recent purchase of UniDAC Professional with Source Code.
There is a problem which we don't understand about TUniQuery.Options.QuoteName in Master Detail Case.
For a simple case, I use two TUniQuery, which is one master table and one detail table and all relation properly set. (say MasterField is ID and Detail field is MasterID)
If the quotename option is left as default (False), all work fine.
However if I enable quotename, the detail table is not loading any data.
Using dbMonitor we got
(QuoteName = False)
Select * from DetailTable Where MasterID = :ID :ID(Word,IN)=1
(QuoteName = True)
Select * from DetailTable Where `MasterID` = :`ID`
That mean that when QuoteName = True, The SQL generated fieldname is quoted (as expected) but the Parameter Name is also quoted (Not needed?) and the problem is that the SQL generator seemingly cannot find `ID` field in the master table and do not provide the parameter value to MySQL and so return empty dataset.
This do not happen to our old MyDAC.
There are many of our existing query that need quotename enabled so it is a big problem for us.
We are using Delphi XE3 and the current version of UniDAC 6.4.14.
Thank you.
There is a problem which we don't understand about TUniQuery.Options.QuoteName in Master Detail Case.
For a simple case, I use two TUniQuery, which is one master table and one detail table and all relation properly set. (say MasterField is ID and Detail field is MasterID)
If the quotename option is left as default (False), all work fine.
However if I enable quotename, the detail table is not loading any data.
Using dbMonitor we got
(QuoteName = False)
Select * from DetailTable Where MasterID = :ID :ID(Word,IN)=1
(QuoteName = True)
Select * from DetailTable Where `MasterID` = :`ID`
That mean that when QuoteName = True, The SQL generated fieldname is quoted (as expected) but the Parameter Name is also quoted (Not needed?) and the problem is that the SQL generator seemingly cannot find `ID` field in the master table and do not provide the parameter value to MySQL and so return empty dataset.
This do not happen to our old MyDAC.
There are many of our existing query that need quotename enabled so it is a big problem for us.
We are using Delphi XE3 and the current version of UniDAC 6.4.14.
Thank you.
Re: TUniQuery.Options.QuoteName Problem in Master Detail
Forget to mention that as we got the source code, if you can provide a quite fix for us to modifying the source code as a temporary solution , please let us know the quite fix as the problem is hindering our migration projects.
Thank you very much.
Thank you very much.
Re: TUniQuery.Options.QuoteName Problem in Master Detail
Unfortunately, we could not reproduce the issue.
In order to get a detailed answer, please compose a small sample demonstrating the described behavior and send it to viktorv*devart*com, including scripts for creating database objects. Also, please specify the exact version of the used MySQL server.
In order to get a detailed answer, please compose a small sample demonstrating the described behavior and send it to viktorv*devart*com, including scripts for creating database objects. Also, please specify the exact version of the used MySQL server.
Re: TUniQuery.Options.QuoteName Problem in Master Detail
Dear ViktorV,ViktorV wrote:Unfortunately, we could not reproduce the issue.
In order to get a detailed answer, please compose a small sample demonstrating the described behavior and send it to viktorv*devart*com, including scripts for creating database objects. Also, please specify the exact version of the used MySQL server.
Thank you for your response. We had send the content you requested to your email.
Re: TUniQuery.Options.QuoteName Problem in Master Detail
As the UniDAC library is designed to help develop cross-database applications, therefore it formats SQL to universal form. To disable this functionality you should set the EnableUniSQL global variable from the Uni unit to False. For example:
Code: Select all
initialization
EnableUniSQL := False;
Re: TUniQuery.Options.QuoteName Problem in Master Detail
Thank you and your solution can overcome this issue. However as it is a globe setting and violate one of the main aim of UNIDAC, I would say it should only be used in last resort as it hinder our ability to connect to different DB with the same components.ViktorV wrote:As the UniDAC library is designed to help develop cross-database applications, therefore it formats SQL to universal form. To disable this functionality you should set the EnableUniSQL global variable from the Uni unit to False. For example:Code: Select all
initialization EnableUniSQL := False;
As we tried your solution using DBMonitor, we see that EnableUniSQL := False; do not affect the SQL itself, it is both :
Select * from DetailTable Where `MasterID` = :`ID`
The different is that UniDAC cannot provide the parameter when that variable is not set.
As we know from some of our friendly developer who used UniDAC in former version (5.3.X), this is not a problem. They do not need to disable EnableUniSQL and quotename work fine for the same case. It should be a new bug introduced in the recent versions.
The problem is just the current version of UniDAC (without disabling EnableUniSQL) not able to provide parameter value from quoted parameter. It do not seems to have anything to do with universal SQL format.
Re: TUniQuery.Options.QuoteName Problem in Master Detail
Thank you for the information. We will consider the possibility to return the previous behavior of UniDAC - and we'll inform you about the results.
Re: TUniQuery.Options.QuoteName Problem in Master Detail
Dear ViktorV,ViktorV wrote:Thank you for the information. We will consider the possibility to return the previous behavior of UniDAC - and we'll inform you about the results.
Thank you. We implemented some workarounds former but we just find that the workarounds cannot completely solve the problem. Can you let us know which part of the source code (unit/function) is related to this issue so that we can try to create a temporary fix ourself in your source code? Thank you. If you need our licence information, please let us know so I can email you.
Re: TUniQuery.Options.QuoteName Problem in Master Detail
We will continue investigation of the UniDAC behavior and inform you as soon as we get any results.
Please provide your license number to viktorv*devart*com and we will answer you via email about the modifications to make in UniDAC source code to solve the issue.
Please provide your license number to viktorv*devart*com and we will answer you via email about the modifications to make in UniDAC source code to solve the issue.