Forum OpenACS Development: Re: Invalid XML in XQL files

Collapse
Posted by John Sequeira on
Roberto,

It doesn't currently handle db_map.  I think there are only about 10 uses of it in the kernel,  so I hadn't gotten there yet.

It seems as though replacing db_map calls with { db_map_sans_qd  "string-from-xql-file" } wouldn't be very difficult...

I'll email you the script.

Collapse
Posted by Bart Teeuwisse on
John,

there are a number of packages outside the core that use db_map quite a bit. The ecommerce package for one.

While the reverse script might be a blessing if you develop for one database I feel that the idea goes against the purpose of keeping OpenACS DB neutral.

By re-inserting the SQL queries in the TCL files, developers are encouraged to change/fix queries in the TCL files rather than making changes to the XQL files.

Of course it would be possible create new XQL files by re-extracting the SQL queries but my milage with the extraction script has varied.

I'm intrigued by your proposal but think that it could create a lot of confusion when it comes to developing and maintaining OpenACS packages.

/Bart

Collapse
Posted by John Sequeira on
Everyone's made some good points as to why openacs developers wouldn't want to inline queries.  And Jeff's point about the parser being difficult to implement is well-taken.

For my current effort,  OTOH,  minimizing startup time is of huge benefit.  I spent 15 minutes and implemented OACS_FULLQUERIES as a persistent array (see http://mini.net/tcl/3469 ),  and just made db_qd_load_query_file a no-op.  This benefited startup time enormously,  as you'd expect,  and my work now proceeds faster.  OpenACS' implementation of OACS_FULLQUERIES is different than my/nstcl's own,  but using a trace in this way would probably achieve the desired results.

Anyway,  although I can see why it's not appropriate for the toolkit,  I have only worked on single-db projects to date and I still like the idea of inlining.  I might revisit it someday by porting my ugly perl script to a tcl one that uses ParseTools ( http://www.oche.de/~akupries/soft/ptools/ ).  If it worked as advertised,  it might actually do the trick.