[asterisk-users] Func_ODBC question

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Tue Dec 9 12:40:41 CST 2008


On Tuesday 09 December 2008 11:45:59 Sebastian wrote:
> Hi I have
>
> On func_odbc
>
> [EXEC]
> readhandle=ressqlserver
> writehandle=ressqlserver
> readsql=${ARG1}
> writesql=${ARG1}
>
>
> I'm trying an update on dialplan:
>
> exten=> 141,3,Set(dummy=${ODBC_EXEC(UPDATE Tabla set campo = ${EXTEN})})
>
> On Cli:
>
> WARNING[3579]: func_odbc.c:353 acf_odbc_read: Error -1 in FETCH [UPDATE
> Tabla set campo = 4356]
>
>
> Any  idea why is this??

Yes, because you did an update in a query where it's expecting to retrieve
rows.

> The query works fine, I just wanto to know if the warning can cause any
> problem to me.

No, it won't, but if you insist upon this syntax, you'd be better off doing:

Set(ODBC_EXEC(UPDATE Tabla set campo = ${EXTEN})=whatever)

Of course, a much better syntax would be:

[TABLA]
readhandle=ressqlserver
writehandle=ressqlserver
writesql=UPDATE Tabla SET ${ARG1}=${VALUE}

exten => 141,3,Set(ODBC_TABLA(campo)=${EXTEN})

-- 
Tilghman



More information about the asterisk-users mailing list