All pastes #93679 Raw Edit

patch to pymssql

public python v1 · immutable
#93679 ·published 2006-07-20 17:36 UTC
rendered paste body
def _quote(x):	if type(x) == types.StringType:		x = "'" + string.replace(str(x), "'", "''") + "'"	elif type(x) in (types.IntType, types.LongType, types.FloatType):		pass	elif x is None:		x = 'NULL'	elif hasattr(x, '__pg_repr__'):		x = x.__pg_repr__()	elif hasattr(x, 'timetuple'):                x = time.strftime('%Y%m%d %H:%M:%S', x.timetuple())                print x                x = _quote(x)	else:		#print "didn't like " + x + " " + str(type(x))		raise InterfaceError, 'do not know how to handle type %s' % type(x)	return x