Debug my Programs.

Interactive Debugger

There is no interactive debugger in ‘Hydra4GL’, but it is included in Lycia IDE which is a part of Lycia development suite – the next generation of the 4GL Querix Tools.

Debugging SQL Problems

Interactive debuggers don’t tend to be a lot of help when dealing with SQL problems, especially since SQL is dynamically translated.
You will find the debug tracing is far more valuable in solving this kind of problem. To enable this feature, 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, enable SQL tracing by using the environment variable QXDEBUG.
QXDEBUG creates a log file in the ‘logs’ directory of the ‘Hydra4GL’ or Lycia install (c:\program files\querix\logs, or $QUERIXDIR\logs for ‘Hydra4GL’ and C:\ProgramData\Querix\Lycia x\ 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
Ss=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
D=Generate output from data handler
t=various sql type issues
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.
————————————————
To start with, 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.

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 = ? >

Click the link below to see
all KB articles by product.