shell% cat concrete.sql select city, date from weather where temp_lo < 20; shell% sql_test concrete.sql shell% cat testexec.out # see results of prepare, execute on this #### shell% cat abstract.sql select city, date from weather where temp_lo < ?; shell% sql_test abstract.sql 55 # send in placeholder value shell% cat testexec.out # to see results... looks good #### shell% sql_register abstract.sql basic_weather [hi_and_low] inserted as [select city from weather where temp_lo > ? and temp_hi > ? LIMIT 10] #### ... then in a Perl program (e.g. test.pl in this distribution) my $dbh = SQL::Catalog->db_handle; # optional - get the handle as you please my $sql = SQL::Catalog->lookup('hi_and_low'); my $sth = $dbh->prepare($sql); $sth->execute(55); #### my $rows = $sth->rows; #### [city_date_via_temp_hi] saved as [select city, date from weather where temp_hi > ?] #### my $dbh = SQL::Catalog->db_handle; my $SQL = SQL::Catalog->lookup('city_date_via_temp_hi') or die 'not found'; my $sth = $dbh->prepare($SQL, $cgi->param('degrees')); .... etc #### CREATE TABLE sql_catalog ( query varchar(65535) , # the actual query tables varchar(255) , # tables used columns varchar(255) , # fields selected cmd varchar(40) , # SELECT, INSERT, UPDATE, etc phold int4 # number of bind_values ); #### mydb=# select label,cmd,columns,tables,phold from sql_catalog; label | cmd | columns | tables | phold ---------------+--------+--------------------------------------------------- weather_hi | SELECT | weather.city,weather.date | weather | 1 hi_and_low | SELECT | weather.city | weather | 2