#
#	DQUERY configuration for "progmultires"
#
# querytype "qprog" tells there is a query-program to be executed
#
@group		TEST
@querytype	qprog
@attributenames	cfgname:kfodbconfigname:{{cfgnameoptions}}
@cfgnameoptions	{"labeltext":"Datenbank","typedesc":"Name der KFOQSDB-Datenbank Zugriffs-Konfiguration, in der die Abfragen ausgeführt werden sollen"}
#
# the default value for <cfgname> shall be "kfoqsdb01e", so no input form is presented
#
# @cfgname kfoqsdb01e
#
# resultobject_options.expandall instructs web renderer to expand all hierarchical object levels upon rendering
#
@resultobject_options.expandall true
#
# the query-program is to be provided as a javascript-fragment defining the query program
#
@queryprogram	queryprogram = this.queryprogram;

~queryprogram.program

#
# 0:
#
cmd	jsexpr
expression	
	this.results = new Array(); 
	logger.debug("progmultires.0.qprogram: "+aux.objTxt(this.queryprogram));
	this.cfgname = this.query.cfgname || db.getCurrentConfig().getName();
	logger.debug("progmultires.0.cfgname=\""+this.cfgname+"\"");
	logger.debug("progmultires.0.results["+this.results.length+"]: "+aux.objTxt(this.results));
marker0
	marker_0

#
# 1:
#
cmd							dquery
query.dbconfigname			{{cfgname}}
query.querytype				dbselect
query.format				none
query.sql_postgresql		select * from V_DESCRIPTION where schema='kfoqsdb' and objectkind='v' and objectname='v_qsd4'
query.pre_query				logger.debug("pre_query_progmultires.1 executed, query: "+aux.objTxt(that.query));
marker1						marker_1

#
# 2:
#
cmd							dquery
query.dbconfigname			{{cfgname}}
query.querytype				dbselect
query.format				none
query.sql_postgresql		select * from v_qsd4
query.pre_query				logger.debug("pre_query_progmultires.2 executed");
marker2						marker_2

#
# 3:
#
cmd							dquery
query.querytype				jsexpr
query.qexpression
	logger.debug("progmultires.3.query: "+aux.objTxt(that.query)); 
	that.result = new aux.Result('dbresult');
	that.result.addMetaDataName("Spalte0"); 
	that.result.setCellValue(0,0,"S0_Z0"); 
	that.result.setResultAttribute("title","Ergebnis progmultires.3");
marker3						marker_3

#
# 4:
#
cmd							jsexpr
expression
	this.result = new aux.Result("object");
	this.result.resultobject = {};
	this.result.resultobject.nowtime = new Date();
	this.result.resultobject.nowstring = aux.nowstring();
	this.result.title = "Ergebnis progmultires.4";
	this.result.resultobject = aux.makeAnnotatedObject(this.result.resultobject,"progmultires.4","pmr.4");
	logger.debug("progmultires.4.result: "+aux.objTxt(this.result));
marker4
	marker_4