Debugging Embedded SQL Programs
You can use the Microsoft debuggers (including the integrated debugger in 16-bit Microsoft® Visual C++® and 32-bit Visual C++), Microsoft CodeView® window-oriented debugger for Microsoft Windows®, and WinDebug for Microsoft Windows NT® 4.0, Windows 95, and Windows 98 to examine your Embedded SQL for C (ESQL/C) program while it is executing. A Microsoft debugger displays ESQL/C source statements as lines of executable code. While debugging, you can set breakpoints on Embedded SQL statements to test host variables. To monitor SQLCA and SQLDA fields, you must monitor the SQLCA and SQLDA data structures and member variables. For example, you must monitor sqlca->sqlcode instead of the SQLCODE macro, and you must monitor sqlca->sqlerrd instead of the SQLERRD1 macro.
When you use the integrated debugger in 16-bit Visual C++ or 32-bit Visual C++, you can set breakpoints on lines of source code in your .sqc file. However, to begin a debugging session, you must first open the .c file generated by nsqlprep and make that window active. Then on the Debug menu, click Go.
If you are using Visual C++ 5.0 for example, you can open the .exe file, and choose from the menu BUILD, START DEBUG, STEP INTO. For this to work, you need to compile and link with a debug information switches. For example:
nsqlprep myprogram /NOLINES /NOLOGO /NOSQLACCESS
cl -c -G4d -W3 -Zi -Od myprogram.c
Link /MAP /DEBUG.full /DEBUGTYPE:both /SUBSYSTEM:console myprogram.obj kernel32.lib libc.lib sqlakw32.lib caw32.lib ntwdblib.lib
For debugging the .c source code, you need to supply the /NOLINES precompiler option to nsqlprep. This allows debugging directly into the .c file instead of the .sqc file.
When you use CodeView for 16-bit Windows and step through the code, the cursor disappears until it reaches the next C statement.