[asterisk-dev] Asterisk 1.6 Realtime Database must use ', ' not '|' (was: Re: asterisk-dev Digest, Vol 46, Issue 47)

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri May 23 13:29:37 CDT 2008


On Friday 23 May 2008 13:07:19 Atis Lezdins wrote:
> Following this thread, but don't want to participate flame-war.. It's
> not comfortable for me to change (as i want ability to roll-back from
> 1.6 immediately), but here's a convert tool (supposing you don't
> really have TAB in your realtime config):
>
> UPDATE extensions_table SET appdata=REPLACE(appdata,'\|',CHAR(9));
> UPDATE extensions_table SET appdata=REPLACE(appdata,',','\,');
> UPDATE extensions_table SET appdata=REPLACE(appdata,'|',',');
> UPDATE extensions_table SET appdata=REPLACE(appdata,CHAR(9),'|');

While I've decided not to participate any more in this flame war, there's a
technical issue here to clear up.  Tab is not the delimiter being used in
realtime.  The only time that tab entered the discussion was in import
formats.  Here's an example of several import formats:

foo,bar,baz
"foo","bar","baz"
foo	bar	baz

The second and third examples are the only two that would allow commas
to be placed in a database field.  In the second case, the commas are
escaped by placing them within a quoted field value, and in the third case,
commas aren't a field delimiter (for the import file) so there's no issue with
using commas within the field itself.  Commas are obviously very difficult to
do in the first case, as they are themselves the field delimiter.

Once the data is in the database, tabs are no longer the issue.

-- 
Tilghman



More information about the asterisk-dev mailing list