Top |
char * | output-directory | Read / Write |
gpointer | spec | Read / Write |
char * | spec-filename | Write |
char * | spec-string | Write |
The GdaReportEngine object generates a report based on a specifications file in any XML format. It browses through the XML file and replaces the parts of it which are <gda_report...> action nodes. The generated XML file may then need to be processed using other post-processor tools depending on the XML file format.
The following "action" tags known are:
Table 22.
Node name | Description | Attributes | <gda_report...> sub nodes |
---|---|---|---|
<gda_report_section> |
Starts a section which runs a SELECT query to generate a data model (GdaDataModel). A parameter named "<query_name>|?nrows" is created and is available in any sub node of the <gda_report_section> node, which contains the number of rows in the section's data model. |
|
|
<gda_report_iter> |
Repeats is list of children nodes for each row in the section's data model. Note that is that data model has no row, then the contents of the <gda_report_iter> node will not appear at all in the final result.
For each column of the data model, several parameters are created, named
<query_name>|@<column_name> (such as "customers|@ |
||
<gda_report_query> | Specifies the SQL of the SELECT query in a <gda_report_section> section. The SQL should be in the contents of that node |
|
|
<gda_report_param_value> | Replace the node with the value of a parameter. The parameter can either by defined globally (and declared to the GdaReportEngine), or defined as part of a section |
|
|
<gda_report_expr> | Replace the node with the evaluation of an expression. The expression can be any SQLite valid expression,
and can contain any reference to any parameter. For example the node:
<gda_report_expr> ##customers|@col IS NULL </gda_report_expr>will return a TRUE value if the parameter named "customers|@ col " is not NULL. For more
information about the parameter's syntax, see the GDA SQL query syntax.
|
||
<gda_report_if> | Creates an "IF THEN ELSE" flow control, based on the evaluation of an expression (in the same way as for the <gda_report_expr> node). If the expression evaluates as TRUE, then the <gda_report_if> node will be replaced by the children nodes of the <gda_report_if_true> node if it exists, and otherwise by the children nodes of the <gda_report_if_false> node if it exists. | "expr" to define the expression to evaluate | <gda_report_if_true> and <gda_report_if_false> |
<gda_report_if_true> | Defines the contents to use when the expression of a <gda_report_if> is evaluated as TRUE | ||
<gda_report_if_false> | Defines the contents to use when the expression of a <gda_report_if> is evaluated as FALSE |
GdaReportEngine *
gda_report_engine_new (xmlNodePtr spec_node
);
Creates a new GdaReportEngine using spec_node
as the specifications. Note that spec_node
is
not copied, but "stolen" by the new report engine object.
GdaReportEngine *
gda_report_engine_new_from_string (const gchar *spec_string
);
Creates a new GdaReportEngine using spec_string
as the specifications.
GdaReportEngine *
gda_report_engine_new_from_file (const gchar *spec_file_name
);
Creates a new GdaReportEngine using the contents of spec_file_name
as the specifications.
void gda_report_engine_declare_object (GdaReportEngine *engine
,GObject *object
,const gchar *obj_name
);
Declares an object which will be used in engine
, referenced by the obj_name
name.
object
must be of a supported types, that it must be a GdaConnection, GdaStatement or GdaHolder object.
engine |
a GdaReportEngine object |
|
object |
a GObject to declare |
|
obj_name |
the name to give to |
GObject * gda_report_engine_find_declared_object (GdaReportEngine *engine
,GType obj_type
,const gchar *obj_name
);
Finds an object which has previously been declared using gda_report_engine_declare_object()
.
engine |
a GdaReportEngine object |
|
obj_type |
the type of requested object |
|
obj_name |
the name (in |
xmlNodePtr gda_report_engine_run_as_node (GdaReportEngine *engine
,GError **error
);
Execute the engine
engine and creates a new xmlNodePtr XML node
xmlDocPtr gda_report_engine_run_as_doc (GdaReportEngine *engine
,GError **error
);
Execute the engine
engine and creates a new XML document