Back to index

python3.2  3.2.2
Classes | Functions | Variables
converter_point Namespace Reference

Classes

class  Point

Functions

def adapt_point
def convert_point

Variables

tuple p = Point(4.0, -3.2)
tuple con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES)
 1) Using declared types
tuple cur = con.cursor()

Function Documentation

def converter_point.adapt_point (   point)

Definition at line 10 of file converter_point.py.

00010 
00011 def adapt_point(point):
00012     return "%f;%f" % (point.x, point.y)

Definition at line 13 of file converter_point.py.

00013 
00014 def convert_point(s):
00015     x, y = list(map(float, s.split(";")))
00016     return Point(x, y)
00017 
00018 # Register the adapter
00019 sqlite3.register_adapter(Point, adapt_point)
00020 
00021 # Register the converter
00022 sqlite3.register_converter("point", convert_point)


Variable Documentation

tuple converter_point.con = sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES)

1) Using declared types

1) Using column names

Definition at line 27 of file converter_point.py.

tuple converter_point.cur = con.cursor()

Definition at line 28 of file converter_point.py.

tuple converter_point.p = Point(4.0, -3.2)

Definition at line 23 of file converter_point.py.