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
86a67054
Kaydet (Commit)
86a67054
authored
Mar 03, 2017
tarafından
Aviv Palivoda
Kaydeden (comit)
Berker Peksag
Mar 03, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-9303: Migrate sqlite3 module to _v2 API to enhance performance (#359)
üst
15aa4c88
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
9 deletions
+30
-9
NEWS
Misc/NEWS
+2
-0
connection.c
Modules/_sqlite/connection.c
+7
-5
cursor.c
Modules/_sqlite/cursor.c
+3
-1
statement.c
Modules/_sqlite/statement.c
+2
-2
util.c
Modules/_sqlite/util.c
+4
-1
util.h
Modules/_sqlite/util.h
+12
-0
No files found.
Misc/NEWS
Dosyayı görüntüle @
86a67054
...
@@ -259,6 +259,8 @@ Extension Modules
...
@@ -259,6 +259,8 @@ Extension Modules
Library
Library
-------
-------
-
bpo
-
9303
:
Migrate
sqlite3
module
to
_v2
API
.
Patch
by
Aviv
Palivoda
.
-
bpo
-
28963
:
Fix
out
of
bound
iteration
in
asyncio
.
Future
.
remove_done_callback
-
bpo
-
28963
:
Fix
out
of
bound
iteration
in
asyncio
.
Future
.
remove_done_callback
implemented
in
C
.
implemented
in
C
.
...
...
Modules/_sqlite/connection.c
Dosyayı görüntüle @
86a67054
...
@@ -118,6 +118,8 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
...
@@ -118,6 +118,8 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject
return
-
1
;
return
-
1
;
}
}
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
/* No need to use sqlite3_open_v2 as sqlite3_open(filename, db) is the
same as sqlite3_open_v2(filename, db, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, NULL). */
rc
=
sqlite3_open
(
database
,
&
self
->
db
);
rc
=
sqlite3_open
(
database
,
&
self
->
db
);
#endif
#endif
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
...
@@ -241,7 +243,7 @@ void pysqlite_connection_dealloc(pysqlite_Connection* self)
...
@@ -241,7 +243,7 @@ void pysqlite_connection_dealloc(pysqlite_Connection* self)
/* Clean up if user has not called .close() explicitly. */
/* Clean up if user has not called .close() explicitly. */
if
(
self
->
db
)
{
if
(
self
->
db
)
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
sqlite3_close
(
self
->
db
);
SQLITE3_CLOSE
(
self
->
db
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
}
}
...
@@ -334,7 +336,7 @@ PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args)
...
@@ -334,7 +336,7 @@ PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args)
if
(
self
->
db
)
{
if
(
self
->
db
)
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rc
=
sqlite3_close
(
self
->
db
);
rc
=
SQLITE3_CLOSE
(
self
->
db
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
if
(
rc
!=
SQLITE_OK
)
{
if
(
rc
!=
SQLITE_OK
)
{
...
@@ -375,7 +377,7 @@ PyObject* _pysqlite_connection_begin(pysqlite_Connection* self)
...
@@ -375,7 +377,7 @@ PyObject* _pysqlite_connection_begin(pysqlite_Connection* self)
sqlite3_stmt
*
statement
;
sqlite3_stmt
*
statement
;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rc
=
sqlite3_prepare
(
self
->
db
,
self
->
begin_statement
,
-
1
,
&
statement
,
&
tail
);
rc
=
SQLITE3_PREPARE
(
self
->
db
,
self
->
begin_statement
,
-
1
,
&
statement
,
&
tail
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
if
(
rc
!=
SQLITE_OK
)
{
if
(
rc
!=
SQLITE_OK
)
{
...
@@ -417,7 +419,7 @@ PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args)
...
@@ -417,7 +419,7 @@ PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args)
if
(
!
sqlite3_get_autocommit
(
self
->
db
))
{
if
(
!
sqlite3_get_autocommit
(
self
->
db
))
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rc
=
sqlite3_prepare
(
self
->
db
,
"COMMIT"
,
-
1
,
&
statement
,
&
tail
);
rc
=
SQLITE3_PREPARE
(
self
->
db
,
"COMMIT"
,
-
1
,
&
statement
,
&
tail
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
if
(
rc
!=
SQLITE_OK
)
{
if
(
rc
!=
SQLITE_OK
)
{
_pysqlite_seterror
(
self
->
db
,
NULL
);
_pysqlite_seterror
(
self
->
db
,
NULL
);
...
@@ -460,7 +462,7 @@ PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args
...
@@ -460,7 +462,7 @@ PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args
pysqlite_do_all_statements
(
self
,
ACTION_RESET
,
1
);
pysqlite_do_all_statements
(
self
,
ACTION_RESET
,
1
);
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rc
=
sqlite3_prepare
(
self
->
db
,
"ROLLBACK"
,
-
1
,
&
statement
,
&
tail
);
rc
=
SQLITE3_PREPARE
(
self
->
db
,
"ROLLBACK"
,
-
1
,
&
statement
,
&
tail
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
if
(
rc
!=
SQLITE_OK
)
{
if
(
rc
!=
SQLITE_OK
)
{
_pysqlite_seterror
(
self
->
db
,
NULL
);
_pysqlite_seterror
(
self
->
db
,
NULL
);
...
...
Modules/_sqlite/cursor.c
Dosyayı görüntüle @
86a67054
...
@@ -548,8 +548,10 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
...
@@ -548,8 +548,10 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
/* If it worked, let's get out of the loop */
/* If it worked, let's get out of the loop */
break
;
break
;
}
}
#if SQLITE_VERSION_NUMBER < 3003009
/* Something went wrong. Re-set the statement and try again. */
/* Something went wrong. Re-set the statement and try again. */
rc
=
pysqlite_statement_reset
(
self
->
statement
);
rc
=
pysqlite_statement_reset
(
self
->
statement
);
#endif
if
(
rc
==
SQLITE_SCHEMA
)
{
if
(
rc
==
SQLITE_SCHEMA
)
{
/* If this was a result of the schema changing, let's try
/* If this was a result of the schema changing, let's try
again. */
again. */
...
@@ -706,7 +708,7 @@ PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
...
@@ -706,7 +708,7 @@ PyObject* pysqlite_cursor_executescript(pysqlite_Cursor* self, PyObject* args)
while
(
1
)
{
while
(
1
)
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rc
=
sqlite3_prepare
(
self
->
connection
->
db
,
rc
=
SQLITE3_PREPARE
(
self
->
connection
->
db
,
script_cstr
,
script_cstr
,
-
1
,
-
1
,
&
statement
,
&
statement
,
...
...
Modules/_sqlite/statement.c
Dosyayı görüntüle @
86a67054
...
@@ -93,7 +93,7 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con
...
@@ -93,7 +93,7 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con
}
}
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rc
=
sqlite3_prepare
(
connection
->
db
,
rc
=
SQLITE3_PREPARE
(
connection
->
db
,
sql_cstr
,
sql_cstr
,
-
1
,
-
1
,
&
self
->
st
,
&
self
->
st
,
...
@@ -334,7 +334,7 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params)
...
@@ -334,7 +334,7 @@ int pysqlite_statement_recompile(pysqlite_Statement* self, PyObject* params)
}
}
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
rc
=
sqlite3_prepare
(
self
->
db
,
rc
=
SQLITE3_PREPARE
(
self
->
db
,
sql_cstr
,
sql_cstr
,
-
1
,
-
1
,
&
new_st
,
&
new_st
,
...
...
Modules/_sqlite/util.c
Dosyayı görüntüle @
86a67054
...
@@ -49,10 +49,13 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st)
...
@@ -49,10 +49,13 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st)
{
{
int
errorcode
;
int
errorcode
;
/* SQLite often doesn't report anything useful, unless you reset the statement first */
#if SQLITE_VERSION_NUMBER < 3003009
/* SQLite often doesn't report anything useful, unless you reset the statement first.
When using sqlite3_prepare_v2 this is not needed. */
if
(
st
!=
NULL
)
{
if
(
st
!=
NULL
)
{
(
void
)
sqlite3_reset
(
st
);
(
void
)
sqlite3_reset
(
st
);
}
}
#endif
errorcode
=
sqlite3_errcode
(
db
);
errorcode
=
sqlite3_errcode
(
db
);
...
...
Modules/_sqlite/util.h
Dosyayı görüntüle @
86a67054
...
@@ -39,4 +39,16 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st);
...
@@ -39,4 +39,16 @@ int _pysqlite_seterror(sqlite3* db, sqlite3_stmt* st);
PyObject
*
_pysqlite_long_from_int64
(
sqlite_int64
value
);
PyObject
*
_pysqlite_long_from_int64
(
sqlite_int64
value
);
sqlite_int64
_pysqlite_long_as_int64
(
PyObject
*
value
);
sqlite_int64
_pysqlite_long_as_int64
(
PyObject
*
value
);
#if SQLITE_VERSION_NUMBER >= 3003009
#define SQLITE3_PREPARE sqlite3_prepare_v2
#else
#define SQLITE3_PREPARE sqlite3_prepare
#endif
#if SQLITE_VERSION_NUMBER >= 3007014
#define SQLITE3_CLOSE sqlite3_close_v2
#else
#define SQLITE3_CLOSE sqlite3_close
#endif
#endif
#endif
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