> Prepared Statements: This would allow you to prepare a statement once
> and call it multiple times with different inputs.  This is potentially
> much faster on certain databases, up to 60% on PostgreSQL, and from
> what I've heard possibly more on Oracle.  Here's how I think it should
> work:
>
>   DB[:items].filter(:x=>:S?).prepare(:items_with_x) # Hopefully nobody
> uses a column named "S?"
>   DB.call(:items_with_x, 2) # The equivalent of SELECT * FROM items
> WHERE x = 2, but faster

Since #filter accepts a hash, there is no way to know what order you
must provide the parameters. If we're going to go with the :x=>:S?
route, I think we should provide the following two ways to specify the
parameters:

  dataset.filter(:x => :S?, :x => :T?).prepare(:items)

1. Using hashes:
  DB.call(:items, :S? => 3, :T? => "hi")

2. Using multiple arguments
  DB.call(:items, 3, "hi") # parameters are alphabetized, so 3 would
map to :S? and "hi" would map to :T?

Also, should #prepare return a PreparedStatement object?

  x = dataset.filter(:x=>:S?).prepare(:asdf)
  x.call(3)
  x.call(4)
  x = DB.prepared[:asdf]
  x.call(5)
  x.call(6)

Finally, I think #call should be #exec or #execute, since that's what
I've seen most often in other implementations.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to