On Mon, 2007-06-04 at 15:32 +0200, M.-A. Lemburg wrote: > Do you really think it's reasonable to have the module parse > every single SQL statement just to detect the param style ?
Well, at least I don't think it's unreasonable to do so. This parsing is not expensive and only happens when the query is prepared, so the performance impact is minimal. > What happens if you're in qmark style mode and the SQL statement > contains substrings which look like named style (but are not > intended that way, e.g. think stored procedures) ? Do you have a concrete example? > This approach also contradicts the explicit is better than > implicit Zen rule. Well, one might argue that the paramstyle is explicitly visible in the format of the query string. > Just so that there's no misunderstanding: you're free to implement > this sort of extension in your module(s), but making this > mandatory in the spec feels wrong. Fair enough. > Following you proposal to require auto-detection, this would mean > more than just duck-typing. You wouldn't know what type to expect > until you've parsed the SQL statement string - ie. when you're > already inside the .execute() method and passed the argument > parsing step. > > That's a bit much too dynamic and too implicit for an interface > specification. I thought being dynamic was Pythonic ;) Anyway, I do think we can reach a compromise here: > So I'm: > > * +1 on making support one param style mandatory for all > implementations Any one? Let's make named mandatory, then. > * +1 on requiring an interface to adjust the param style on a > per connection or even per cursor basis, so that it's easy > to setup an implementation to the mandatory param style > (in case the module defaults to another param style for backwards > compatibility reasons) > > This interface would have to support at least the mandatory > param style. +1, let's discuss what that interface should look like. > * -1 on doing auto-detection of param styles at .execute() > call time based on parsing the SQL statement I now agree with -1 on making auto-detection mandatory as long as there is a way to turn it on. How about making a special paramstyle called auto? -- Carsten Haese | Phone: (419) 861-3331 Software Engineer | Direct Line: (419) 794-2531 Unique Systems, Inc. | FAX: (419) 893-2840 1687 Woodlands Drive | Cell: (419) 343-7045 Maumee, OH 43537 | Email: [EMAIL PROTECTED] _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig