From: Bruce L. <br...@us...> - 2002-05-03 13:08:47
|
Richard Michael <rmi...@fi...> writes: > Anything else useful not yet documented? I've written a bunch of stuff > to handle vars as alists.. (and I noticed they seemed to be handled > that way behind the scenes anyways), now I wonder if some of that is > exposed but undocumented. Yes. The stuff in brl-context has not been documented because I had vague thoughts of revising it. However, looking at what's there it seems unlikely that backward compatibility would have to be broken, so feel free to look in gnu/brl/progfun.scm for the brl-context- stuff. (Next paragraph is why I'm cc'ing Per) In the next few months I plan to redo a lot of things to fit into Per's framework for BRL now in the Kawa distribution. One of those will be to make brl-context be a subclass of ServletCallContext. (A total rewrite of brlsv.java will likely also be necessary). I'll do at least one more release using the current framework, to get stuff out into an official release that's been waiting in CVS. Now, more about "a bunch of stuff to handle vars as alists". There's some more undocumented stuff that's quite useful. After BRL has better support for multiple similar-named inputs (e.g. foo1, foo2, etc.), there will be a cleaner way to do this, but code already in there makes it easy to do an update of *only* changed fields, reducing the chances of simultaneous updates clobbering each other. Here's some actual code that takes input from a signup sheet for a Toastmasters club I'm involved with. The syntax brl-get-update and procedure sql-partial-update are the pertinent undocumented features. For each input, say "grammarian", there's a hidden input "ogrammarian" that contains the old value. The brl-get-update syntax returns an alist just for inputs that have been changed. You can use it now if you don't mind changing your code when I make an incompatible change (maybe even in the next release), to go with "grammarian_" instead of "ogrammarian", to be more consistent with how a new way of doing this will work. [ (inputs m tmod_name otmod_name othought general_evaluator ogeneral_evaluator evaluator1 evaluator2 speaker1 speaker2 timer otimer topicmaster oevaluator1 tmod_email oevaluator2 ospeaker1 ospeaker2 thought otmod_email otopicmaster grammarian ogrammarian other_business oother_business) ; Get a JDBC statement object that will be closed automatically (define st (brlewis-st brl-context)) (define update-info (brl-get-update brl-context (ss tmod_name) (ss tmod_email) (ss topicmaster) (ss grammarian) (ss thought) (ss speaker1) (ss evaluator1) (ss speaker2) (ss evaluator2) (ss timer) (ss other_business) (ss general_evaluator))) ] <title>Sign-Up Sheet [m]</title> </head> <body> <h1>Sign-Up Sheet [m]</h1> <p>Updated info for [(sql-partial-update st "oa_meeting" update-info "where date_trunc('day', mtg_time) = " (ss m)) ] <a href="./">Oratory Authority meeting</a>.</p> -- <brlewis@[(if (brl-related? message) ; Bruce R. Lewis "users.sourceforge.net" ; http://brl.sourceforge.net/ "alum.mit.edu")]> |