SQL Tree - Custom SQL functions

All functions return NULL, if any argument is NULL.

General functions

format_length(<length in seconds>)
Format the specified length as weeks, days, hours, minutes and seconds
format_length_hours(<length in seconds>) Format the specified length as hours, minutes and seconds
strpos('<string>', '<search>') Search <search> in <string> and return the 1-based position. Return 0, if <search> is not found.
padl('<string>', <length>[, '<filler>'])
Pads <string> to the length <length> with <filler> on the left side. <filler> is optional and defaults to ' '. If <filler> contains more than one character, <filler> will be added as many times as it fits without exceeding <length>.
padr('<string>', <length>[, '<filler>']) Pads <string> to the length <length> with <filler> on the right side. <filler> is optional and defaults to ' '. If <filler> contains more than one character, <filler> will be added as many times as it fits without exceeding <length>.
 
Virtual table functions

The virtual table functions are only valid when querying the virtual tables MediaLibrary and Playlist. Their first argument is always the fixed expression metadb_handle. Due to a limitation of SQLite these functions cannot be used in queries containing a group-by clause or the distinct attribute.

tf(metadb_handle,'<title format expression>') Evaluate <title format expression> and return the result