Example #1
1
   def escape(self, string):
       """
	Escapes a string for use in a query
	
	This is the equivilate and MySQLdb.escape()
	
	@author: Nick Verbeck
	@since: 9/7/2008
	"""
       return MySQLdb.escape(string)
Example #2
1
 def esc(self, s):
     if isinstance(s, unicode):
         s = s.encode("utf8")
     try:
         return self.db.escape(s)
     except:
         try:
             return MySQLdb.escape(s, self.db.converter)
         except:
             # TODO: this should not be necessary.
             # maybe switch to
             #       cursor.execute("select whatever from whomever where something = %s", my_parameter)
             # ?
             s = str(s)
             return "'" + s.replace("\\", "\\\\").replace('"', '\\"').replace("'", "\\'") + "'"
Example #3
1
 def literal(o):
     return MySQLdb.escape(o, MySQLdb.converters.conversions)