diff options
Diffstat (limited to 'doc/vmod-dbrw.texi')
-rw-r--r-- | doc/vmod-dbrw.texi | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/doc/vmod-dbrw.texi b/doc/vmod-dbrw.texi index 40fc84d..31b15d1 100644 --- a/doc/vmod-dbrw.texi +++ b/doc/vmod-dbrw.texi | |||
@@ -496,19 +496,29 @@ ORDER BY weight | |||
496 | @end example | 496 | @end example |
497 | 497 | ||
498 | @noindent | 498 | @noindent |
499 | Furthermore, the @code{url} column can contain a SQL wildcard pattern, | 499 | Furthermore, the @code{url} column can contain a path prefix, |
500 | in which case the query will look like: | 500 | which can be matched using the @code{IN} conditional: |
501 | 501 | ||
502 | @example | 502 | @example |
503 | @group | 503 | @group |
504 | SELECT dest,pattern,value,flags | 504 | SELECT dest,pattern,value,flags |
505 | FROM rewrite | 505 | FROM rewrite |
506 | WHERE host='$host' | 506 | WHERE host='$host' |
507 | AND '$url' like $url | 507 | AND url IN ($(urlprefixes $url)) |
508 | ORDER BY weight | 508 | ORDER BY weight |
509 | @end group | 509 | @end group |
510 | @end example | 510 | @end example |
511 | 511 | ||
512 | Notice the use of the @samp{$(urlprefixes $url)}. This invokes the built-in | ||
513 | @dfn{function} @code{urlprefixes}, which expands to comma-separated | ||
514 | list of properly quoted pathname prefixes, constructed from its | ||
515 | argument. For example, if @samp{$url} is @samp{/local/user/local?a=1}, | ||
516 | then the expansion of @samp{$(urlprefixes $url)} is: | ||
517 | |||
518 | @example | ||
519 | '/local/user/local','/local/user','/local' | ||
520 | @end example | ||
521 | |||
512 | @node Rewrite | 522 | @node Rewrite |
513 | @chapter The @code{rewrite} Function | 523 | @chapter The @code{rewrite} Function |
514 | 524 | ||