4 ; Each context is a separately defined function. By convention, all
5 ; functions are entirely uppercase, so the defined contexts should also
6 ; be all-uppercase, but there is nothing that enforces this. All functions
7 ; are case-sensitive, however.
9 ; For substitution, you have ${ARG1}, ${ARG2} ... ${ARGn}
10 ; for the arguments to each SQL statement.
12 ; In addition, for write statements, you have ${VAL1}, ${VAL2} ... ${VALn}
13 ; parsed, just like arguments, for the values. In addition, if you want the
14 ; whole value, never mind the parsing, you can get that with ${VALUE}.
17 ; If you have data which may potentially contain single ticks, you may wish
18 ; to use the dialplan function SQL_ESC() to escape the data prior to its
19 ; inclusion in the SQL statement.
22 ; The following variables are available in this configuration file:
24 ; readhandle A comma-separated list of DSNs (from res_odbc.conf) to use when
25 ; executing the readsql statement. Each DSN is tried, in
26 ; succession, until the statement succeeds. You may specify up to
27 ; 5 DSNs per function class. If not specified, it will default to
28 ; the value of writehandle or dsn, if specified.
29 ; writehandle A comma-separated list of DSNs (from res_odbc.conf) to use when
30 ; executing the writesql statement. The same rules apply as to
31 ; readhandle. "dsn" is a synonym for "writehandle".
32 ; readsql The statement to execute when reading from the function class.
33 ; writesql The statement to execute when writing to the function class.
34 ; prefix Normally, all function classes are prefixed with "ODBC" to keep
35 ; them uniquely named. You may choose to change this prefix, which
36 ; may be useful to segregate a collection of certain function
37 ; classes from others.
38 ; escapecommas This option may be used to turn off the default behavior of
39 ; escaping commas which occur within a field. If commas are
40 ; escaped (the default behavior), then fields containing commas
41 ; will be treated as a single value when assigning to ARRAY() or
42 ; HASH(). If commas are not escaped, then values will be separated
43 ; at the comma within fields. Please note that turning this option
44 ; off is incompatible with the functionality of HASH().
47 ; ODBC_SQL - Allow an SQL statement to be built entirely in the dialplan
52 ; ODBC_ANTIGF - A blacklist.
54 dsn=mysql1,mysql2 ; Use mysql1 as the primary handle, but fall back to mysql2
55 ; if mysql1 is down. Supports up to 5 comma-separated
56 ; DSNs. "dsn" may also be specified as "readhandle" and
57 ; "writehandle", if it is important to separate reads and
58 ; writes to different databases.
59 readsql=SELECT COUNT(*) FROM exgirlfriends WHERE callerid='${SQL_ESC(${ARG1})}'
61 ; ODBC_PRESENCE - Retrieve and update presence
64 readsql=SELECT location FROM presence WHERE id='${SQL_ESC(${ARG1})}'
65 writesql=UPDATE presence SET location='${SQL_ESC(${VAL1})}' WHERE id='${SQL_ESC(${ARG1})}'
66 ;prefix=OFFICE ; Changes this function from ODBC_PRESENCE to OFFICE_PRESENCE
67 ;escapecommas=no ; Normally, commas within a field are escaped such that each
68 ; field may be separated into individual variables with ARRAY.
69 ; This option turns that behavior off [default=yes].
70 ;mode=multirow ; Enable multirow fetching. Instead of returning results directly,
71 ; mode=multirow queries will return a result-id, which can be passed
72 ; multiple times to ODBC_FETCH, and that function will return each
73 ; row, in order. You can add to this the following parameter:
74 ;rowlimit=5 ; rowlimit will limit the number of rows retrieved and stored from
75 ; the database. If not specified, all rows, up to available memory,
76 ; will be retrieved and stored.