source: python/trunk/Doc/includes/sqlite3/collation_reverse.py

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 400 bytes
Line 
1import sqlite3
2
3def collate_reverse(string1, string2):
4 return -cmp(string1, string2)
5
6con = sqlite3.connect(":memory:")
7con.create_collation("reverse", collate_reverse)
8
9cur = con.cursor()
10cur.execute("create table test(x)")
11cur.executemany("insert into test(x) values (?)", [("a",), ("b",)])
12cur.execute("select x from test order by x collate reverse")
13for row in cur:
14 print row
15con.close()
Note: See TracBrowser for help on using the repository browser.