Index: class.doc ================================================================== --- class.doc +++ class.doc @@ -2261,10 +2261,28 @@ Display a unsigned hexadecimal number in uppercase. %% Display a percentage sign; does not consume an argument. +%( + Begin a conditional block, of the form "%(true-part%|false-part%)" or + "%(true-part%)". Consumes one argument; if zero then the false-part is + used (or nothing, if there is no false-part), or if nonzero then the + true-part is used. Conditional blocks cannot be nested. + +%| + Else part of a conditional block. See above about conditional blocks. + +%) + End of a conditional block. See above about conditional blocks. + +%< + Unconsume one argument. (Does not produce any output.) + +%> + Skip one argument. (Does not produce any output.) + === Messages === This section describes when the various standard messages are sent to objects, and what return values are expected. (Do not confuse CREATE with Index: exec.c ================================================================== --- exec.c +++ exec.c @@ -2076,10 +2076,33 @@ if(v.t==TY_NUMBER) sqlite3_str_appendf(s,"%X",(unsigned int)v.u); break; case '%': sqlite3_str_appendchar(s,1,'%'); break; + case '(': + if(argi==argc) break; + v=vstack[vstackptr+argi++]; + if(v.t || v.u) break; + // otherwise fall through + case '|': + while(u=strchr(t,'%')) { + t=u+(u[1]?2:1); + if(u[1]==')' || u[1]=='|') break; + } + break; + case ')': + // no effect + break; + case '<': + if(argi>0) --argi; + break; + case '>': + if(argi