Page 1 of 1

ODBC Connection and Functions

Posted: Wed 17 Mar 2010 14:43
by FarshadV
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

Posted: Tue 23 Mar 2010 10:53
by bork
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.

Posted: Fri 09 Apr 2010 13:28
by FarshadV
Thank you very much

Best Regards,

Farshad R.Vossoughi