[Home]

Summary:ASTERISK-07025: [patch] DB_DELETE dialplan function
Reporter:Terry Wilson (twilson)Labels:
Date Opened:2006-05-23 14:38:59Date Closed:2006-05-25 10:41:16
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Functions/func_db
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) db_delete3.txt
Description:This patch implements a DB_DELETE dialplan function.  DB_DELETE(<family>/<key>) returns the value of 'family/key' in the astdb (and saves it to DB_RESULT as well) and removes it from astdb.

****** ADDITIONAL INFORMATION ******

This patch is the result of a question from a student at the Edvina Asterisk training as to why there was no delete functionality for DB dialplan functions.
Comments:By: Serge Vecher (serge-v) 2006-05-23 14:43:35

twilson: can you please get a disclaimer on file? Thanks...

By: Jason Parker (jparker) 2006-05-23 14:45:05

Two issues.

1) a very minor formatting bit.  You have }\nelse {, where it should be } else { (like I said...minor).

2) You use DB_DELETE as the function name, but the warnings/errors show DB_DEL..you should switch those to DB_DELETE also.

By: Terry Wilson (twilson) 2006-05-23 14:49:11

ah thanks, good eyes.  fixed in the new patch and disclaimer on file.

By: Jason Parker (jparker) 2006-05-23 14:57:46

DB requires an argument, DB(<family>/<key>)

Sorry, missed that the first time..

By: Terry Wilson (twilson) 2006-05-23 15:06:09

That's ok.  I should have caught them in the first place.  Found one other bug: DB_RESULT should be set no matter what.

By: Terry Wilson (twilson) 2006-05-23 15:29:11

... and version 3 uploaded.

By: Russell Bryant (russell) 2006-05-23 16:56:27

We do have the DBdel application, which Mark decided to keep when I originally created the DB dialplan functions.  If we decide to go with this implementation, then the DBdel application should be marked deprecated.

However, I think my vote is to just keep what we have.

By: Terry Wilson (twilson) 2006-05-23 17:05:17

my vote would be to have a single way to do everything.  mixing apps/functions for similar ability seems confusing to me (and to the students here)

By: Jason Parker (jparker) 2006-05-23 18:59:12

I'm gonna have to agree with twilson here.  Maybe we can get an opinion from Mark?

By: Leif Madsen (lmadsen) 2006-05-23 22:39:34

I'd also agree -- I think moving any functionality that makes sense from Apps to Functions is the ideal way to go.

I'd also vote for DB_DEL instead of DB_DELETE... need all the character real estate as possible :)

By: Terry Wilson (twilson) 2006-05-24 16:31:00

Especially since, now, we would have to do a DB(family/key) function and then do a DbDel(family/key) application to get the value of a key and delete it.  This function does what many linked list and hash table implementations do when you do a delete.  A single function for the common case of getting & deleting a key.

By: Russell Bryant (russell) 2006-05-25 10:41:15

added to the trunk in revision 30241, thanks guys!