From: Danny Y. <dy...@hk...> - 2002-04-22 19:23:14
|
Hi everyone, I'm starting to play around with Jython and servlets, and am having a fun time at it. One problem that I've run across though is with zxJDBC and fetchall(), and I just want to make sure it's just me. *grin* Does anyone know what is the defined behavior of fetchall() if the result set is empty? From the DB2.0 documentation, it's not clear at all if it should be an empty sequence or not; I had assumed that, no matter what, fetchall() would return a sequence of some sort. The reason I'm asking is because it appears that zxJDBC returns the None object when handling an empty resultset: ### >>> cursor = db.cursor() >>> cursor.execute("select pub_gene_id from pub_gene where name like 'ag%'") >>> cursor.fetchall() [(18,), (31029,), (31030,), (29356,), (29904,), (277,), (278,), (29156,), (29905,), (279,), (31034,), (31035,), (29125,), (29209,), (29865,), (182,), (31037,), (221,), (31038,), (29117,), (222,), (29536,), (183,), (29289,), (28601,), (1042,), (29790,), (31039,), (28845,), (28819,), (28851,), (223,), (19,), (28423,), (29798,), (29198,), (34616,), (28962,), (29866,), (29711,), (29502,), (28800,), (28651,), (29423,), (28639,), (34617,), (34618,), (34619,), (34620,), (29867,), (29481,), (28290,), (34615,), (28594,), (21,), (20,), (28581,), (29412,), (28794,)] >>> >>> cursor.execute("select * from pub_gene where name like '%danny%'") >>> print repr(cursor.fetchall()) None ### The first selection works perfectly well, but the second returns a None value, not a sequence. Has anyone else run across this? Thanks! |