Ken wrote:
 It should save some time. How much is questionable.
Why would sqlite have to bind the Pointer bound variables? Isn't the strategy of binding to associate a variable with a statment? Why should I have to continually re-associate the bindings with a statement thats allready been prepared and bound, just to execute it again after a reset ? I guess I'm a bit confused, I'll look at the bind code in sqlite some more.
Ken,

Your idea could save some time but it would require adding a new class of indirect variables (references) to sqlite. The VDBE opcode that loads the variable values would have to be changed to recognize the indirect variables and then create an internal sqlite variable that can be pushed onto the VDBE stack from the external variable. The last part is the same function that the bind routines perform. The bind APIs are fairly lightweight functions, basically just saving the value passed into an internal array. Your scheme would only be saving the overhead of the internal copy operation (from the variable to the stack during the op_variable opcode) and the call to the bind function itself.

This scheme would also be adding the cost of the variable type check to every variable lookup. There is also the distinct possibility that a variable may be dereferenced more than once while executing a statement, and this would involve duplicating the work of creating the internal variable from the external memory.

There is also the possibility of some nasty SQL bugs due to the value off a variable being changed during the execution of a statement.

All in all I don't think the payback is large enough to justify the extra complexity and increased code size in the general case. If you have an application where the overhead of the bind functions calls are a real issue, you could of course create a custom version of sqlite that implements your idea.

Dennis Cote

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to