summaryrefslogtreecommitdiffstats
path: root/Doc/lib/sqlite3/md5func.py
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/lib/sqlite3/md5func.py')
-rw-r--r--Doc/lib/sqlite3/md5func.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/lib/sqlite3/md5func.py b/Doc/lib/sqlite3/md5func.py
new file mode 100644
index 0000000..5769687
--- /dev/null
+++ b/Doc/lib/sqlite3/md5func.py
@@ -0,0 +1,11 @@
+import sqlite3
+import md5
+
+def md5sum(t):
+ return md5.md5(t).hexdigest()
+
+con = sqlite3.connect(":memory:")
+con.create_function("md5", 1, md5sum)
+cur = con.cursor()
+cur.execute("select md5(?)", ("foo",))
+print cur.fetchone()[0]