FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Doc/includes/sqlite3/collation_reverse.py at 3.7 · python-emscripten/cpython · GitHub
python-emscripten
cpython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Doc
/
includes
/
sqlite3
/
collation_reverse.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (17 loc) · 484 Bytes
Breadcrumbs
cpython
/
Doc
/
includes
/
sqlite3
/
collation_reverse.py
Copy path
File metadata and controls
20 lines (17 loc) · 484 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import
sqlite3
def
collate_reverse
(
string1
,
string2
):
if
string1
==
string2
:
return
0
elif
string1
<
string2
:
return
1
else
:
return
-
1
con
=
sqlite3
.
connect
(
":memory:"
)
con
.
create_collation
(
"reverse"
,
collate_reverse
)
cur
=
con
.
cursor
()
cur
.
execute
(
"create table test(x)"
)
cur
.
executemany
(
"insert into test(x) values (?)"
, [(
"a"
,), (
"b"
,)])
cur
.
execute
(
"select x from test order by x collate reverse"
)
for
row
in
cur
:
print
(
row
)
con
.
close
()
Back
|
FazBrowse Home
|
New Git URL