Function OdbcWriteDebug() Professional

Write the OdbcDebug() results to a file

Syntax
OdbcWriteDebug([<aoSession>], [<cFile>]) --> lSuccess
Parameters
<aoSession>
If aoSession is an array, it is treated as a list of DacSession() objects, otherwise it is just one DacSession() object. If the parameter is not passed the current work area's session will be used. If the current workarea does not have a session, DacSession():getDefault() is used.
<cFile>
The file name <cFile> will be created. If the parameter is not passed, the name will be formed of the name of the application and the postfix "_odbcdbg.txt".
Return

If the file could be cretaed, the function returns .T.

Description

The function calls OdbcDebug() and writes the output to the file <cFile>. If the <cFile> already exists, the function will append the information to the existing file. Otherwise, a new file is created.

Examples
Create ODBDCBE specific custom error log
// This sample shows how to 
// write the current ODBCDBE settings 
// to a file for debugging purposes. 

PROCEDURE MAIN(cConnect) 
LOCAL oSession 
LOCAL cPrevTraceFile 

   cPrevTraceFile := OdbcTraceFile("myodbc.log") 
   OdbcTraceMode(.T.) 

   oSession := DacSession():new( cConnect ) 

   IF !oSession:isConnected() 
      OdbcWriteDebug(oSession, "myodbc.log") 
   ELSE 
      USE test NEW 
      ? FieldGet(1) 
      CLOSE 
   ENDIF 

   OdbcTraceMode(.F.) 
   OdbcTraceFile(cPrevTraceFile) 
RETURN 

PROCEDURE DbeSys 
   DbeLoad( "ODBCDBE" ) 
   DbeSetDefault( "ODBCDBE" ) 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.