Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cookbooks:transformations:devel [2011/03/11 17:06]
193.169.138.83
cookbooks:transformations:devel [2011/11/09 12:34] (current)
193.146.38.124 old revision restored
Line 356: Line 356:
 <hi #c0c0c0>This transformation class is exported by **textops** module.</hi> <hi #c0c0c0>This transformation class is exported by **textops** module.</hi>
  
-Access parts of a ToBody-like structure. 
-  
  
 ==== {re.subst,expression} ==== ==== {re.subst,expression} ====
Line 385: 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 #c0c0c0>The transformations in this class are exported by the **sqlops** module.</hi>
 +
 +==== {sql.val} ====
 +
 +This transformation outputs valid SQL values for various PV values:
 +  * <null> values are output as NULL
 +  * integers are output as integers
 +  * everything else is output as quoted and escaped string
 +    
 +<code c>
 +    $var(null) = $null;
 +    $avp(null) = $null;
 +    $avp(str) = "String with \ illegal \\characters";
 +    $avp(nr) = 12345;
 +    $avp(strnr) = "12345";
 +    
 +    xlog("$$rm = $rm = $(rm{s.sql})");
 +    xlog("$$var(null) = $var(null) = $(var(null){s.sql})");
 +    xlog("$$avp(null) = $avp(null) = $(avp(null){s.sql})");
 +    xlog("$$avp(str) = $avp(str) = $(avp(str){s.sql})");
 +    xlog("$$avp(nr) = $avp(nr) = $(avp(nr){s.sql})");
 +    xlog("$$avp(strnr) = $avp(strnr) = $(avp(strnr){s.sql})");
 +
 +  Output:
 +    $rm = ACK = 'ACK'
 +    $var(null) = 0 = 0
 +    $avp(null) = <null> = NULL
 +    $avp(str) = String with \ illegal \characters = 'String with \\ illegal \\characters'
 +    $avp(nr) = 12345 = 12345
 +    $avp(strnr) = 12345 = '12345'
 +</code>
 +
 +==== {sql.val.int} ====
 +
 +Like sql.val, but output number 0 for null values.
 +
 +==== {sql.val.str} ====
 +
 +Like sql.val, but output string '' for null values.
  
 ===== Examples ===== ===== Examples =====

Navigation

Wiki

Other

QR Code
QR Code cookbooks:transformations:devel (generated for current page)