Hi all, On Tue, Oct 20, 2009 at 3:14 AM, Eric Day <[email protected]> wrote: > Thanks to all who responded with the valuable feedback. It sounds > like we need to support '?' for other APIs, and I think supporting > both numeric and string IDs will be trivial on top of this. String > IDs generally have a ':' prefix, so we'll stick with that (ie, ':name').
Yay! > One question is what prefix character to use for numeric IDs, > since I see both '?' and ':' conventions. Which would folks prefer: > > > 1: INSERT INTO foo VALUES(?, ?1) > 2: INSERT INTO foo VALUES(?, :1) > 3: Some other convention. I prefer 2 for the simple reason that it conforms to syntax I know from Oracle. Haven't seen the ?1 syntax ever, although I suppose it makes equal sense in case you're already supporting "anonymous" ? placeholders as well as named : placeholders. > > > Also, should numeric IDs start at 0 or 1? 1. Please, 1. Except for PHP (which uses sometimes 0, and sometimes 1) and google gears (which uses 0), all major call level API's (ODBC, JDBC) that I know use 1 as origin for both parameters and columns. I am not religious in choosing that, but it seems a waste to be compatible with these apis at one level (? placeholders) and not at another. That said, I suppose you could allow both without too much effort: simply assume the lowest number you find in the query to be the origin. > I saw mixed feelings on supporting only string vs a few native types > (for example, int). Only allowing one type simplifies the interface > quite a bit, so for the query: > > drizzle_query(drizzle, "INSERT INTO foo VALUES(:name, :age)", values, 2); > > Which would folks prefer: > > 1: String only interface > 2: Supports string, ints, other basic types with type safety (enum/union) > 3: Supports string, ints, other basic types with no type safety (void *) > 4: Some other convention. Personally, as a user, I'd definitely want to see 2: all basic types (AFAIAC that's, long, double, char *), with type checking. kind regards, ROland > My preference would be 1, but if we do want multiple types, I'd prefer > 2 over 3 for the type safety. If 2 is the most popular, looking for > suggestions on better union/struct naming as well. :) > > Thanks! > -Eric > > On Tue, Oct 13, 2009 at 12:42:52AM -0700, Eric Day wrote: >> Hi! >> >> We've decided to add the prepared statement API sooner than later, >> and I've been looking into various ways of mapping variables in. There >> are simple '?' with order of appearance determining order into the >> array of vars, there are '$1', '$2', ... which would allow you to >> repeat or do things out of order. Or the SQLite method of '?nnn' or >> ':aaa' and also allow identifies. >> >> What are folks thoughts on PS APIs? Anything they really love or hate? >> >> We're also thinking of restricting vars to strings for now, but >> possibly simple INT types. Other types could still be given as vars, >> but they'd just be passed in as strings. >> >> Thanks! >> -Eric > > _______________________________________________ > Mailing list: https://launchpad.net/~drizzle-discuss > Post to : [email protected] > Unsubscribe : https://launchpad.net/~drizzle-discuss > More help : https://help.launchpad.net/ListHelp > -- Roland Bouman http://rpbouman.blogspot.com/ Author of "Pentaho Solutions: Business Intelligence and Data Warehousing with Pentaho and MySQL", http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470484322.html _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

