source:
trunk/essentials/dev-lang/python/Doc/lib/sqlite3/md5func.py
| Last change on this file was 3225, checked in by , 19 years ago | |
|---|---|
| File size: 231 bytes | |
| Line | |
|---|---|
| 1 | import sqlite3 |
| 2 | import md5 |
| 3 | |
| 4 | def md5sum(t): |
| 5 | return md5.md5(t).hexdigest() |
| 6 | |
| 7 | con = sqlite3.connect(":memory:") |
| 8 | con.create_function("md5", 1, md5sum) |
| 9 | cur = con.cursor() |
| 10 | cur.execute("select md5(?)", ("foo",)) |
| 11 | print cur.fetchone()[0] |
Note:
See TracBrowser
for help on using the repository browser.
