Summary:ASTERISK-05617: [post-1.2] Avoid SQL syntax in realtime core functions
Reporter:Manuel Guesdon (mguesdon)Labels:
Date Opened:2005-11-16 06:11:50.000-0600Date Closed:2006-02-03 02:23:50.000-0600
Versions:Frequency of
Description:I think using syntax like "exten LIKE", "\\_%" (in pbx_realtime.c) should be avoid as realtime driver may not be a sql one (for exemple ldap driver) or one should document all usages and think on how a driver can parse it before coding them.
Comments:By: Tilghman Lesher (tilghman) 2005-11-16 10:43:38.000-0600

When we have an LDAP realtime driver in consideration on this bugtracker, we'll give this more thought then.

By: Manuel Guesdon (mguesdon) 2005-11-16 11:12:02.000-0600

Please see http://bugs.digium.com/view.php?id=5768 :-)

By: Olle Johansson (oej) 2005-12-03 14:21:04.000-0600

Corydon76: Had any thoughts?


By: Tilghman Lesher (tilghman) 2005-12-03 21:11:26.000-0600

I'm open to suggestions on what to substitute in place of the SQL wildcard.

By: Manuel Guesdon (mguesdon) 2005-12-04 04:56:38.000-0600

I'd replace (name,value) arguments by (name,operator,value) arguments with operator being = or LIKE and I'd use * as wildcard and I won't escape characters (except our wildcard). This will be cleaner an make driver conversion easier.
Escaping and syntax converting should be done by drivers.

This avoid using workaround like in pbx_realtime.c:
ast_load_realtime_multientry(table, "exten LIKE", "\\_%", ...)

This case will become:
ast_load_realtime_multientry(table, "exten", "LIKE", "_*", ...)

By: Tilghman Lesher (tilghman) 2005-12-04 09:33:17.000-0600

If we go with that syntax, then we'll go one step further:  the operator should become a token (int), not a string.

By: Manuel Guesdon (mguesdon) 2005-12-04 09:36:52.000-0600

I agree.

By: Matt O'Gorman (mogorman) 2006-01-13 13:03:10.000-0600

is anyone up to this task or will it remain a feature request?

By: Olle Johansson (oej) 2006-02-03 02:23:49.000-0600

No responses. Will keep this in archive while waiting for patches.