#5 Have select use prep statements

David Hoag
David Hoag

Change the code to support the use of prepared
statements for the "selects".

This could potentially improve performance.


  • David Hoag
    David Hoag

    Logged In: YES

    Modify the SqlStatementCacheItem to take a SQLAssembler
    instead of only a SQLModifier. This allows you to reuse the
    logic and code doing updates/inserts for select support. This
    will drive new methods that need to be added to the
    SQLAssembler interface.

    Modify the SQLAssembler interface to support the necessary
    prep statement methods. I suspect you'll only need to add
    one or two methods: something like "bindValues"
    and "getPreparedString" ... not sure, just a guess.

    Refactor SQLModifier to move all of the Prep Statement
    specific logic into another class. Update SQLModifier to
    always instantiate that class at construction and delegate
    existing methods to that class. This allows you to reuse that
    code for the SQLSelect.

    Implement the new SQLAssembler methods by using an
    instance of the newly refactored class as the implementation

    ... Next start looking at the RDBConnection - first modify the
    createStatement & addStatement method to accept the

    Create a new method that is 90% similar to
    prepareUpdateSql. PrepareUpdateSql presumes that it's doing
    an update and not a select, so you won't be able to just
    change it - you'll need a whole new method: