[DB-SIG] Is there a better way of doing this?

Federico Di Gregorio fog@initd.org
06 Jun 2002 17:41:33 +0200


--=-a+aNEw7LJjPMHMZsa1S0
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

Il gio, 2002-06-06 alle 17:20, Matthew T. Kromer ha scritto:

> Well, I just checked what DCOracle2 does on a fetch after insert.  It=20
> raises a ProgrammingError, because fetch is invalid after insert.  I=20
> didn't notice before because I didn't look deeply into the C code, only=20
> at the python layer.
>=20
> When results are exhausted for fetchone() it returns None, for=20
> fetchmany() and fetchall() it returns [].
>=20
> I do *not* assert that this is the correct behavior.  It's been a while=20
> since I poked around in the guts of the return mechanism (like maybe 18=20
> months <wink>).

AFAIK, this is The Right Behavior (TM) as per DBAPI-2.0 document.

> Like Frederico Di Gregorio mentioned regarding psycopg, I also set the=20
> description attribute to None if there is no description available after=20
> an execute().  This is probably the *best* way to determine if results=20
> are expected to be available, rather than trying to fetch them and failin=
g.
>=20
> Unfortunately <insert dramatic sigh here> I am not aware of any DB API=20
> conformance testing suite.  As an adapter author, I've written tests,=20

me and thierry michel (of PoPy fame), we are writing one using pyunit. a
very preliminary version can be reached at the url given below. (we had
announced it in a week or so, but, alas, you hooked me into it...)

there are some serious problems in testing the functionality of a db
adapter when you should used the methods you're testing (how can i
rollback() a failed test if rollback does not work?) so expect heavy
posting from us in the future ;)

   http://initd.org/pub/software/paco/paco-snapshot-20020606.tar.gz

--=20
Federico Di Gregorio
Debian GNU/Linux Developer & Italian Press Contact        fog@debian.org
INIT.D Developer                                           fog@initd.org
  Qu'est ce que la folie? Juste un sentiment de libert=E9 si
   fort qu'on en oublie ce qui nous rattache au monde... -- J. de Loctra

--=-a+aNEw7LJjPMHMZsa1S0
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQA8/4KsvcCgrgZGjesRAszgAJ4q5H4hH2afl18+NXP8pWwb2y69FgCfYlph
vwH3rhGNR6wKp0nGDrKyXYY=
=4Oe8
-----END PGP SIGNATURE-----

--=-a+aNEw7LJjPMHMZsa1S0--