diff options
author | Daniel Gruno <humbedooh@apache.org> | 2013-01-27 15:45:11 +0000 |
---|---|---|
committer | Daniel Gruno <humbedooh@apache.org> | 2013-01-27 15:45:11 +0000 |
commit | 4ebc1451bd97175789c3b2e64c64a8909783ba3b (patch) | |
tree | b17b7984a1ca257abb822f55fba5901e1f817d30 /docs/manual | |
parent | 9fdffbb2e02ea27643adb17bed6f25c35deed09b (diff) | |
download | httpd-4ebc1451bd97175789c3b2e64c64a8909783ba3b.tar.gz |
xforms
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1439104 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'docs/manual')
24 files changed, 211 insertions, 26 deletions
diff --git a/docs/manual/howto/ssi.xml.meta b/docs/manual/howto/ssi.xml.meta index 1c020635eb..0d8deb802c 100644 --- a/docs/manual/howto/ssi.xml.meta +++ b/docs/manual/howto/ssi.xml.meta @@ -8,7 +8,7 @@ <variants> <variant>en</variant> - <variant outdated="yes">fr</variant> + <variant>fr</variant> <variant outdated="yes">ja</variant> <variant outdated="yes">ko</variant> </variants> diff --git a/docs/manual/mod/allmodules.xml.fr b/docs/manual/mod/allmodules.xml.fr index 625e0253f1..fa27a41896 100644 --- a/docs/manual/mod/allmodules.xml.fr +++ b/docs/manual/mod/allmodules.xml.fr @@ -30,10 +30,10 @@ <modulefile>mod_cache.xml.fr</modulefile> <modulefile>mod_cache_disk.xml.fr</modulefile> <modulefile>mod_cern_meta.xml.fr</modulefile> - <modulefile>mod_cgi.xml</modulefile> - <modulefile>mod_cgid.xml</modulefile> - <modulefile>mod_charset_lite.xml</modulefile> - <modulefile>mod_data.xml</modulefile> + <modulefile>mod_cgi.xml.fr</modulefile> + <modulefile>mod_cgid.xml.fr</modulefile> + <modulefile>mod_charset_lite.xml.fr</modulefile> + <modulefile>mod_data.xml.fr</modulefile> <modulefile>mod_dav.xml.fr</modulefile> <modulefile>mod_dav_fs.xml.fr</modulefile> <modulefile>mod_dav_lock.xml.fr</modulefile> @@ -46,8 +46,8 @@ <modulefile>mod_env.xml.fr</modulefile> <modulefile>mod_example.xml.fr</modulefile> <modulefile>mod_expires.xml.fr</modulefile> - <modulefile>mod_ext_filter.xml</modulefile> - <modulefile>mod_file_cache.xml</modulefile> + <modulefile>mod_ext_filter.xml.fr</modulefile> + <modulefile>mod_file_cache.xml.fr</modulefile> <modulefile>mod_filter.xml.fr</modulefile> <modulefile>mod_headers.xml.fr</modulefile> <modulefile>mod_heartbeat.xml</modulefile> diff --git a/docs/manual/mod/core.html.en b/docs/manual/mod/core.html.en index 3b00791e8e..880a404205 100644 --- a/docs/manual/mod/core.html.en +++ b/docs/manual/mod/core.html.en @@ -1274,7 +1274,7 @@ in case of an error</td></tr> <li>output a customized message</li> - <li>redirect to a local <var>URL-path</var> to handle the + <li>internally redirect to a local <var>URL-path</var> to handle the problem/error</li> <li>redirect to an external <var>URL</var> to handle the diff --git a/docs/manual/mod/core.xml.de b/docs/manual/mod/core.xml.de index 4b562d6b32..2a052cafc8 100644 --- a/docs/manual/mod/core.xml.de +++ b/docs/manual/mod/core.xml.de @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd"> <?xml-stylesheet type="text/xsl" href="../style/manual.de.xsl"?> -<!-- English Revision: 344972:1435365 (outdated) --> +<!-- English Revision: 344972:1438839 (outdated) --> <!-- Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/docs/manual/mod/core.xml.es b/docs/manual/mod/core.xml.es index 9fb4da379a..35273420ee 100644 --- a/docs/manual/mod/core.xml.es +++ b/docs/manual/mod/core.xml.es @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd"> <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?> -<!-- English Revision: 1040494:1435365 (outdated) --> +<!-- English Revision: 1040494:1438839 (outdated) --> <!-- Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/docs/manual/mod/core.xml.ja b/docs/manual/mod/core.xml.ja index 65e6c2aca0..1af1815a48 100644 --- a/docs/manual/mod/core.xml.ja +++ b/docs/manual/mod/core.xml.ja @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd"> <?xml-stylesheet type="text/xsl" href="../style/manual.ja.xsl"?> -<!-- English Revision: 669847:1435365 (outdated) --> +<!-- English Revision: 669847:1438839 (outdated) --> <!-- Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/docs/manual/mod/core.xml.meta b/docs/manual/mod/core.xml.meta index b9d96ee4c5..e78755527a 100644 --- a/docs/manual/mod/core.xml.meta +++ b/docs/manual/mod/core.xml.meta @@ -10,7 +10,7 @@ <variant outdated="yes">de</variant> <variant>en</variant> <variant outdated="yes">es</variant> - <variant outdated="yes">fr</variant> + <variant>fr</variant> <variant outdated="yes">ja</variant> <variant outdated="yes">tr</variant> </variants> diff --git a/docs/manual/mod/core.xml.tr b/docs/manual/mod/core.xml.tr index 65fdabb973..2a78d6c4c8 100644 --- a/docs/manual/mod/core.xml.tr +++ b/docs/manual/mod/core.xml.tr @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd"> <?xml-stylesheet type="text/xsl" href="../style/manual.tr.xsl"?> -<!-- English Revision: 1305164:1435365 (outdated) --> +<!-- English Revision: 1305164:1438839 (outdated) --> <!-- ===================================================== Translated by: Nilgün Belma Bugüner <nilgun belgeler.org> Reviewed by: Orhan Berent <berent belgeler.org> diff --git a/docs/manual/mod/mod_actions.xml.meta b/docs/manual/mod/mod_actions.xml.meta index 500a6d165f..21a3be67ab 100644 --- a/docs/manual/mod/mod_actions.xml.meta +++ b/docs/manual/mod/mod_actions.xml.meta @@ -9,7 +9,7 @@ <variants> <variant outdated="yes">de</variant> <variant>en</variant> - <variant outdated="yes">fr</variant> + <variant>fr</variant> <variant outdated="yes">ja</variant> <variant outdated="yes">ko</variant> </variants> diff --git a/docs/manual/mod/mod_auth_basic.xml.meta b/docs/manual/mod/mod_auth_basic.xml.meta index 6418e97753..dd48206a0e 100644 --- a/docs/manual/mod/mod_auth_basic.xml.meta +++ b/docs/manual/mod/mod_auth_basic.xml.meta @@ -8,7 +8,7 @@ <variants> <variant>en</variant> - <variant outdated="yes">fr</variant> + <variant>fr</variant> <variant outdated="yes">ja</variant> <variant outdated="yes">ko</variant> </variants> diff --git a/docs/manual/mod/mod_cgi.html.en b/docs/manual/mod/mod_cgi.html.en index 37d4e2e927..940297d856 100644 --- a/docs/manual/mod/mod_cgi.html.en +++ b/docs/manual/mod/mod_cgi.html.en @@ -25,6 +25,7 @@ <div id="preamble"><h1>Apache Module mod_cgi</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/mod/mod_cgi.html" title="English"> en </a> | +<a href="../fr/mod/mod_cgi.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ja/mod/mod_cgi.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | <a href="../ko/mod/mod_cgi.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div> @@ -238,6 +239,7 @@ in the scriptlog</td></tr> </div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/mod/mod_cgi.html" title="English"> en </a> | +<a href="../fr/mod/mod_cgi.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ja/mod/mod_cgi.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | <a href="../ko/mod/mod_cgi.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> diff --git a/docs/manual/mod/mod_cgid.html.en b/docs/manual/mod/mod_cgid.html.en index cff5d7e0ee..5af0d449cc 100644 --- a/docs/manual/mod/mod_cgid.html.en +++ b/docs/manual/mod/mod_cgid.html.en @@ -25,6 +25,7 @@ <div id="preamble"><h1>Apache Module mod_cgid</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/mod/mod_cgid.html" title="English"> en </a> | +<a href="../fr/mod/mod_cgid.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ja/mod/mod_cgid.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | <a href="../ko/mod/mod_cgid.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div> @@ -106,6 +107,7 @@ the cgi daemon</td></tr> </div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/mod/mod_cgid.html" title="English"> en </a> | +<a href="../fr/mod/mod_cgid.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ja/mod/mod_cgid.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | <a href="../ko/mod/mod_cgid.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> diff --git a/docs/manual/mod/mod_charset_lite.html.en b/docs/manual/mod/mod_charset_lite.html.en index 5fdfebc0d8..8361ffc2cf 100644 --- a/docs/manual/mod/mod_charset_lite.html.en +++ b/docs/manual/mod/mod_charset_lite.html.en @@ -25,6 +25,7 @@ <div id="preamble"><h1>Apache Module mod_charset_lite</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/mod/mod_charset_lite.html" title="English"> en </a> | +<a href="../fr/mod/mod_charset_lite.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ko/mod/mod_charset_lite.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div> <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Specify character set translation or recoding</td></tr> @@ -206,6 +207,7 @@ </div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/mod/mod_charset_lite.html" title="English"> en </a> | +<a href="../fr/mod/mod_charset_lite.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ko/mod/mod_charset_lite.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> <script type="text/javascript"><!--//--><![CDATA[//><!-- diff --git a/docs/manual/mod/mod_data.html.en b/docs/manual/mod/mod_data.html.en index e5f79266a5..250e88b976 100644 --- a/docs/manual/mod/mod_data.html.en +++ b/docs/manual/mod/mod_data.html.en @@ -24,7 +24,8 @@ <div id="page-content"> <div id="preamble"><h1>Apache Module mod_data</h1> <div class="toplang"> -<p><span>Available Languages: </span><a href="../en/mod/mod_data.html" title="English"> en </a></p> +<p><span>Available Languages: </span><a href="../en/mod/mod_data.html" title="English"> en </a> | +<a href="../fr/mod/mod_data.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> </div> <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Convert response body into an RFC2397 data URL</td></tr> <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr> @@ -76,7 +77,8 @@ </div> <div class="bottomlang"> -<p><span>Available Languages: </span><a href="../en/mod/mod_data.html" title="English"> en </a></p> +<p><span>Available Languages: </span><a href="../en/mod/mod_data.html" title="English"> en </a> | +<a href="../fr/mod/mod_data.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> <script type="text/javascript"><!--//--><![CDATA[//><!-- var comments_shortname = 'httpd'; diff --git a/docs/manual/mod/mod_dav_fs.xml.meta b/docs/manual/mod/mod_dav_fs.xml.meta index 4c7de8838b..bea303cc75 100644 --- a/docs/manual/mod/mod_dav_fs.xml.meta +++ b/docs/manual/mod/mod_dav_fs.xml.meta @@ -8,7 +8,7 @@ <variants> <variant>en</variant> - <variant outdated="yes">fr</variant> + <variant>fr</variant> <variant outdated="yes">ja</variant> <variant outdated="yes">ko</variant> </variants> diff --git a/docs/manual/mod/mod_dav_lock.xml.meta b/docs/manual/mod/mod_dav_lock.xml.meta index b05b799574..3c40c2c19b 100644 --- a/docs/manual/mod/mod_dav_lock.xml.meta +++ b/docs/manual/mod/mod_dav_lock.xml.meta @@ -8,7 +8,7 @@ <variants> <variant>en</variant> - <variant outdated="yes">fr</variant> + <variant>fr</variant> <variant outdated="yes">ja</variant> </variants> </metafile> diff --git a/docs/manual/mod/mod_ext_filter.html.en b/docs/manual/mod/mod_ext_filter.html.en index 3a60c3b3fc..21cbfb2d1c 100644 --- a/docs/manual/mod/mod_ext_filter.html.en +++ b/docs/manual/mod/mod_ext_filter.html.en @@ -25,6 +25,7 @@ <div id="preamble"><h1>Apache Module mod_ext_filter</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/mod/mod_ext_filter.html" title="English"> en </a> | +<a href="../fr/mod/mod_ext_filter.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ja/mod/mod_ext_filter.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | <a href="../ko/mod/mod_ext_filter.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div> @@ -338,6 +339,7 @@ close(SAVE); </div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/mod/mod_ext_filter.html" title="English"> en </a> | +<a href="../fr/mod/mod_ext_filter.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ja/mod/mod_ext_filter.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | <a href="../ko/mod/mod_ext_filter.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> diff --git a/docs/manual/mod/mod_file_cache.html.en b/docs/manual/mod/mod_file_cache.html.en index 6f3af63205..85e87697be 100644 --- a/docs/manual/mod/mod_file_cache.html.en +++ b/docs/manual/mod/mod_file_cache.html.en @@ -25,6 +25,7 @@ <div id="preamble"><h1>Apache Module mod_file_cache</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/mod/mod_file_cache.html" title="English"> en </a> | +<a href="../fr/mod/mod_file_cache.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ko/mod/mod_file_cache.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div> <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Caches a static list of files in memory</td></tr> @@ -208,6 +209,7 @@ </div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/mod/mod_file_cache.html" title="English"> en </a> | +<a href="../fr/mod/mod_file_cache.html" hreflang="fr" rel="alternate" title="Français"> fr </a> | <a href="../ko/mod/mod_file_cache.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p> </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> <script type="text/javascript"><!--//--><![CDATA[//><!-- diff --git a/docs/manual/mod/mod_lua.html.en b/docs/manual/mod/mod_lua.html.en index 99f07db1f8..e8286ed9d9 100644 --- a/docs/manual/mod/mod_lua.html.en +++ b/docs/manual/mod/mod_lua.html.en @@ -78,6 +78,7 @@ Be sure to check the CHANGES file before upgrading.</div> <li><img alt="" src="../images/down.gif" /> <a href="#datastructures">Data Structures</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#logging">Logging Functions</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#apache2">apache2 Package</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#databases">Database connectivity</a></li> </ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> @@ -466,6 +467,12 @@ r:parsebody([sizeLimit]) -- parse the request body as a POST and return a lua t r:write("a single string") -- print to response body </pre> + + <pre class="prettyprint lang-lua"> +r:dbacquire(dbType[, dbParams]) -- Acquires a connection to a database and returns a database class. + -- See '<a href="#databases">Database connectivity</a>' for details. + </pre> + </dd> </dl> @@ -508,6 +515,174 @@ r:parsebody([sizeLimit]) -- parse the request body as a POST and return a lua t <dd>internal constants used by <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code></dd> </dl> <p>(Other HTTP status codes are not yet implemented.)</p> +</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="databases" id="databases">Database connectivity</a></h2> + + <p> + Mod_lua implements a simple database feature for querying and running commands + on the most popular database engines (mySQL, PostgreSQL, FreeTDS, ODBC, SQLite, Oracle) + as well as mod_dbd. + </p> + <p>Connecting and firing off queries is as easy as:</p> + <pre class="prettyprint lang-lua"> +function handler(r) + local database, err = r:dbacquire("mysql", "server=localhost&user=root&database=mydb") + if not err then + local results, err = database:select(r, "SELECT `name`, `age` FROM `people` WHERE 1") + if not err then + local rows = results(0) -- fetch all rows synchronously + for k, row in pairs(rows) do + r:puts( string.format("Name: %s, Age: %s<br/>", row[1], row[2]) ) + end + else + r:puts("Database query error: " .. err) + end + database:close() + else + r:puts("Could not connect to the database: " .. err) + end +end + </pre> + + <p> + To utilize <code class="module"><a href="../mod/mod_dbd.html">mod_dbd</a></code>, simply specify <code>mod_dbd</code> + as the database type, or leave the field blank: + </p> + <pre class="prettyprint lang-lua"> + local database = r:dbacquire("mod_dbd") + </pre> + + <h3><a name="database_object" id="database_object">Database object and contained functions</a></h3> + + <p>The database object returned by <code>dbacquire</code> has the following methods:</p> + <p><strong>Normal select and query from a database:</strong></p> + <pre class="prettyprint lang-lua"> +-- Run a statement and return the number of rows affected: +local affected, errmsg = database:query(r, "DELETE FROM `tbl` WHERE 1") + +-- Run a statement and return a result set that can be used synchronously or async: +local result, errmsg = database:select(r, "SELECT * FROM `people` WHERE 1") + </pre> + + <p><strong>Using prepared statements (recommended):</strong></p> + <pre class="prettyprint lang-lua"> +-- Create and run a prepared statement: +local statement, errmsg = database:prepare(r, "DELETE FROM `tbl` WHERE `age` > %u") +if not errmsg then + local result, errmsg = statement:query(20) -- run the statement with age >20 +end + +-- Fetch a prepared statement from a DBDPrepareSQL directive: +local statement, errmsg = database:prepared(r, "someTag") +if not errmsg then + local result, errmsg = statement:select("John Doe", 123) -- inject the values "John Doe" and 123 into the statement +end + +</pre> + + <p><strong>Escaping values, closing databases etc:</strong></p> + <pre class="prettyprint lang-lua"> +-- Escape a value for use in a statement: +local escaped = database:escape(r, [["'|blabla]]) + +-- Close a database connection and free up handles: +database:close() + +-- Check whether a database connection is up and running: +local connected = database:active() + </pre> + + + <h3><a name="result_sets" id="result_sets">Working with result sets</a></h3> + + <p>The result set returned by <code>db:select</code> or by the prepared statement functions + created through <code>db:prepare</code> can be used to + fetch rows synchronously or asynchronously, depending on the row number specified:<br /> + <code>result(0)</code> fetches all rows in a synchronous manner, returning a table of rows.<br /> + <code>result(-1)</code> fetches the next available row in the set, asynchronously.<br /> + <code>result(N)</code> fetches row number <code>N</code>, asynchronously: + </p> + <pre class="prettyprint lang-lua"> +-- fetch a result set using a regular query: +local result, err = db:select(r, "SELECT * FROM `tbl` WHERE 1") + +local rows = result(0) -- Fetch ALL rows synchronously +local row = result(-1) -- Fetch the next available row, asynchronously +local row = result(1234) -- Fetch row number 1234, asynchronously + </pre> + + <p>One can construct a function that returns an iterative function to iterate over all rows + in a synchronous or asynchronous way, depending on the async argument: + </p> + <pre class="prettyprint lang-lua"> +function rows(resultset, async) + local a = 0 + local function getnext() + a = a + 1 + local row = resultset(-1) + return row and a or nil, row + end + if not async then + return pairs(resultset(0)) + else + return getnext, self + end +end + +local statement, err = db:prepare(r, "SELECT * FROM `tbl` WHERE `age` > %u") +if not err then + -- fetch rows asynchronously: + local result, err = statement:select(20) + if not err then + for index, row in rows(result, true) do + .... + end + end + + -- fetch rows synchronously: + local result, err = statement:select(20) + if not err then + for index, row in rows(result, false) do + .... + end + end +end + </pre> + + + <h3><a name="closing_databases" id="closing_databases">Closing a database connection</a></h3> + + + <p>Database handles should be closed using <code>database:close()</code> when they are no longer + needed. If you do not close them manually, they will eventually be garbage collected and + closed by mod_lua, but you may end up having too many unused connections to the database + if you leave the closing up to mod_lua. Essentially, the following two measures are + the same: + </p> + <pre class="prettyprint lang-lua"> +-- Method 1: Manually close a handle +local database = r:dbacquire("mod_dbd") +database:close() -- All done + +-- Method 2: Letting the garbage collector close it +local database = r:dbacquire("mod_dbd") +database = nil -- throw away the reference +collectgarbage() -- close the handle via GC +</pre> + + + <h3><a name="database_caveat" id="database_caveat">Precautions when working with databases</a></h3> + + <p>Although the standard <code>query</code> and <code>run</code> functions are freely + available, it is recommended that you use prepared statements whenever possible, to + both optimize performance (if your db handle lives on for a long time) and to minimize + the risk of SQL injection attacks. <code>run</code> and <code>query</code> should only + be used when there are no variables inserted into a statement (a static statement). + When using dynamic statements, use <code>db:prepare</code> or <code>db:prepared</code>. + </p> + + </div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="directive-section"><h2><a name="LuaAuthzProvider" id="LuaAuthzProvider">LuaAuthzProvider</a> <a name="luaauthzprovider" id="luaauthzprovider">Directive</a></h2> diff --git a/docs/manual/mod/mod_lua.xml.fr b/docs/manual/mod/mod_lua.xml.fr index cf7c4f7e71..219c8f2c63 100644 --- a/docs/manual/mod/mod_lua.xml.fr +++ b/docs/manual/mod/mod_lua.xml.fr @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd"> <?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?> -<!-- English Revision : 1425749 --> +<!-- English Revision: 1425749:1439099 (outdated) --> <!-- French translation : Lucien GENTIS --> <!-- Reviewed by : Vincent Deffontaines --> diff --git a/docs/manual/mod/mod_lua.xml.meta b/docs/manual/mod/mod_lua.xml.meta index b55c7710e9..8fc1a0efdf 100644 --- a/docs/manual/mod/mod_lua.xml.meta +++ b/docs/manual/mod/mod_lua.xml.meta @@ -8,6 +8,6 @@ <variants> <variant>en</variant> - <variant>fr</variant> + <variant outdated="yes">fr</variant> </variants> </metafile> diff --git a/docs/manual/mod/mod_proxy.xml.meta b/docs/manual/mod/mod_proxy.xml.meta index f0185375d4..38a79fdda7 100644 --- a/docs/manual/mod/mod_proxy.xml.meta +++ b/docs/manual/mod/mod_proxy.xml.meta @@ -8,7 +8,7 @@ <variants> <variant>en</variant> - <variant outdated="yes">fr</variant> + <variant>fr</variant> <variant outdated="yes">ja</variant> </variants> </metafile> diff --git a/docs/manual/platform/windows.html.en b/docs/manual/platform/windows.html.en index e57280adf3..4973ab2a17 100644 --- a/docs/manual/platform/windows.html.en +++ b/docs/manual/platform/windows.html.en @@ -114,9 +114,7 @@ Windows filenames instead of Unix ones. However, because Apache may interpret backslashes as an "escape character" sequence, you should consistently use forward slashes in path names, not - backslashes. Drive letters can be used; if omitted, the drive - of the SystemRoot directive (or -d command line option) becomes - the default.</p></li> + backslashes.</p></li> <li><p>While filenames are generally case-insensitive on Windows, URLs are still treated internally as case-sensitive diff --git a/docs/manual/platform/windows.xml.ko b/docs/manual/platform/windows.xml.ko index 9b25b798e9..51e1d30000 100644 --- a/docs/manual/platform/windows.xml.ko +++ b/docs/manual/platform/windows.xml.ko @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="EUC-KR" ?> <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd"> <?xml-stylesheet type="text/xsl" href="../style/manual.ko.xsl"?> -<!-- English Revision: 105989:1423081 (outdated) --> +<!-- English Revision: 105989:1438835 (outdated) --> <!-- Licensed to the Apache Software Foundation (ASF) under one or more |