Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
cookbooks:transformations:devel [2010/04/30 21:19] 92.231.105.106 |
cookbooks:transformations:devel [2011/11/09 12:34] (current) 193.146.38.124 old revision restored |
||
---|---|---|---|
Line 66: | Line 66: | ||
< | < | ||
- | xlog("MD4 over From username: $(fU{s.md5})" | + | xlog("md5 over From username: $(fU{s.md5})" |
</ | </ | ||
+ | |||
==== {s.substr, | ==== {s.substr, | ||
Line 153: | Line 154: | ||
Return string after removing ending ' | Return string after removing ending ' | ||
+ | |||
+ | ==== {s.prefixes[, | ||
+ | |||
+ | Return series of comma separated prefixes of the pv. Parameter ' | ||
+ | |||
+ | Example: | ||
+ | <code c> | ||
+ | $var(x) = " | ||
+ | $(var(x){s.prefixes}) => 1, | ||
+ | $(var(x){s.prefixes, | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== {s.prefixes.quoted[, | ||
+ | |||
+ | Return series of comma separated quoted prefixes of the pv. Parameter ' | ||
+ | |||
+ | Example: | ||
+ | <code c> | ||
+ | $var(x) = " | ||
+ | $(var(x){s.prefixes.quoted} => ' | ||
+ | $(var(x){s.prefixes.quoted, | ||
+ | </ | ||
===== URI Transformations ===== | ===== URI Transformations ===== | ||
Line 332: | Line 356: | ||
<hi # | <hi # | ||
- | Access parts of a ToBody-like structure. | ||
- | |||
==== {re.subst, | ==== {re.subst, | ||
Line 361: | Line 383: | ||
* s - match within multi-lines strings | * s - match within multi-lines strings | ||
* g - replace all matches | * g - replace all matches | ||
+ | |||
+ | ===== SQL Transformations ===== | ||
+ | |||
+ | <hi # | ||
+ | |||
+ | ==== {sql.val} ==== | ||
+ | |||
+ | This transformation outputs valid SQL values for various PV values: | ||
+ | * < | ||
+ | * integers are output as integers | ||
+ | * everything else is output as quoted and escaped string | ||
+ | | ||
+ | <code c> | ||
+ | $var(null) = $null; | ||
+ | $avp(null) = $null; | ||
+ | $avp(str) = " | ||
+ | $avp(nr) = 12345; | ||
+ | $avp(strnr) = " | ||
+ | | ||
+ | xlog(" | ||
+ | xlog(" | ||
+ | xlog(" | ||
+ | xlog(" | ||
+ | xlog(" | ||
+ | xlog(" | ||
+ | |||
+ | Output: | ||
+ | $rm = ACK = ' | ||
+ | $var(null) = 0 = 0 | ||
+ | $avp(null) = < | ||
+ | $avp(str) = String with \ illegal \characters = ' | ||
+ | $avp(nr) = 12345 = 12345 | ||
+ | $avp(strnr) = 12345 = ' | ||
+ | </ | ||
+ | |||
+ | ==== {sql.val.int} ==== | ||
+ | |||
+ | Like sql.val, but output number 0 for null values. | ||
+ | |||
+ | ==== {sql.val.str} ==== | ||
+ | |||
+ | Like sql.val, but output string '' | ||
===== Examples ===== | ===== Examples ===== |