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 options 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 ; insertsql The statement to execute when writing to the function class
35 ; succeeds, but initially indicates that 0 rows were affected.
36 ; prefix Normally, all function classes are prefixed with "ODBC" to keep
37 ; them uniquely named. You may choose to change this prefix, which
38 ; may be useful to segregate a collection of certain function
39 ; classes from others.
40 ; escapecommas This option may be used to turn off the default behavior of
41 ; escaping commas which occur within a field. If commas are
42 ; escaped (the default behavior), then fields containing commas
43 ; will be treated as a single value when assigning to ARRAY() or
44 ; HASH(). If commas are not escaped, then values will be separated
45 ; at the comma within fields. Please note that turning this option
46 ; off is incompatible with the functionality of HASH().
47 ; synopsis Appears in the synopsis field for the command
48 ; 'core show function <function name>'
49 ; mode This option may be set to 'multirow' to allow the function
50 ; specified to return more than a single row. However, this
51 ; changes the way that func_odbc normally works. Instead of the
52 ; invocation of the function returning a row, it returns an opaque
53 ; ID, which may be passed to ODBC_FETCH() to return each row in
54 ; turn. ODBC_FETCH_STATUS returns SUCCESS or FAILURE, to indicate
55 ; whether any results were stored, and you should call ODBC_Finish
56 ; on the ID to clean up any remaining results when you are done
57 ; with the query. Also, the variable ODBCROWS is set initially,
58 ; which may be used in an iterative fashion to return each row in
60 ; Please note that multirow queries are isolated to the channel,
61 ; and rows may not be fetched outside of the channel where the
62 ; query was initially performed. Additionally, as the results are
63 ; associated with a channel, mode=multirow is incompatible with
65 ; rowlimit Rowlimit limits the total number of rows which can be stored for
66 ; that query. For mode=multirow, otherwise, func_odbc will
67 ; attempt to store all rows in the resultset, up to the maximum
68 ; amount of memory. In normal mode, rowlimit can be set to allow
69 ; additional rows to be fetched, rather than just the first one.
70 ; These additional rows can be returned by using the name of the
71 ; function which was called to retrieve the first row as an
72 ; argument to ODBC_FETCH().
75 ; ODBC_SQL - Allow an SQL statement to be built entirely in the dialplan
80 ; ODBC_ANTIGF - A blacklist.
82 dsn=mysql1,mysql2 ; Use mysql1 as the primary handle, but fall back to mysql2
83 ; if mysql1 is down. Supports up to 5 comma-separated
84 ; DSNs. "dsn" may also be specified as "readhandle" and
85 ; "writehandle", if it is important to separate reads and
86 ; writes to different databases.
87 readsql=SELECT COUNT(*) FROM exgirlfriends WHERE callerid='${SQL_ESC(${ARG1})}'
89 synopsis=Check if a specified callerid is contained in the ex-gf database
91 ; ODBC_PRESENCE - Retrieve and update presence
94 readsql=SELECT location FROM presence WHERE id='${SQL_ESC(${ARG1})}'
95 writesql=UPDATE presence SET location='${SQL_ESC(${VAL1})}' WHERE id='${SQL_ESC(${ARG1})}'