Prepare statement is more or less a named stored procedure with one query statement (i.e. less powerful) - not all database supports it by default (I don't know whether Oracle supports it because I have no experience with Oracle, but AFAIK Oracle has a notion of stored procedures), but the basic concept remains the same - abstracting statement(s) by name and parameters.
<br><br>HTH,<br>yinso <br><br><div><span class="gmail_quote">On 5/31/07, <b class="gmail_sendername">Richard Cobbe</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Thu, May 31, 2007 at 11:22:53PM +0200, Jens Axel Søgaard wrote:<br>> Richard Cobbe skrev:<br>> > On Thu, May 31, 2007 at 10:19:36PM +0200, Jens Axel Søgaard wrote:<br><br>> >> > (define s (prepare db (sql (SELECT (entry_id title url score)
<br>> >> FROM entries<br>> >> ORDER-BY (score DESC)<br>> >> LIMIT ,"?"))))<br>> > Looks great, and I'd love to know more about this. Let's start with:
<br>> > - sqlite.plt defines prepare in terms of an FFI call to SQLite. Is this<br>> > feature available for other DBMSs (specifically Oracle)? Or are<br>> > Oracle's bind variables (SELECT x FROM y WHERE z = :1) the equivalent
<br>> > functionality?<br>><br>> I am no database expert, but I think Prepare is part of the SQL<br>> standard.<br><br>So I did some digging -- specifically, I googled for<br> "prepared statement" oracle.
<br>Everything I've seen so far suggests that this notion of a prepared<br>statement is part of [OJ]DBC, rather than SQL. We're not using *DBC, so<br>AFAICT this doesn't apply, but we appear to have an equivalent alternative.
<br><br>I'm spending so much time on this here because I want to make sure I'm not<br>overlooking something that would be useful to us.<br><br>> > - I'm particularly interested in the sql form above, but it doesn't seem
<br>> > to be defined in sqlite.plt. Where'd that come from?<br>><br>> See "An Introduction to Web Development with PLT Scheme" for an<br>> elaborate explanation.<br><br>Thanks; I'll check that out.
<br><br>Richard<br>_________________________________________________<br> For list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme