changeset 1 | 2fb8b9db1c86 |
0:ffa851df0825 | 1:2fb8b9db1c86 |
---|---|
1 import sqlite3 |
|
2 |
|
3 class Point(object): |
|
4 def __init__(self, x, y): |
|
5 self.x, self.y = x, y |
|
6 |
|
7 def __conform__(self, protocol): |
|
8 if protocol is sqlite3.PrepareProtocol: |
|
9 return "%f;%f" % (self.x, self.y) |
|
10 |
|
11 con = sqlite3.connect(":memory:") |
|
12 cur = con.cursor() |
|
13 |
|
14 p = Point(4.0, -3.2) |
|
15 cur.execute("select ?", (p,)) |
|
16 print cur.fetchone()[0] |