13.02 - Converters


From file to query.shell

Category-Name: query

What: This 'query' converter will convert a resource of category 'file' to a resource of category 'query.shell'.
CONVERT {resourceToConvert<Res:file>} TO query.shell (query) AS {converted<Res:query.shell>} [ USING {config<Res:file>} ]

Input: 
  • resourceToConvert<Res:file>: The name of the file which includes one or several shell command lines. Commands can be on one line separated by the character ';' or on several lines (in this case the ';' is optional) and comments beginning with '#' are authorized.
  • config<Res:file> (Optional): The name of the resource which references a configuration file which contains only one key / value : 
    • 'timeout:<n>' with <n> an integer that represents a time in milliseconds. It's the time to wait before the command execution passes in timeout. It can be define via an inline instruction: $(timeout : ...).
    • 'streamlength :<n'>' with <n'> an integer that represents the stream length (number of characters). An option "full" allows to have the entire stream. It can be define via an inline instruction : $(streamlength : ...). (streamlength property is available from 1.8.0 version).
Output: 
  • converted<Res:query.shell>: The name of the converted resource (Resource of category query.shell).

Examples:

LOAD shell/shell_command_03.txt AS command.file
CONVERT command.file TO query.shell USING $(timeout:15000, streamlength:600) AS commandLine

LOAD shell/shell_command_03.txt AS command.file
CONVERT command.file TO query.shell USING $(streamlength:full) AS commandLine