Wednesday, November 22, 2006

Rolling Tire Change

When I was younger I remember seeing a car on a TV show that some guy had tricked out with everything you could imagine (in the early 80s at least). The really cool part was when he showed how you could actually change a tire while the car was still moving. This worked by dropping a fifth wheel down, lifting up the offending tire, and extending running boards on the side of the car on which a person could work while changing the tire.

In my last post I mentioned finding an issue in clsql where it wasn't handling backslashes properly because it didn't have a database object with which to determine how to handle the backslashes. I filled Jasko in on the details on Monday, and complained that this meant putting in a fix into the clsql tree, and having to deal with all the tracking issues involved. At that point, he just looked at me weird and said - why don't you just redefine the function in our code and be done with it?

blink

So, in our db package there is now a little extra function:

(defun clsql-sys::sql-output
       (sql-expr &optional (database clsql:*default-database*))
  (progv '(clsql-sys::*sql-stream*)
    `(,(clsql-sys::make-string-output-stream))
  (clsql-sys::output-sql sql-expr database)
  (clsql-sys::get-output-stream-string clsql-sys::*sql-stream*)))

What is even cooler is that I could write the new function, and then load it into the running server without ever requiring a restart. We could replace a defective function in a third-party library on-the-fly without any downtime. People delivering code in a more traditional distribution format wouldn't get much use from this kind of ability, the implications for software-as-a-service are pretty amazing (to me at least). While the choice of Lisp as our implementation language, especially given my own level of understanding, seemed a little outside the mainstream, we have benefited many times over from that decision.

Labels:

0 Comments:

Post a Comment

<< Home