in reply to Application Error
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; }
I will defer to SQL DB Monks. I don't understand how your code is supposed to work.sub select_record_set { my ($SQL_select_clause, #I just named the vars according to $SQL_from_clause, #your comment code $SQL_where_clause, #pick new names if you like $SQL_order_by_clause, #pick a name that renders #the #comment useless ) = @_; my $statement_handle = (); #not sure that you need these my $sql_string = (); #vars # I get lost here.... # prepare(), execute() # for that matter, if you are passing in an SQL statement, # why do you need the $SQL vars above? Prepare the statement and # then run it. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Application Error
by Steve_BZ (Chaplain) on Aug 12, 2009 at 11:58 UTC | |
by Marshall (Canon) on Aug 14, 2009 at 18:26 UTC |