AxKit::XSP::ESQL

AxKit::XSP::ESQL is an Extended SQL taglib for AxKit eXtensible Server Pages.
Download

AxKit::XSP::ESQL Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Matt Sergeant
  • Publisher web site:
  • http://search.cpan.org/~msergeant/

AxKit::XSP::ESQL Tags


AxKit::XSP::ESQL Description

AxKit::XSP::ESQL is an Extended SQL taglib for AxKit eXtensible Server Pages. AxKit::XSP::ESQL is an Extended SQL taglib for AxKit eXtensible Server Pages.SYNOPSISAdd the esql: namespace to your XSP < xsp:page > tag: < xsp:page language="Perl" xmlns:xsp="http://apache.org/xsp/core/v1" xmlns:esql="http://apache.org/xsp/SQL/v2" >And add this taglib to AxKit (via httpd.conf or .htaccess): AxAddXSPTaglib AxKit::XSP::ESQLThis tag library provides extensive support for executing SQL statements from within XSP. This tag library is the same as the Cocoon ESQL taglib.TAG REFERENCENote that below we use the esql: prefix as a convention, however you can use whatever prefix you like provided it is mapped to the appropriate namespace.< esql:connection> parent: noneThis is the required 'wrapper' element that declares your connection.< esql:driver> parent: < esql:connection>The contents of this element define the DBI driver to be used. For example, Pg, Sybase, Oracle.You can also add an optional attribute: transactions='no' to the driver element, to indicate that this driver does not support transactions (or just that you don't want to use transactions).< esql:dburl> parent: < esql:connection>The name of this tag is a hang-over from the Cocoon (Java) version. In the AxKit version this is simply anything that goes after the driver in the connection string. So for PostgreSQL you might have in here dbname=axkit, to connect to the "axkit" database. The full connect string is constructed as follows: "dbi:$driver" . ($dburl ? ":$dburl" : "")See your DBD driver documentation for more details on what is valid for the connection string.< esql:username> parent: < esql:connection>The username to connect to the database with.< esql:password> parent: < esql:connection>The password to use to connect to the database.< esql:execute-query> parent: < esql:connection>This tag is a 'wrapper' tag around queries. You may have as many queries as you like within a single < esql:connection> tag.< esql:skip-rows> parent: < esql:execute-query>The contents of this tag (which may be an < xsp:expr>) define a number of rows to skip forward in the result set.< esql:max-rows> parent: < esql:execute-query>The maximum number of rows to return.< esql:query> parent: < esql:execute-query>The contents of this tag define the query to be executed.< esql:parameter> parent: < esql:query>This tag can be put in your SQL query everywhere you might put a ? in your SQL in DBI. ESQL is intelligent enough to create a cached statement when you do this, and only execute your code when necessary. You put an expression (or another taglib) within the parameter tag (see the example below).< esql:results> parent: < esql:execute-query>The contents of this tag are "executed" whenever the query returns some results.< esql:row-results> parent: < esql:results>The contents of this tag are "executed" for each row of the results< esql:get-columns> parent: < esql:row-results>This tag gets all of the columns in the current row, and outputs them as < column_name>value< /column_name>. If you specify an attribute tag-case="upper", all columns are upper case. Alternatively, "lower" gives you all tags in lower case. An ancestor attribute is also allowed, see "Nested Results" below for more details.get-* parent: < esql:row-results>These are: get-column get-string get-boolean get-double get-float get-int get-long get-short(and more below)Each of these takes either an attribute column="name", or a child tag, < esql:column> which gives the column name. Alternatively either the attribute or child element can be an integer (starting at 1) specifying the column number.Also allowed is an ancestor attribute, which is an integer (default 0), which indicates how far up the nested results you go. See Nested Results below.< esql:get-date>, < esql:get-time>, < esql:get-timestamp> parent: < esql:row-results>These tags are the same as get-* above, except they also take a format="..." attribute, which contains a strftime formatting string.< esql:get-xml> parent: < esql:row-results>Again the same as get-* above. This tag assumes the contents of the column are valid XML, and appends that XML into the result tree.< esql:get-row-position> parent: < esql:row-results>Gets the current row number. Optional ancestor attribute.< esql:get-column-name> parent: < esql:row-results>Gets the column name indicated by the numbered column in the column="..." attribute, or the child < esql:column> element. The attribute/child can actually be a string (name), but then what is the point of that?< esql:get-column-label> parent: < esql:row-results>Gets the label of the column. This is a hang-over from the Cocoon java implementation where sadly nobody seems to know what label is compared with name. In this case, get-column-name is always lower case, whereas get-column-label is returned in the case that the DBD driver returns it as.< esql:get-column-type-name> parent: < esql:row-results>Returns the TYPE_NAME of the column indicated as other get-* elements. See the DBI docs for more details.< esql:no-results> parent: < esql:execute-query>The contents of this element are executed when the SQL returned no rows.< esql:update-results> parent: < esql:execute-query>The contents of this element are executed when the SQL was an update statement. The number of rows updated are in the $rv variable. Requirements: · Perl


AxKit::XSP::ESQL Related Software