SELECTALL_XML(1p) | User Contributed Perl Documentation | SELECTALL_XML(1p) |
stag-selectall_xml - Query all elements from database with an XML output
stag-selectall_xml [-d <dbi>] [-f file of sql] [-nesting|n <nesting>] SQL
This script will query a database using either SQL provided by the script user, or using an SQL templates; the query results will be turned into XML using the DBIx::DBStag module. The nesting of the XML can be controlled by the DBStag SQL extension "USE NESTING..."
stag-selectall_xml -d "dbi:Pg:dbname=mydb;host=localhost"\ "SELECT * FROM a NATURAL JOIN b"
A parameterized SQL template (canned query) can be used instead of specifying the full SQL
For example:
stag-selectall_xml -d genedb /genedb-gene gene_symbol=Adh
Or:
stag-selectall_xml -d genedb /genedb-gene Adh
Or:
stag-selectall_xml -d genedb /genedb-gene gene_symbol@=Adh,dpp,bam,indy
A template is indicated by the syntactic shorthand of using a slash to precede the template name; in this case the template is called genedb-gene. the -t option can also be used.
All the remaining arguments are passed in as SQL template parameters. They can be passed in as either name=value pairs, or as a simple list of arguments which get passed into the template in order
To use templates, you should have the environment variable DBSTAG_TEMPLATE_DIRS set. See DBIx::DBStag for details.
stag-selectall_xml -d mydb -h
stag-selectall_xml /genedb-gene -h
if a template is specified, gives template details
if a db is specified, lists templates for that db
use in conjunction with -v for full descriptions
You can append to an existing where clause by using the prefix +
-pre "SET search_path=myschema,public"
2016-05-29 | perl v5.22.2 |