Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Treating XML as SQL?

Developers
J. Preiss
2007-04-24
2013-04-26
  • J. Preiss
    J. Preiss
    2007-04-24

    Is there a way to use XML data as report data? I want to make some printouts, but not all data is placed in a database.
    This problem I had with Crystal Reports, too. The XML-ODBC wanted to be paid, so after all I exported all data into CSVs and used the ODBC-driver from Mircosoft.
    But ideally would be to set an internal data buffer, and I can reference this data in the report definitions...

    Is it really that hard to execute an SELECT statement into an xml tree? (<- wondering, no accuse to anyone). Or is it possible at all to translate a select? I assume I need something like that for my own library anyway...

     
    • Chris Ryan
      Chris Ryan
      2007-04-25

      We don't have anything like what you are describing right now. One possible approach you could look at doing is creating creating your own Qt Sql driver implementation that reads information from XML in an sql'ish manner. I have not ever implemented my own Sql driver before but I know it can be done.

      The other thing that may be a problem is it sounds like you are looking to pull information from two different data sources in the same report definition. Right now the writer/renderer has no way to use more than a single data source at a time.

      Chris Ryan

       
    • J. Preiss
      J. Preiss
      2007-04-26

      No, I don't think I want to write an Sql driver for xml ;-)
      Most of my data has tree form, so I want it to be saved as xml. But when I already have this form, I could give it to the rendering functions as QDomDocument. What I not want is to write it to a temporary file and let it be read by another module as xml. That's what I already have with Crystal Reports and ODBC for CSV files :-(

      In the current version, I already have written something like a "renderer", which produces plain text files, and a summary, which produces summary trees, but afterall a plain text, too. Therefore, I walk a lot of lists to accumulate some kind of <attribute,value>-pairs. If I only knew how far away it is from your code. If I only had the time to have a look at it.
      Maybe the access to the data, which is now done by the QSql modul, could be a bit departed from the rest of the system. Thats what I'm trying right now: to find a way to let an external module (.so/.dll) decide, where to take data from either from an sql table, or from an xml file.

       
    • chris newey
      chris newey
      2007-08-24

      depends how adventourous you are. 2 qt database connections, kick the queries into a single temporary table and produce the report from that.

       
    • chris newey
      chris newey
      2007-08-24

      Doesn't break openrpt and its tools, depending on the DB you might be able to create a stored procedure that creates a table across 1..n databases. DB2 on MVS can do it with little bit of effort.

      Essentially, Openrpt is happiest coping with a single query, so give the beast what it wants.

      Mucking around with stored procedures/queries solves the problem