[asterisk-users] Stuck on MySQL UPDATE

Benchev bbench at mail.bg
Mon Apr 16 22:04:53 MST 2007


> What I'm retrying to do is update mysql field with the
> new message ID
> that was just recorded.  Ideally, I'd like to specify
> the field to update using a variable ${BINID} and use
> ${NEWPHRASENAME}
> for the value - I'm not sure asterisk will allow
> using a variable for the field name and if not, I'll
> attempt to create
> an exten for each bin to update.
>
> Here the method I'd like to use:
> exten => sav,n,MYSQL(Connect connid localhost root
> password dax)
> exten => sav,n,MYSQL(QUERY resultid ${connid}UPDATE\
> dnislookup\ SET\
> ${BINID}\ =\ ${NEWPHRASENAME}\ WHERE\ dnis\ =\
> ${IVR-Exten})
>
> But I've tried this too:
> exten => sav,n,MYSQL(Connect connid localhost root
> password dax)
>  exten => sav,n,MYSQL(QUERY resultid ${connid}UPDATE\
> dnislookup\ SET\
> bin2\ =\ ${NEWPHRASENAME}\ WHERE\ dnis\ =\ ${IVR-Exten})
>
> However, neither one of these saves to new value into the
> bin2 (or
> ${BINID}) field.

Just to reassure you that the method works, below is what
works with me:
exten => _1NXXNXXXXXX,n(continue),MYSQL(Query resultid
${connid} update\ cards\ set\ used\ =used+${FREEZEFUNDS}\
where\ number\ ="${CDR(accountcode)}")

First there is no "fetch" i.e.
 exten => _1NXXNXXXXXX,n,MYSQL(Fetch fetchid ${resultid}
var1 var2 var3 var4)

Second there is no space "${connid}UPDATE\" should be
"${connid} UPDATE\".

And check how bin2 "remembers" the variables you assign to
it: probably
should use _bin2 or __bin2 for instance:
exten =>
_1NXXNXXXXXX,n,Set(__bin2=${MATH(${VAR3}-${VAR4},int)})

Hope that helps,
Benchev


-----------------------------

Най-добрият начин да научаваш новините,
които те интересуват.Бързо лесно и безплатно!
новини с филтър
http://www.radar.bg/



More information about the asterisk-users mailing list