Hello, list, while working on a DB driver abstraction layer[1] i have come across an interesting problem which i first thought only affected MySQL[2], but i now see that i have the same problem in my sqlite3 driver. Consider this SQL snippet:
UPDATE foo SET x=:param1, y=:param1 ... As i understand it (possibly incorrectly!), the bind-by-param-name API will properly set both instances of ":param1", but as far as i can find there is no way to programatically get both indexes: sqlite3_bind_parameter_index() will return only the first index: http://www.sqlite.org/capi3ref.html#sqlite3_bind_parameter_index The intuitive implication of sqlite3_bind_parameter_index()'s definition is that the bind-by-name operations are (or could/should be) implemented as proxies like: bind_by_name("name", value) ==> bind_by_index( index_of_name("name"), value ). (Whether or not it's actually implemented that way, i don't know - i have not delved into the sqlite sources here.) That breaks down, however, when duplicating parameter names. This poses an "interesting problem" for me because my DB abstraction API only exposes bind-by-index and get-index-of-named-parameter APIs, and does not expose a bind-by-name API directly (it's implemented indirectly in terms of the first two operations). The implication of that is that it becomes impossible for my API to support multiple instances of the same parameter name [without notable re-tooling and adding one additional bind-by-name method per bindable data type]. This isn't a tragic problem - i can of course bind the same values to different names if needed (and that's what i've been doing for the rare case where i need it), but i'm curious if there is a way to get all of the indexes of a given named parameter? For example, for the above SQL snippet i "would like to" be able to get the values (1, 2) in some manner. Is there a way to do this with the sqlite3 C API? [1] = http://fossil.wanderinghorse.net/wikis/cpdo/ [2] = MySQL5's C API doesn't actually support named parameters at all, but the cpdo abstraction layer adds it on top of that driver. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users