<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Dear folks,<br>
Carsten Haese wrote:
<blockquote cite="mid1180646415.3382.155.camel@dot.uniqsys.com"
type="cite">
<pre wrap="">On Thu, 2007-05-31 at 10:44 -0400, Art Protin wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I guess I am expected to weigh in and make perfectly clear where I
stand.
</pre>
</blockquote>
<pre wrap=""><!---->
"Expected" may be too strong a word, but yes, input from as many
interested parties and API module maintainers as possible is helpful to
measure consensus.
</pre>
<blockquote type="cite">
<pre wrap="">[snip...]
</pre>
</blockquote>
<pre wrap=""><!---->
If I summarized that correctly, you are in favor of requiring qmark,
named, and numeric, and dropping format and pyformat.
I could live with that. As I said before, InformixDB already supports
all three styles, so whether named/numeric are optional or required
makes no difference to me. I'm concerned that requiring named/numeric
might encounter more resistance than requiring qmark, but so far I
haven't seen such resistance on this thread.
</pre>
<blockquote type="cite">
<pre wrap="">As for a switching requirement: how does this sound (I just though of
it this morning)
making the parameterstyle depend on the first character of the SQL
statement.
If it is a colon, remove it and the parameter style is either numeric
or named; if it is
not a colon, the parameter style is qmark.
</pre>
</blockquote>
<pre wrap=""><!---->
Sorry, I give that a -1. Using "magical characters" is utterly
unpythonic, and somebody reading the code would have no clue what's
going on.
A sensible switching mechanism should look something like this, in my
opinion: Add optional 'paramstyle' keyword arguments to
module.connect(), connection.cursor(), cursor.execute() and
cursor.executemany(). In the absence of a 'paramstyle' argument,
individual executions inherit the cursor's paramstyle, cursors inherit
the connection's paramstyle, and connections use the module's read-only
paramstyle attribute as default. (As discussed before, allowing the
module-wide paramstyle to be changed is IMO a bad idea.)
</pre>
</blockquote>
First, I must confess. I do not know how to make a module's attributes
read-only.<br>
I do know how to make classes where object instances have read-only
attributes.<br>
<br>
Optional keyword arguments are a very good approach & I do like the<br>
inheritance scheme. Would it make sense for paramstyle to be an
attribute<br>
of connection and cursor, that could be read and written?<br>
<br>
(As for changing the module-wide paramstyle, you have persuaded me that<br>
that approach is "sub-optimum". I do expect that I will at least have
to add<br>
a superior way and change the documentation to point users at the
better way.)<br>
<br>
<blockquote cite="mid1180646415.3382.155.camel@dot.uniqsys.com"
type="cite">
<pre wrap="">
Then again, I'm not too excited about the whole idea of manual
switching. I'd prefer auto-detection based on whether the query string
contains question marks, colon+number or colon+identifier markers
outside of string literals. Not only because that is what InformixDB
already does, but because it leads to cleaner code.
</pre>
</blockquote>
I would like autodetection, even prefer autodetection, if I was sure
that it would<br>
work correctly every time no matter what. I am getting more
comfortable with<br>
that hypothesis, but have not yet developed a proof that autodetection
could not<br>
get spoofed.<br>
<br>
In absense of such a proof, I prefer to have the user (even when that
user is me)<br>
declare what is expected and have the module check as best it can and
complain<br>
when the expectations are not met.<br>
<br>
If such a proof was included in the spec., then .paramstyle could be
eliminated<br>
(and that would be good).<br>
<br>
<blockquote cite="mid1180646415.3382.155.camel@dot.uniqsys.com"
type="cite">
<pre wrap="">
Best regards,
</pre>
</blockquote>
[[ why does my email agent seem to discard your signature ??? ]]<br>
<br>
Thank you all,<br>
Art Protin<br>
<br>
<br>
<br>
<br>
</body>
</html>