mysqldb

wes weston wweston at att.net
Wed Feb 4 09:14:53 EST 2004


ketulp,
    Can you default the connection to None.

def foo(x,y,z,connection=None):
	if not connection:
		connection = OpenMyConnection()
	.....

You could then use foo with or without an open
connection.

wes

ketulp_baroda at yahoo.com wrote:
> Hi
> I am using MySQLdb. I want to know how can I check whether a
> connection is open or not.If it is open I want to use the existing
> connection else create a new connection by
> db=MySQLdb.connection(.........)




More information about the Python-list mailing list