[asterisk-users] MSet()
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Sat Dec 13 12:56:01 CST 2008
On Saturday 13 December 2008 02:32:01 Philipp Kempgen wrote:
> Anthony Messina schrieb:
> > On Friday 12 December 2008 15:41:54 Mark Michelson wrote:
> >> would result in a variable called FOO being set to the value
> >> "hello,BAR=world". The MSet application was added to facilitate being
> >> able to set multiple variables in a single application call. If using
> >> MSet, the above would instead result in a variable called FOO being set
> >> to the value "hello" and a variable called BAR being set to "world".
> >
> > what about Set(ARRAY(var1,var2)=value1,value2) ?
> >
> > is the MSet() app a better/quicker way to do this?
>
> Just a word of warning:
> 1.4: Set(ARRAY(var1|var2)=val1\,val2)
> or: Set(ARRAY(var1,var2)=val1\,val2)
> 1.6: Set(ARRAY(var1,var2)=val1,val2) ?
>
> At least in 1.4 the "," has to be escaped because otherwise you'd
> have a second argument to Set().
>
> I still think that a plain
> Set(var1=val1);
> Set(var2=val2);
> is the most portable way which is least likely to cause any
> problems.
>
> portable => better
> Maybe not quicker. (Didn't do any benchmarks.)
> But certainly easier to read/write/maintain.
While ARRAY() certainly would work this way for setting multiple variables at
once, the intended usage is for setting multiple variables from the result of
a command which generates multiple answers (read: multiple points of data).
The usual case for this is func_odbc.
--
Tilghman
More information about the asterisk-users
mailing list