You are here: Home Support Knowledge Base I want to ... Debug my Programs
Navigation
« September 2008 »
Su Mo Tu We Th Fr Sa
123456
78910111213
14151617181920
21222324252627
282930
 
Document Actions

Debug my Programs

Interactive Debugger

We will be providing an interactive debugger in 2007 with P-Code & Object based 4GL development version 'Hydra4GL' 5.0. Should you be interested in participating the 'Hydra4GL' V5 alpha & beta tester program, please contact technical support at support@querix.com

Debugging SQL Problems

Interactive debuggers don't tend to be a lot of help when dealing with SQL problems, especially since the SQL is dynamically translated.

You will find the debug tracing is far more valuable in solving this kind of problem. To enable this feature, you must first ensure that the program is compiled with debug enabled:

4make -D ...

or select 'Debug' instead of 'Release' for the build type in 'HydraStudio'. Once you have compiled the program, you can now enable SQL tracing by using the environment variable QXDEBUG.  QXDEBUG creates a log file in the 'logs' directory of the 'Hydra4GL' install (c:\program files\querix\logs, or $QUERIXDIR\logs are the defaults).


---------------------------------

QXDEBUG values are:

R=Generate output indicating entrance and exit of 4GL function

Bb=Generate output with info on Bind and Buffer variables

Uu=Generate output with info on SQL code

S=Generate output with info on SQL generated by the RTP subsystem. (translation of SQL to target database)

e=Generate output with info regarding error and warning states

!=Generate output based on communication with GUI clients helpful for determining GUI states.

E=Generate output info on internal stack (4GL variable management and function calls)

f=Generate output info on form/array handling

I=Generate output info on input handling

r=Generate output info on report handling

M=Generate output info on menu handling

m=Command line arguments and parameters

l=ODBC debugging information

Note: The debug log files are created in the querix/logs directory. These debug flags do not influence the compilation - they basically control the filter for the runtime debug information generation.

------------------------------------------------

This topic is covered in more depth in the database migration guide


To start with, and as a good general setting, set QXDEBUG=UuBbSe

bash$ QXDEBUG=UuBbSe ; export QXDEBUG
bash$ myprog.4ge 2>sql.out

This file will log the following information:

  • The original SQL statement
  • The regenerated SQL statement
  • The input variables
  • The output variables
  • Any errors.
    1. An example of this output is shown below. The 'U' shows the original SQL, the 'b' shows the input parameter, the 'S' shows the SQL generated for SQL Server, and the 'B' shows the values returned from this fetch:

      U SqlQuery : <select contact.cont_name, contact.cont_title, contact.cont_fname, contact.cont_lname, contact.cont_addr1, contact.cont_addr2, contact.cont_city, contact.cont_zone, contact.cont_country, contact.cont_zip, contact.cont_phone, contact.cont_fax, contact.cont_mobile, contact.cont_email, contact_type.ctype_name, company.comp_name, position_type.ptype_name, contact.cont_picture from contact, outer company, outer contact_type, outer position_type where contact.cont_id = ? and company.comp_id = contact.cont_org and contact.cont_position = position_type.type_id and contact.cont_type = contact_type.type_id>

      b <<< Bind List >>> SqlQuery INT : |1|

      S SSExecute : 00c57430 (Unnamed): Converted SQL=< SELECT contact.cont_name , contact.cont_title , contact.cont_fname , contact.cont_lname , contact.cont_addr1 , contact.cont_addr2 , contact.cont_city , contact.cont_zone , contact.cont_country , contact.cont_zip , contact.cont_phone , contact.cont_fax , contact.cont_mobile , contact.cont_email , contact_type.ctype_name , company.comp_name , position_type.ptype_name , contact.cont_picture FROM contact LEFT OUTER JOIN company ON company.comp_id = contact.cont_org LEFT OUTER JOIN contact_type ON contact.cont_type = contact_type.type_id LEFT OUTER JOIN position_type ON contact.cont_position = position_type.type_id WHERE contact.cont_id = ? >

      b <<< Bind List >>> SqlQuery CHAR(20) : |ALEX |
      CHAR(5) : |Mr |
      CHAR(20) : |Alex |
      CHAR(20) : |Williams |
      CHAR(40) : |1 The High Street |
      CHAR(40) : |Totton |
      CHAR(20) : |Southampton |
      CHAR(15) : |Hants |
      CHAR(30) : |UK |
      CHAR(15) : |SO15 5QR |
      CHAR(15) : |023 80232345 |
      CHAR(15) : |023 80399685 |
      CHAR(15) : |*Null*|
      CHAR(50) : |a.williams@querix.com |
      CHAR(15) : |*Null*|
      CHAR(100) : |Querix (UK) Ltd |
      CHAR(15) : |*Null*|
      BYTES : ||
      u SqlQuery : Returns 0

      U SqlQuery : <select contact.cont_name, contact.cont_title, contact.cont_fname, contact.cont_lname, contact.cont_addr1, contact.cont_addr2, contact.cont_city, contact.cont_zone, contact.cont_country, contact.cont_zip, contact.cont_phone, contact.cont_fax, contact.cont_mobile, contact.cont_email, contact_type.ctype_name, company.comp_name, position_type.ptype_name, contact.cont_picture from contact, outer company, outer contact_type, outer position_type where contact.cont_id = ? and company.comp_id = contact.cont_org and contact.cont_position = position_type.type_id and contact.cont_type = contact_type.type_id>

      S SSExecute : 00c57430 (Unnamed): Converted SQL=< SELECT contact.cont_name , contact.cont_title , contact.cont_fname , contact.cont_lname , contact.cont_addr1 , contact.cont_addr2 , contact.cont_city , contact.cont_zone , contact.cont_country , contact.cont_zip , contact.cont_phone , contact.cont_fax , contact.cont_mobile , contact.cont_email , contact_type.ctype_name , company.comp_name , position_type.ptype_name , contact.cont_picture FROM contact LEFT OUTER JOIN company ON company.comp_id = contact.cont_org LEFT OUTER JOIN contact_type ON contact.cont_type = contact_type.type_id LEFT OUTER JOIN position_type ON contact.cont_position = position_type.type_id WHERE contact.cont_id = ? >