Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3ef21cb7
Kaydet (Commit)
3ef21cb7
authored
Eki 18, 2007
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
üst
f8a2a0b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
dbtables.py
Lib/bsddb/dbtables.py
+6
-5
No files found.
Lib/bsddb/dbtables.py
Dosyayı görüntüle @
3ef21cb7
...
...
@@ -360,12 +360,13 @@ class bsdTableDB :
unique
=
0
while
not
unique
:
# Generate a random 64-bit row ID string
# (note: this code has <
56
bits of randomness
# (note: this code has <
64
bits of randomness
# but it's plenty for our database id needs!)
# The | 0x01010101 is to ensure no null bytes are in the value
newid
=
struct
.
pack
(
'll'
,
random
.
randint
(
0
,
2147483647
)
|
0x01010101
,
random
.
randint
(
0
,
2147483647
)
|
0x01010101
)
# We must ensure that no null bytes are in the id value.
blist
=
[]
for
x
in
xrange
(
_rowid_str_len
):
blist
.
append
(
random
.
randint
(
1
,
255
))
newid
=
struct
.
pack
(
'B'
*
_rowid_str_len
,
*
blist
)
# Guarantee uniqueness by adding this key to the database
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment