[Users] Avpops'exported function

Norman Brandinger norm at goes.com
Wed Apr 11 17:08:32 CEST 2007


Chungyu,

Perhaps the following will work for you:

avp_db_query("DELETE FROM usr_preferences WHERE (username = 'bob') AND
(number = '1')");

Using the above as an example, you should be able to INSERT into a table
with avp_db_query();

Regards,
Norm

chungyu wrote:
> Dear all:
> Avpops module' exported function avp_db_delete() can do delete one record?
> example:
> I use "test" as default table that has two fields.
> username | number
> -------------------
> bob | 1
> alice | 1
> bob | 2
> my configuration:
> modparam("avpops", "avp_url", "mysql://ser:heslo@localhost/ser")
> modparam("avpops", "avp_table", "test")
> modparam("avpops", "username_column", "username")
> modparam("avpops", "avp_aliases", "num=i:55")
> modparam("avpops", "db_scheme",
> "number_scheme:table=test;value_col=number;value_type=string")
> if (method=="INVITE"){
> avp_db_load("$from/username", "$num/$number_scheme"); //load from
> table "test" ,number column as string value into AVP name '$num'
> avp_db_delete("$from/username", "s:test") //delete all bob' record
> };
> if bob calling then bob'record has deleted
> username | number
> --------------------
> alice | 1
> But i want delete a record.
> ex: delete number value is 1 for bob
> username | number
> --------------------
> alice | 1
> ---------------------
> bob | 2
> avp_db_delete() can do delete one record?
> Another question is avp_db_store() can do insert new data in table?
> ex: insert into test (username,number) values ("mary","3")
> username | number
> -------------------
> alice | 1
> -------------------
> bob | 2
> -------------------
> mary | 3
> avp_db_store() can do it?
> sorry,I still can't understand what it mean about avp_db_store() and
> avp_db_delete().
> Can tell me?
> Thanks a lot in advance
> Chungyu
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>   





More information about the Users mailing list