[sr-dev] git:master: sqlops: adding missing ending tags to docbook

Daniel-Constantin Mierla miconda at gmail.com
Sun Mar 13 22:20:06 CET 2011


Module: sip-router
Branch: master
Commit: a4daa0d11e758dc7e72673a2e670338d19591ee8
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a4daa0d11e758dc7e72673a2e670338d19591ee8

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sun Mar 13 22:19:12 2011 +0100

sqlops: adding missing ending tags to docbook

- replaced list of routing blocks with ANY_ROUTE

---

 modules_k/sqlops/README               |   71 +++++++++++++++++++++++++++------
 modules_k/sqlops/doc/sqlops_admin.xml |   17 ++++----
 2 files changed, 67 insertions(+), 21 deletions(-)

diff --git a/modules_k/sqlops/README b/modules_k/sqlops/README
index 902f709..5656715 100644
--- a/modules_k/sqlops/README
+++ b/modules_k/sqlops/README
@@ -32,7 +32,8 @@ Daniel-Constantin Mierla
         4. Exported Functions
 
               4.1. sql_query(connection, query, result)
-              4.2. sql_result_free(result)
+              4.2. sql_xquery(connection, query, result)
+              4.3. sql_result_free(result)
 
         5. Exported pseudo-variables
 
@@ -43,8 +44,9 @@ Daniel-Constantin Mierla
    1.1. Set sqlcon parameter
    1.2. Set sqlres parameter
    1.3. sql_query() usage
-   1.4. sql_result_free() usage
-   1.5. $dbr(result=>key) usage
+   1.4. sql_xquery() usage
+   1.5. sql_result_free() usage
+   1.6. $dbr(result=>key) usage
 
 Chapter 1. Admin Guide
 
@@ -64,7 +66,8 @@ Chapter 1. Admin Guide
    4. Exported Functions
 
         4.1. sql_query(connection, query, result)
-        4.2. sql_result_free(result)
+        4.2. sql_xquery(connection, query, result)
+        4.3. sql_result_free(result)
 
    5. Exported pseudo-variables
 
@@ -91,6 +94,10 @@ Chapter 1. Admin Guide
        [row,column].
      * persistence in process space - a result can be used many times in
        the same worker process. Query once, use many times.
+     * alternatively, results can be stored in xavps - columns are
+       accessed by their names, rows by xavp index. Xavp's are available
+       during the transactions lifetime and don't need to be destroyed
+       manually.
 
 2. Dependencies
 
@@ -153,7 +160,8 @@ modparam("sqlops", "sqlres", "ra")
 4. Exported Functions
 
    4.1. sql_query(connection, query, result)
-   4.2. sql_result_free(result)
+   4.2. sql_xquery(connection, query, result)
+   4.3. sql_result_free(result)
 
 4.1.  sql_query(connection, query, result)
 
@@ -164,8 +172,7 @@ modparam("sqlops", "sqlres", "ra")
      * result - string name to identify the result. Will be used by
        $dbr(...) pseudo-variable to access result attributes.
 
-   This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
-   ONREPLY_ROUTE, BRANCH_ROUTE.
+   This function can be used from ANY_ROUTE.
 
    Example 1.3. sql_query() usage
 ...
@@ -176,14 +183,32 @@ xlog("number of rows in table domain: $dbr(ra=>rows)\n");
 sql_result_free("ra");
 ...
 
-4.2.  sql_result_free(result)
+4.2.  sql_xquery(connection, query, result)
+
+   Make a SQL query using 'connection' and store data in 'result' xavp.
+     * connection - the name of the connection to be used for query
+       (defined via the “sqlcon” parameter).
+     * query - SQL query string or pseudo-variables containing SQL query.
+     * result - string name to identify the result xavp. Each row will be
+       added to this xavp, each column can be accessed by its name.
+
+   This function can be used from ANY_ROUTE.
+
+   Example 1.4. sql_xquery() usage
+...
+modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
+...
+sql_xquery("ca", "select * from domain", "ra");
+  xlog("first domain: $xavp(ra=>domain) with id: $xavp(ra=>domain_id)\n");
+...
+
+4.3.  sql_result_free(result)
 
    Free data in SQL 'result'.
 
-   This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
-   ONREPLY_ROUTE, BRANCH_ROUTE.
+   This function can be used from ANY_ROUTE.
 
-   Example 1.4. sql_result_free() usage
+   Example 1.5. sql_result_free() usage
 ...
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
 ...
@@ -212,7 +237,7 @@ sql_result_free("ra");
        integer.
      * colname[N] - return the name of the N-th column in the result set.
 
-   Example 1.5. $dbr(result=>key) usage
+   Example 1.6. $dbr(result=>key) usage
 ...
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
 ...
@@ -240,3 +265,25 @@ if($dbr(ra=>rows)>0)
 }
 sql_result_free("ra");
 ...
+
+
+...
+if (sql_xquery("ca", "select * from domain", "ra") == 1)
+{
+# non-destructive iteration
+    $var(i) = 0;
+    while($xavp(ra[$var(i)]) != $null)
+    {
+        xlog("[id, domain] = [$xavp(ra[$var(i)]=>id), $xavp(ra[$var(i)]=>domain)
+]\n");
+        $var(i) = $var(i) + 1;
+    }
+
+# destructive iteration
+    while($xavp(ra) != $null)
+    {
+        xlog("[id, domain] = [$xavp(ra=>id), $xavp(ra=>domain)]\n");
+        pv_unset("$xavp(ra)");
+    }
+}
+...
diff --git a/modules_k/sqlops/doc/sqlops_admin.xml b/modules_k/sqlops/doc/sqlops_admin.xml
index 57ac3ab..d042c61 100644
--- a/modules_k/sqlops/doc/sqlops_admin.xml
+++ b/modules_k/sqlops/doc/sqlops_admin.xml
@@ -62,9 +62,10 @@
 		</listitem>
 		<listitem>
 		<para>
-			<emphasis>alternatively, results can be stored in xavps. Columns are
-			accessed by their names, rows by xavp index. Xavp's are available 
-			during the transactions lifetime and don't need to be destroyed manually.
+			<emphasis>alternatively, results can be stored in xavps</emphasis>
+			- columns are accessed by their names, rows by xavp index. Xavp's
+			are available during the transactions lifetime and don't need to
+			be destroyed manually.
 		</para>
 		</listitem>
 
@@ -204,8 +205,7 @@ modparam("sqlops", "sqlres", "ra")
 		</listitem>
 		</itemizedlist>
 		<para>
-			This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
-			ONREPLY_ROUTE, BRANCH_ROUTE.
+			This function can be used from ANY_ROUTE.
 		</para>
 		<example>
 		<title><function>sql_query()</function> usage</title>
@@ -220,6 +220,7 @@ sql_result_free("ra");
 </programlisting>
 		</example>
 	</section>
+	<section>
 		<title>
 		<function moreinfo="none">sql_xquery(connection, query, result)</function>
 		</title>
@@ -247,8 +248,7 @@ sql_result_free("ra");
 		</listitem>
 		</itemizedlist>
 		<para>
-			This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
-			ONREPLY_ROUTE, BRANCH_ROUTE.
+			This function can be used from ANY_ROUTE.
 		</para>
 		<example>
 		<title><function>sql_xquery()</function> usage</title>
@@ -270,8 +270,7 @@ sql_xquery("ca", "select * from domain", "ra");
 			Free data in SQL 'result'.
 		</para>
 		<para>
-			This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
-			ONREPLY_ROUTE, BRANCH_ROUTE.
+			This function can be used from ANY_ROUTE.
 		</para>
 		<example>
 		<title><function>sql_result_free()</function> usage</title>




More information about the sr-dev mailing list