DBIx-DBStag
view release on metacpan or search on metacpan
DBIx/DBStag.pm view on Meta::CPAN
if (!$template) {
print STDERR "\n\nI could not find the Stag SQL template called \"$tname\".\n";
if (!$path) {
print STDERR <<EOM1
In order to do use this or any other template, you need to set the environment
variable DBSTAG_TEMPLATE_DIRS to the directory or a set of directories
containing SQL templates. For example
setenv DBSTAG_TEMPLATE_DIRS=".:\$HOME/my-sql-templates:/usr/share/system-sql-templates"
EOM1
;
}
else {
print STDERR <<EOM2
I am looking in the following directories:
$path
Check the contents of the directory to see if the stag sql template
you require is there, and is readable by you. Stag SQL templates
should end with the suffix ".stg"
If you wish to search other directories, set the environment variable
DBSTAG_TEMPLATE_DIRS, like this:
setenv DBSTAG_TEMPLATE_DIRS=".:\$HOME/my-sql-templates:$path"
EOM2
;
}
$self->throw("Could not find template \"$tname\" in: $path");
}
return $template;
}
sub find_templates_by_schema {
DBIx/DBStag/Cookbook.pm view on Meta::CPAN
First create a place for your templates:
mkdir ./templates
(do not change directory after this)
The following command specifies a colon-separated path for directories
containing templates (all templates must end with .stg)
setenv DBSTAG_TEMPLATE_DIRS ".:templates:/usr/local/share/sql/templates"
Auto-generate templates (you can customize these later):
stag-autoschema.pl -w sxpr cia-pp2.xml > cia-stagschema.sxpr
stag-autotemplate.pl -no_pp -s cia -dir ./templates cia-stagschema.sxpr
The first command creates an S-Expression representation of the
Schema; the second generates SQL templates from these.
You may wish to examine a template:
DBIx/DBStag/SQLTemplate.pm view on Meta::CPAN
=head1 DESCRIPTION
A template represents a canned query that can be parameterized.
Templates are collected in directories (in future it will be possible
to store them in files or in the db itself).
To tell DBStag where your templates are, you should set:
setenv DBSTAG_TEMPLATE_DIRS "$HOME/mytemplates:/data/bioconf/templates"
Your templates should end with the suffix B<.stg>, otherwise they will
not be picked up
You can name templates any way you like, but the standard way is to
use 2 or 3 fields
SCHEMA-OBJECT
or
( run in 0.524 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )