Browse Source

avpops: add a note to the docs that avp_db_query is deprecated and sqlops is better

Henning Westerholt 12 years ago
parent
commit
0978c77d69
2 changed files with 36 additions and 24 deletions
  1. 29 24
      modules/avpops/README
  2. 7 0
      modules/avpops/doc/avpops_admin.xml

+ 29 - 24
modules/avpops/README

@@ -10,7 +10,7 @@ Ramona-Elena Modroiu
 
 
    <[email protected]>
    <[email protected]>
 
 
-   Copyright © 2004, 2005 Voice Sistem SRL
+   Copyright © 2004, 2005 Voice Sistem SRL
      __________________________________________________________________
      __________________________________________________________________
 
 
    Table of Contents
    Table of Contents
@@ -133,6 +133,9 @@ Chapter 1. Admin Guide
    AVPs and SIP messages and a function for testing/checking the value of
    AVPs and SIP messages and a function for testing/checking the value of
    an AVP.
    an AVP.
 
 
+   If you just need a way to execute SQL statements in a Kamailio
+   configuration script, please consider use the sqlops module instead.
+
    AVPs are persistent per SIP transaction, being available in "route",
    AVPs are persistent per SIP transaction, being available in "route",
    "branch_route" and "failure_route". A tutorial providing more
    "branch_route" and "failure_route". A tutorial providing more
    information (detailed explanations and commented examples) can be found
    information (detailed explanations and commented examples) can be found
@@ -239,7 +242,7 @@ modparam("avpops","use_domain",1)
 
 
    Name of column containing the uuid (unique user id).
    Name of column containing the uuid (unique user id).
 
 
-   Default value is "uuid".
+   Default value is “uuid�.
 
 
    Example 1.5. Set uuid_column parameter
    Example 1.5. Set uuid_column parameter
 ...
 ...
@@ -250,7 +253,7 @@ modparam("avpops","uuid_column","uuid")
 
 
    Name of column containing the username.
    Name of column containing the username.
 
 
-   Default value is "username".
+   Default value is “username�.
 
 
    Example 1.6. Set username_column parameter
    Example 1.6. Set username_column parameter
 ...
 ...
@@ -261,7 +264,7 @@ modparam("avpops","username_column","username")
 
 
    Name of column containing the domain name.
    Name of column containing the domain name.
 
 
-   Default value is "domain".
+   Default value is “domain�.
 
 
    Example 1.7. Set domain_column parameter
    Example 1.7. Set domain_column parameter
 ...
 ...
@@ -272,7 +275,7 @@ modparam("avpops","domain_column","domain")
 
 
    Name of column containing the attribute name (AVP name).
    Name of column containing the attribute name (AVP name).
 
 
-   Default value is "attribute".
+   Default value is “attribute�.
 
 
    Example 1.8. Set attribute_column parameter
    Example 1.8. Set attribute_column parameter
 ...
 ...
@@ -283,7 +286,7 @@ modparam("avpops","attribute_column","attribute")
 
 
    Name of column containing the AVP value.
    Name of column containing the AVP value.
 
 
-   Default value is "value".
+   Default value is “value�.
 
 
    Example 1.9. Set value_column parameter
    Example 1.9. Set value_column parameter
 ...
 ...
@@ -294,7 +297,7 @@ modparam("avpops","value_column","value")
 
 
    Name of integer column containing the AVP type.
    Name of integer column containing the AVP type.
 
 
-   Default value is "type".
+   Default value is “type�.
 
 
    Possible column values are
    Possible column values are
      * 0 - AVP with string name and string value
      * 0 - AVP with string name and string value
@@ -322,7 +325,7 @@ modparam("avpops","type_column","type")
           + 'value_type='('integer'|'string')
           + 'value_type='('integer'|'string')
           + 'table='string
           + 'table='string
 
 
-   Default value is "NULL".
+   Default value is “NULL�.
 
 
    Example 1.11. Set db_scheme parameter
    Example 1.11. Set db_scheme parameter
 ...
 ...
@@ -346,7 +349,7 @@ modparam("avpops","db_scheme",
    5.12. is_avp_set(name)
    5.12. is_avp_set(name)
    5.13. avp_print()
    5.13. avp_print()
 
 
-5.1. avp_db_load(source,name)
+5.1.  avp_db_load(source,name)
 
 
    Loads from DB into memory the AVPs corresponding to the given source.
    Loads from DB into memory the AVPs corresponding to the given source.
    If given, it sets the script flags for loaded AVPs. It returns true if
    If given, it sets the script flags for loaded AVPs. It returns true if
@@ -384,7 +387,7 @@ avp_db_load("$uuid","$avp(s:404fwd)/fwd_table");
 avp_db_load("$ru","$avp(i1:123)/$some_scheme");
 avp_db_load("$ru","$avp(i1:123)/$some_scheme");
 ...
 ...
 
 
-5.2. avp_db_store(source,name)
+5.2.  avp_db_store(source,name)
 
 
    Stores to DB the AVPs corresponding to the given source.
    Stores to DB the AVPs corresponding to the given source.
 
 
@@ -400,7 +403,7 @@ avp_db_store("$tu","$avp(i:678)");
 avp_db_store("$ru/username","$avp(email)");
 avp_db_store("$ru/username","$avp(email)");
 ...
 ...
 
 
-5.3. avp_db_delete(source,name)
+5.3.  avp_db_delete(source,name)
 
 
    Deletes from DB the AVPs corresponding to the given source.
    Deletes from DB the AVPs corresponding to the given source.
 
 
@@ -417,9 +420,11 @@ avp_db_delete("$ru/username","$avp(email)");
 avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table");
 avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table");
 ...
 ...
 
 
-5.4. avp_db_query(query[,dest])
+5.4.  avp_db_query(query[,dest])
 
 
-   Make a database query and store the result in AVPs.
+   Make a database query and store the result in AVPs. This command is
+   deprecated, please use the more flexible and advanced sqlops module
+   instead.
 
 
    The meaning and usage of the parameters:
    The meaning and usage of the parameters:
      * query - must be a valid SQL query. The parameter can contain
      * query - must be a valid SQL query. The parameter can contain
@@ -431,8 +436,8 @@ avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table");
        used in the query makes you vulnerable to SQL injection, e.g. make
        used in the query makes you vulnerable to SQL injection, e.g. make
        it possible for an outside attacker to alter your database content.
        it possible for an outside attacker to alter your database content.
      * dest - a list with AVP names where to store the result. The format
      * dest - a list with AVP names where to store the result. The format
-       is "$avp(name1);$avp(name2);...". If this parameter is ommited, the
-       result is stored in "$avp(i:1);$avp(i:2);...". If the result gives
+       is “$avp(name1);$avp(name2);...�. If this parameter is ommited, the
+       result is stored in “$avp(i:1);$avp(i:2);...�. If the result gives
        many rows, then multiple AVPs with corresponding name will be
        many rows, then multiple AVPs with corresponding name will be
        added. The value type of the AVP (string or integer) will be
        added. The value type of the AVP (string or integer) will be
        derived from the type of the columns. Please note that only this
        derived from the type of the columns. Please note that only this
@@ -455,7 +460,7 @@ avp_db_query("select password, ha1 from subscriber where username='$tu'",
 avp_db_query("delete from subscriber");
 avp_db_query("delete from subscriber");
 ...
 ...
 
 
-5.5. avp_delete(name)
+5.5.  avp_delete(name)
 
 
    Deletes from memory the AVPs with name or, if empty, all AVPs.
    Deletes from memory the AVPs with name or, if empty, all AVPs.
 
 
@@ -477,7 +482,7 @@ avp_delete("i");
 avp_delete("a3");
 avp_delete("a3");
 ...
 ...
 
 
-5.6. avp_pushto(destination,name)
+5.6.  avp_pushto(destination,name)
 
 
    Pushes the value of AVP(s) into the SIP message.
    Pushes the value of AVP(s) into the SIP message.
 
 
@@ -507,7 +512,7 @@ avp_pushto("$du","$avp(i:679)");
 avp_pushto("$br","$avp(i:680)");
 avp_pushto("$br","$avp(i:680)");
 ...
 ...
 
 
-5.7. avp_check(name,op_value)
+5.7.  avp_check(name,op_value)
 
 
    Checks the value of the AVP(s) against an operator and value.
    Checks the value of the AVP(s) against an operator and value.
 
 
@@ -562,7 +567,7 @@ $var(id)=2;
 avp_check("$xavp(op=>foo[*])","fm/$xavp(op=>fm[$var(id)])/g");
 avp_check("$xavp(op=>foo[*])","fm/$xavp(op=>fm[$var(id)])/g");
 ...
 ...
 
 
-5.8. avp_copy(old_name,new_name)
+5.8.  avp_copy(old_name,new_name)
 
 
    Copy / move an avp under a new name.
    Copy / move an avp under a new name.
 
 
@@ -583,7 +588,7 @@ avp_copy("$avp(i:678)", "$avp(s:345)/g");
 avp_copy("$avp(old)","$avp(new)/gd");
 avp_copy("$avp(old)","$avp(new)/gd");
 ...
 ...
 
 
-5.9. avp_printf(dest, format)
+5.9.  avp_printf(dest, format)
 
 
    NOTE: since Kamailio 1.3.0 the function has been moved to core and it
    NOTE: since Kamailio 1.3.0 the function has been moved to core and it
    is an alias to pv_printf().
    is an alias to pv_printf().
@@ -607,7 +612,7 @@ avp_copy("$avp(old)","$avp(new)/gd");
 avp_printf("$avp(i:20)", "This is a $rm request with call-id $hdr(call-id)");
 avp_printf("$avp(i:20)", "This is a $rm request with call-id $hdr(call-id)");
 ...
 ...
 
 
-5.10. avp_subst(avps, subst)
+5.10.  avp_subst(avps, subst)
 
 
    Perl/sed-like subst applied to AVPs having string value.
    Perl/sed-like subst applied to AVPs having string value.
 
 
@@ -649,7 +654,7 @@ avp_subst("$avp(i:678)/$avp(i:679)/g", "/(.*)@(.*)/\1@$rd/");
    after the first src_avp is processed, it will be added in avp list and
    after the first src_avp is processed, it will be added in avp list and
    next processing will use it.
    next processing will use it.
 
 
-5.11. avp_op(name,op_value)
+5.11.  avp_op(name,op_value)
 
 
    Different integer operations with avps.
    Different integer operations with avps.
 
 
@@ -681,7 +686,7 @@ avp_op("$avp(i:678)", "add/i:345/g");
 avp_op("$avp(number)","sub/$avp(number2)/d");
 avp_op("$avp(number)","sub/$avp(number2)/d");
 ...
 ...
 
 
-5.12. is_avp_set(name)
+5.12.  is_avp_set(name)
 
 
    Check if any AVP with name is set.
    Check if any AVP with name is set.
 
 
@@ -700,7 +705,7 @@ if(is_avp_set("$avp(i:678)"))
     log("AVP with integer id 678 exists\n");
     log("AVP with integer id 678 exists\n");
 ...
 ...
 
 
-5.13. avp_print()
+5.13.  avp_print()
 
 
    Prints the list with all the AVPs from memory. This is only a
    Prints the list with all the AVPs from memory. This is only a
    helper/debug function.
    helper/debug function.

+ 7 - 0
modules/avpops/doc/avpops_admin.xml

@@ -29,6 +29,11 @@
 		testing/checking the value of an AVP.
 		testing/checking the value of an AVP.
 		</para>
 		</para>
 		<para>
 		<para>
+		If you just need a way to execute SQL statements in a
+		&kamailio; configuration script, please consider use the
+		<emphasis>sqlops</emphasis> module instead.
+		</para>
+		<para>
 		AVPs are persistent per SIP transaction, being available in "route", 
 		AVPs are persistent per SIP transaction, being available in "route", 
 		"branch_route" and "failure_route". A tutorial providing more information (detailed
 		"branch_route" and "failure_route". A tutorial providing more information (detailed
 		explanations and commented examples) can be found on the SIP-router web site.
 		explanations and commented examples) can be found on the SIP-router web site.
@@ -500,6 +505,8 @@ avp_db_delete("$uuid","$avp(s:404fwd)/fwd_table");
 			</title>
 			</title>
 			<para>
 			<para>
 			Make a database query and store the result in AVPs.
 			Make a database query and store the result in AVPs.
+			This command is deprecated, please use the more
+			flexible and advanced <emphasis>sqlops</emphasis> module instead.
 			</para>
 			</para>
 			<para>
 			<para>
 			The meaning and usage of the parameters:
 			The meaning and usage of the parameters: