WebSource::DB : For each input execute a query and return the result as output
A DB operator allows to execute a parameterized SQL query for each input. This allows, for example, to populate a database with extracted data.
A typical DB operator declaration is as follows :
<ws:database name="db" forward-to="format"> <parameters> <param name="db" value="factbook" /> <param name="user" value="username" /> <param name="pass" value="password" /> </parameters> <query> INSERT INTO country(name, population, coordinates) VALUES ('$country','$population','$coordinates') </query> </ws:database>
When the query is active (results are produced), the operator returns these results. Otherwise, the input is simply forwarded on for further treatment.
$cache = WebSource::DB->new(wsnode => $node); # for the rest it works as a WebSource::Module