--- loncom/lonsql 2006/02/08 17:11:46 1.73 +++ loncom/lonsql 2006/02/08 21:17:53 1.74 @@ -3,7 +3,7 @@ # The LearningOnline Network # lonsql - LON TCP-MySQL-Server Daemon for handling database requests. # -# $Id: lonsql,v 1.73 2006/02/08 17:11:46 www Exp $ +# $Id: lonsql,v 1.74 2006/02/08 21:17:53 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -466,7 +466,7 @@ sub make_new_child { } } else { # Do an sql query - $result = &do_sql_query($query,$arg1,$arg2); + $result = &do_sql_query($query,$arg1,$arg2,$searchdomain); } # result does not need to be escaped because it has already been # escaped. @@ -517,8 +517,18 @@ sub process_file { } sub do_sql_query { - my ($query,$custom,$customshow) = @_; -# &logthis('doing query '.$query); + my ($query,$custom,$customshow,$searchdomain) = @_; + +# +# limit to searchdomain if given and table is metadata +# + if (($searchdomain) && ($query=~/FROM metadata/)) { + $query.=' HAVING (domain="'.$searchdomain.'")'; + } +# &logthis('doing query ('.$searchdomain.')'.$query); + + + $custom = &unescape($custom); $customshow = &unescape($customshow); #