Asterisk + realtime + query string

I want to find where is located funtion whitch makes the final SQL query string into database.

I have made some changes into pbx_realtime.c and inserted the “insert query” ( query in query ) . It`s all will work after i find where control the adding the symbol “” before any kind of special symbols ( such as & , ’ )

I have upgrated query for such

select * from extensions_conf where exten=’_’||(select ext from tarif)||’.’ and priority=1 and context=default

this is how i want to see query string . But asterisk made changes to my string by adding .

and new request – fails.

select * from extensions_conf where exten=’’_’||(select ext from tarif)||’.’’ and priority=‘1’ and context=‘default’

Help me please find where asterisk forms query string.