ODBC Connection and Functions

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FarshadV
Posts: 22
Joined: Sat 31 Jan 2009 21:55

ODBC Connection and Functions

Post by FarshadV » Wed 17 Mar 2010 14:43

I have to connect to a Progress database via ODBC and execute the following SQL statement:

Code: Select all

SELECT DISTINCT                     
  tracking.order-num,    
  tracking.phase-num  
FROM                 
  tracking
  LEFT JOIN order-mast on tracking.order-num = order-mast.order-num  
WHERE                 
(              
  (tracking.act-finish-dt >= {d 2009/12/28}) 
  AND
  (tracking.act-finish-dt <= {d 2010/01/31})
)
ORDER BY
  tracking.order-num                         
The problem is that the uniDAC components are attempting to find a function called "d", but what I need is to pass the above SQL EXACTLY as is without any modifications, because {d...} is a directive to the Progress SQL engine to cast the value as a Date Type.

How can I do this?

Best Regards

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Tue 23 Mar 2010 10:53

Hello

UniDAC uses symbols "{" and "}" to define macros inside SQL queries. So if SQL parser finds any expression in {} it replaces this expression with a predefined macro. If macro wasn't predefined then expression will be replaced by an empty string.

To turn off macros parsing set global variable EnableUniSQL := False in the initialization part of your unit.

FarshadV
Posts: 22
Joined: Sat 31 Jan 2009 21:55

Post by FarshadV » Fri 09 Apr 2010 13:28

Thank you very much

Best Regards,

Farshad R.Vossoughi

Post Reply