[cc'ing the developers lists - someone might be listening...] João Henrique Freitas writes: > Ok Markus. > > I am working in the code.... > > Currently the functions dbi_conn_escape_string(), > dbi_conn_escape_string_copy(), and > dbi_conn_escape_binary_copy() quote and escape. Is possible create > dbi_conn_escape_only_string(), dbi_conn_escape_only_string_copy(), and > dbi_conn_escape_only_binary_copy() functions to only escape a string, > not quote. This seems to be much simple to do. > > And will do not break the current API. > > > Other suggestion is implement an option in functions dbi_conn_escape_* > to select quote or not to quote a string >
Good to hear you're working on the code. I can imagine several solutions. Before outlining them, let me briefly reiterate two issues related to backwards-compatibility: 1) external API: this is the one that libdbi end-users use to implement their stuff. If we simply add functions, old code will continue to work with the new libdbi versions. If we change the prototypes, or alter the way a function behaves, we'll break existing code. We can do that if we have enough reason to do so, but this warrants a new series (0.9 in our case, or 1.0 if we move to proper library versioning as discussed earlier on this list). 2) driver API: this is the one that driver authors use. If we add functions to the external API which requires implementations in each driver, we also have to move to new libdbi and libdbi-drivers series as existing drivers won't work with the next libdbi release. That is, if we don't want to move to 0.9 or 1.0 right away, we'd have to avoid changing the driver API and we mustn't alter the implementations of existing functions. I see the following solutions, in increasing order of invasiveness: 1) add new functions dbi_conn_escape_string(), dbi_conn_escape_string_copy(), and dbi_conn_escape_binary_copy() and implement them entirely in libdbi. All these functions have to do is to call the dbi_conn_quote_* equivalents and strip the quotes (i.e. the first and the last character) from the resulting strings or blobs. No driver API change, backwards compatible external API change. 2) as per your suggestion, add a boolean argument to the existing functions which selects whether or not to add the quotes. The functions could be implemented in libdbi, or be passed to the drivers. Backwards incompatible external API change, optional driver API change. 3) the cleanest solution: add the new functions to the external API and pass them to the drivers. Backwards incompatible external API change, driver API change. My personal taste suggests 1) but I'm open to suggestions. regards, Markus -- Markus Hoenicka [EMAIL PROTECTED] (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Libdbi-drivers-devel mailing list Libdbi-drivers-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel