Re: psycopg2.extensions.adap
От | Daniele Varrazzo |
---|---|
Тема | Re: psycopg2.extensions.adap |
Дата | |
Msg-id | CA+mi_8bzRaO5tYCMGBEX2WYKyySLH+Enqb728Shv2XGSAmscRg@mail.gmail.com обсуждение исходный текст |
Ответ на | psycopg2.extensions.adap (Massimo Di Pierro <mdipierro@cs.depaul.edu>) |
Список | psycopg |
On Fri, Sep 2, 2011 at 2:50 PM, Massimo Di Pierro <mdipierro@cs.depaul.edu> wrote: > 1) If I use psycopg2.extensions.adap(" \' ") do I get " ' " or " \'' "? In other words... does adapt know whether I setstandrad_conformal_strings to on or off? How does it know that? The SCS setting is communicated by the server to the client at connection time. The setting is used by the libpq to encode the strings using the proper escape style (using the PQescapeString function). This function returns the escaped string without the quotes: psycopg adds the quotes and, if required (if SCS is on) the E too. As a result, everything should work regardless of the SCS setting. > 2) Is there a pure python distribution of psycopg2? No: psycopg2 is a C extension. A few months ago Alex Gaynor ported psycopg2 to pypy, I believe using ctypes to access the libpq from python and, if I've understood correctly, mvantellingen is making this ctypes porting a standalone package (https://github.com/mvantellingen/psycopg2-ctypes). I haven't tested any of these portings and I can't assess their correctness/completeness (I've skimmed the latter's code and I think the core part is in, but not a few secondary features. And as a first glance I don't think it works with SCS=off). None of these package is "pure", as they all wrap the C libpq library, but they do without C code of their own. Pure Python drivers for Postgres do exist: they all exhibit one ore more of the several shortcoming: slower, less maintained, less tested, non-standard interface. -- Daniele
В списке psycopg по дате отправления: