#
#			ITSV GmbH
#	CCDB - Command and Control Database
#
#	FILE:			dquerymfile_searchquery.txt
#	DESCRIPTION:	DQUERY definition for DQUERY searchquery
#					this query implementes the API for searching a query
#
@querytitle				Eine Abfrage suchen
@querydescription		inkrementelle Suche nach einer Abfrage, indem im Volltexct der Abferage Information nach <searchstring> gesucht wird
@group					API
@attributenames			searchstring:string:{{searchstringoptions}}
@searchstringopions		{"labeltext":"Suchtext","typedesc":"Teil des Titels, der ID oder der Beschreibgung der gesuchten Abfrage"}
@querytype				dbselect
@sql
	select RWNAME as value, CONCAT(RWNAME,' - ',RWVALUE) as dtext,CONCAT('ID: ',RWNAME,' Titel: ',RWVALUE,', Beschreibung: ',RWDESC) as title 
	  from CCRW
	 where RWTYP='DQUERY' and RWPARENT='QUERIES' 
	    and (RWNAME like CONCAT('%',::searchstring::,'%')
		     or RWVALUE like CONCAT('%',::searchstring::,'%')
             or RWDESC like CONCAT('%',::searchstring::,'%'))
    UNION
	select SUBSTR(MFILEID,13) as value, CONCAT(MFILEID,' - ',MFILENAME) as dtext, CONCAT('ID: ',SUBSTR(MFILEID,13),' MFILE: ',MFILENAME,' Attribute: ',MFILEATTRIBS) as title
	  from CCMFILES
	 where MFILETYPE='dquerymfile' and
	    (MFILEID like CONCAT('%',::searchstring::,'%')
	     or MFILENAME like CONCAT('%',::searchstring::,'%')
		 or MFILEATTRIBS like CONCAT('%',::searchstring::,'%'))
