[DB-SIG] None Value??

Chris Cogdon chris at cogdon.org
Mon Oct 6 18:33:11 EDT 2003


On Monday, Oct 6, 2003, at 15:24 US/Pacific, Conrad Koziol wrote:

> Hey what does MySQLdb return if it cant find the value. Like in the 
> code
> below, what if conrad does not exist in the table users, what would
> result equal?
>
> db = MySQL.connect(host='localhost, user='conrad', passwd='python',
> db='general')
> cursor = db.cursor()
> cursor.execute('SELECT conrad FROM users')
> result = cursor.fetchall()

fetchall, in this instance, will return an empty list.

if you run 'fetchone' when there are no, or no more, results, it 
returns None.


-- 
    ("`-/")_.-'"``-._        Chris Cogdon <chris at cogdon.org>
     . . `; -._    )-;-,_`)
    (v_,)'  _  )`-.\  ``-'
   _.- _..-_/ / ((.'
((,.-'   ((,/   fL




More information about the DB-SIG mailing list