MCPcopy Index your code
hub / github.com/clips/pattern / escape

Method escape

pattern/db/__init__.py:273–277  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

271 def __init__(self, data, type=SQLITE):
272 self.data, self.type = str(hasattr(data, "read") and data.read() or data), type
273 def escape(self):
274 if self.type == SQLITE:
275 return str(self.data.encode("string-escape")).replace("'","''")
276 if self.type == MYSQL:
277 return MySQLdb.escape_string(self.data)
278
279def _escape(value, quote=lambda string: "'%s'" % string.replace("'", "\\'")):
280 """ Returns the quoted, escaped string (e.g., "'a bird\'s feathers'") for database entry.

Callers 5

_escapeFunction · 0.45
insertMethod · 0.45
updateMethod · 0.45
test_escapeMethod · 0.45
test_escapeMethod · 0.45

Calls 2

strFunction · 0.85
encodeMethod · 0.45

Tested by 2

test_escapeMethod · 0.36
test_escapeMethod · 0.36