There may be some help for you. ADO will read and write ACCESS data tables, so you can migrate your more challenging data communications tasks to Python and eventually replace your ACCESS application with something a bit more trustworthy.
Vernon Cole (sent from my 'droid phone) On Feb 14, 2011 7:49 AM, "William Dode" <w...@flibuste.net> wrote: > On 14-02-2011, M.-A. Lemburg wrote: >> William Dode wrote: >>> On 13-02-2011, Vernon Cole wrote: >>>> --===============0804799855== >>>> Content-Type: multipart/alternative; boundary=0016e644df66158a5b049c2cec40 >>>> >>>> --0016e644df66158a5b049c2cec40 >>>> Content-Type: text/plain; charset=ISO-8859-1 >>>> Content-Transfer-Encoding: quoted-printable >>>> >>>> This sounds like a handy feature. Recent releases of adodbapi allow the >>>> programmer to specify the paramstyle she wishes to use. If she uses 'qmark' >>>> (the default) her query is used unchanged. If she uses 'named' or 'format', >>>> then her query is converted to 'qmark' before being used. >>>> The cursor stores an ADODB.Command structure as its .cmd attribute. The >>>> (converted) query text is stored in the .cmd.CommandText attribute. There i= >>>> s >>>> no storage of the original query, although it might be an optimization to >>>> keep it around to avoid re-parsing. >>>> >>>> Q) Should a reference to cursor.query return the original query text, or th= >>>> e >>>> reformatted version? >>> >>> Same as mogrify >>> >>>>>> cur.execute("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar')) >>>>>> cur.query >>> "INSERT INTO test (num, data) VALUES (42, E'bar')" >>> >>> >>>> >>>> Q) What is "mogrify"? Is that a reformatted version? >>> >>> mogrify(operation[, parameters])¶ >>> >>> Return a query string after arguments binding. The string returned is exactly the one that would be sent to the database running the execute() method or similar. >>> >>> >>> cur.mogrify("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar')) >>> "INSERT INTO test (num, data) VALUES (42, E'bar')" >>> >>> I use to log it and some times use it to copy and paste. >> >> Since database adapater usually try to avoid merging the parameters >> into the query string before sending them off to the server and >> instead send the query and parameters separately (which is more >> efficient and also allows caching of access plans on the server >> side based on the query string), wouldn't it be better to log >> both the query string and a Python repr() of the parameters >> instead ? > > I would like to see the query after the binding. For example with > msaccess "insert into t (a), (?)", (True,) will insert -1 with > postgresql it will insert 1 > > Also i would like to can copy and paste the query for debugging. For > example with msaccess, if a field is misswritted the error will not show > wich field is it. If i copy-paste it on msaccess it will say me wich > field is it. > > I thought maybe ado could show me this. If not i will do it by hand for > debugging and of course use the params for the real query. > >> >> That's how we have do such logging in our code and it works nicely. >> > > > -- > William Dodé - http://flibuste.net > Informaticien Indépendant > > _______________________________________________ > DB-SIG maillist - DB-SIG@python.org > http://mail.python.org/mailman/listinfo/db-sig
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig