This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: query type of an instance


On Thu, 2007-12-13 at 15:23 -0800, John Whittaker wrote:
> Finally, what all this is really leading up to is a
> bigger Kawa and Scheme macro question.  I'd like to
> have a macro (maybe a function would do as well)which
> I will call "with-result-set" (perhaps
> "collect-result-set" would be better).  You would give
> it a result set instance (say a
> sun.jdbc.odbc.JdbcOdbcResult) and a variable number of
> pairs consisting of a type and a field name.  So an
> invocation might look like (with-result-set my-rs
> '(String "Field1") '(Float "Field2") ...).  It would
> return a list of lists of all those fields in the
> result set: (("abc" 42) ("def" 56.2) ...).

Actually you could do this the way you have written it as a simple
function.  You could simply choose the method to call at runtime based
on the car of each field spec.

Syntax would help you if you wanted to add more, like binding variables
in an implicit or explicit loop, possibly named after the SQL fields,
with Kawa variable types inferred from the car.

-- 
Our last-ditch plan is to change the forums into a podcast, then send
RSS feeds into the blogosphere so our users can further debate the
legality of mashups amongst this month's 20 'sexiest' gadgets.
        --Richard "Lowtax" Kyanka

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]