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($loc_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 sql statement" . DBI->errstr; $loc_sth->execute() or die "Can't execute sql statement" . DBI->errstr; return $loc_sth; }