Re: New gda-report
- From: Rodrigo Moya <rodrigo linuxave net>
- To: Carlos Perelló Marín <carpema hispalinux es>
- Cc: gnome-db-list gnome org
- Subject: Re: New gda-report
- Date: Sun, 09 Jul 2000 02:02:46 +0200
Carlos Perelló Marín wrote:
>
> Well folks, here you have the start code to the new gnome-db's report
> engines. At the moment it's only an extension of the actual
> gda-xml-query from Vivien Malerba (please, excuse me Vivien i have
> copied ALL your code, but i thought that this will be the best way to
> start).
>
> I have modified only one thing at the original gda-report's DTD, all the
> sections can have a CalculatedFiled.
>
> I have one problem before i can start to implement some thing useable.
> What i can do to refer in my DTD the "Field" as an XML-QUERY? i mean,
> when in a report i refer to a database field, or query i want (well i
> MUST do it) use a gda-xml-query object. I suppose that it will be at the
> XML tree like a node and when i find it i will call the gda-xml-query to
> work with it, but how i could represent it at gda-report's DTD?
>
I don't know about how to represent it in the DTD. Maybe there is a way
for refering to an external DTD, and have some nodes be the root node of
those DTDs? There is a mailing list about the libxml lib, so you may ask
all these questions there.
> P.S.: Well i have in my hands a book about Crystal Reports, do you thing
> that in this summer we could implement the gda-report with almost the
> 50% of the functionality that Crystal Reports have?. Please help!!!!!
>
Well, if I'm not wrong, these are the steps you may take:
* report-desing: there should be complete programmatic control for this
Gda_Report object, so that the GnomeDbReport widget can be easily coded
to let design the report visually. Thus, other 'viewers' could be
implemented easily (for example a non-GNOME-dependant one).
* execute the report: for this, I would create a set of GTK signals, so
that the Gda_Report can notify a possible report output viewer (the
GnomeDbReport widget we talked about) about what is being done. So, for
example:
"start_document" -> initialize printer, ...
"end_document" -> to finish the document
"print_line"
"print_field"
"new_line"
... and many more
thus, the Gda_Report only knows about the organization of the report,
and it is the viewer that 'actually' represents the output.
When you execute the report, you must use the gda-client lib API. So, I
would add a gda_report_run function, to which you pass a Gda_Connection
object from which to take the data.
* get the data from the database: this is quite easy. Vivien has added
some useful methods to the Gda_XmlQuery object, The first one is
gda_xml_query_new_from_node(), which lets you create a Gda_XmlQuery from
a node in your report file (although as I said, I don't know how you
reference this in the DTD). Then, you can call
gda_xml_query_get_standard_sql if the provider supports SQL (you can ask
about this with the gda_connection_supports() function), or send the
query in plain XML to the provider if it does not support SQL. As Vivien
says in the gda-xml-query.h file, every provider should implement its
own gda_*_connection_xml_query_to_sql(), so this will be one of the
first new additions to the IDL files.
Coding this will just be:
Gda_Report* report;
Gda_Recordset* recset;
gchar* command;
Gda_XmlQuery* query;
......
query = gda_xml_query_new_from_node(...);
if (gda_connection_supports(report->cnc, GDA_Connection_FEATURE_SQL))
{
command = gda_xml_query_get_standard_sql(query); // or call
provider's specific
recset = gda_connection_execute(report->cnc, command, NULL, 0);
}
else
{
recset = gda_connection_execute_xml_query(report->cnc, query);
}
if (recset)
{
/* traverse the recordset, and emit signals as needed */
....
}
You can start by implementing the case where the provider supports SQL
(which right now is always TRUE) since you need nothing added to the
current CVS sources.
So, to make all this work, things to do:
* code the GnomeDbReport widget at the same time we go further with
Gda_Report. This widget will be the part talking directly with
gnome-print. Carlos, if you know GTK/GNOME programming and want to do
it, just say it, but if not, I'll do it myself.
* add xml_query related methods to the IDL files: again, I prefer to
wait until the postgres provider is ported to the gda-server lib. This
includes xml_query_to_sql, exec_xml_query, and (maybe?) sql_to_xml_query
i am right now busy on making the debian packages work (BTW, thanks
publicly to Akira TAGOH, who has done all the work), but as soon as
they're ok, I'll make a release and we'll concentrate on making all the
XML stuff work (Gda_XmlQuery, Gda_Report/GnomeDbReport, and
Gda_XmlDatabase, for the database designer and import/export stuff).
I've added your code to the gda-clnt directory, since I haven't seen the
point in including it in gda-common. What use may providers make of the
Gda_Report class?
And Carlos, from now on, as you've got already a CVS account, just
commit directly instead of sending the code. But as I've said other
times, don't touch in a place you are not sure about, please!
Cheers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]