I'm getting a perl.exe - Application error that is defeating all my best attempts to debug. I have a routine that has been working perfectly for a while and now I have added some more code that accesses it only for the original code to crash. I am using Komodo 5, so I had hopped that Komodo would catch it and give me a reason code, but no.
I have a firebird database, accessed using DBI.
Here is the crashing code:
sub __select_recordset{
my $loc_select = shift; #SQL SELECT clause
my $loc_from = shift; #SQL FROM clause including join, if any
my $loc_where = shift; #SQL WHERE clause
my $loc_order = shift; #SQL ORDER BY clause
my $loc_sth ; #Statement handle
my $loc_sql_string; # Complete SQL string without ";"
#
# Removes leading and training whitespace from parameters.
#
if (__trim($loc_where) ne "" ){
$loc_sql_string = "select ".__trim($loc_select)." from "._
+_trim($loc_from)." where ".__trim($loc_where)." order by ".__trim($lo
+c_order);
} else {
$loc_sql_string = "select ".__trim($loc_select)." from ".
+__trim($loc_from)." order by ".__trim($loc_order);
}
$loc_sth=$gl_dbh->prepare($loc_sql_string) or die "Can't prepare s
+ql statement" . DBI->errstr;
$loc_sth->execute() or die "Can't execute sql statement" . DBI->er
+rstr;
return $loc_sth;
}
and here is the SQL in ,
$loc_sql_string
"select tbl_patient_exam.att_patient_examination_dte, tbl_patient_exam.att_patient_exam_time_dte, tbl_patient_exam.att_patient_ref_3_org_txt, tbl_patient_exam.att_patient_ref_3_txt, tbl_patient_exam.att_examining_doctor_id_txt, tbl_patient_exam.att_referring_doctor_id_txt, tbl_patient_exam.att_patient_exam_status_txt, tbl_patient_exam.att_vitals_endoscopy_txt, tbl_patient_exam.att_vitals_blood_pressure_txt, tbl_patient_exam.att_vitals_pulse_txt, tbl_patient_exam.att_vitals_height_txt, tbl_patient_exam.att_vitals_weight_txt, tbl_patient_exam.att_vitals_o2_txt, tbl_patient_exam.att_vitals_patient_field_1_txt, tbl_patient_exam.att_vitals_patient_field_2_txt, tbl_patient_exam.att_vitals_patient_field_3_txt, tbl_patient_exam.att_vitals_patient_field_4_txt, tbl_patient_exam.att_vitals_patient_field_5_txt from tbl_patient_exam where tbl_patient_exam.att_patient_id_txt = '1' order by tbl_patient_exam.att_patient_id_txt"
Which works perfectly when cut and paste into my SQL engine.
The error is 'The instruction at "0x7c910f1e" referenced memory at "0x00580054". The memory could not be "read"
Click on OK to terminate program
Click on Cancel to debug program'
Neither of which shed any light on the problem.
I wondered if I had built up some memory problem causing a stack overflow by not disconnecting properly, so I set dbh as a global variable and opened it once at the beginning of the programme. The only strange thing is that the error disappears when I remove
"tbl_patient_exam.att_vitals_patient_field_1_txt, tbl_patient_exam.att_vitals_patient_field_2_txt, tbl_patient_exam.att_vitals_patient_field_3_txt, tbl_patient_exam.att_vitals_patient_field_4_txt,"
But the exact same SQL still works in a previous version of the program.