[issue35398] SQLite incorrect row count for UPDATE

2021-08-11 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

See also bpo-36859.

--
nosy: +erlendaasland

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2019-05-11 Thread Berker Peksag


Change by Berker Peksag :


--
nosy: +berker.peksag

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-04 Thread Montana Low


Montana Low  added the comment:

I took a stab at patch. It fixes the issue for me, as proven via the Test Case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-04 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +10152
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Did some debugging here. If I am understanding this correctly the rowcount is 
set at 
https://github.com/python/cpython/blob/b8e689a6e8134e88f857a55e50b6a4977967e385/Modules/_sqlite/cursor.c#L574
 . It checks for is_dml flag that is set here 
https://github.com/python/cpython/blob/b8e689a6e8134e88f857a55e50b6a4977967e385/Modules/_sqlite/statement.c#L78

The part to set is_dml skips space, tabs and newline and checks for the first 
set of characters that is not skipped to be insert, update, delete or replace 
and in this case the first set of characters to be matched will be "/* 
watermarking */". Thus with comment not matching, is_dml is not set and -1 is 
set for the rowcount.

--
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-04 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
nosy: +lys.nikolaou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-04 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +ghaering, xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-03 Thread mike bayer


Change by mike bayer :


--
nosy: +zzzeek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-03 Thread Montana Low


New submission from Montana Low :

SQLite driver returns an incorrect row count (-1) for UPDATE statements that 
begin with a comment.

Downstream Reference:
https://github.com/sqlalchemy/sqlalchemy/issues/4396


Test Case:

```
import sqlite3

conn = sqlite3.connect(":memory:")

cursor = conn.cursor()

cursor.execute("""
CREATE TABLE foo (
id INTEGER NOT NULL,
updated_at DATETIME,
PRIMARY KEY (id)
)
""")

cursor.execute("""
/* watermarking bug */
INSERT INTO foo (id, updated_at) VALUES (?, ?)
""", [1, None])


cursor.execute("""
UPDATE foo SET updated_at=? WHERE foo.id = ?
""", ('2018-12-02 14:55:57.169785', 1))

assert cursor.rowcount == 1

cursor.execute("""
/* watermarking bug */
UPDATE foo SET updated_at=? WHERE foo.id = ?
""", ('2018-12-03 14:55:57.169785', 1))

assert cursor.rowcount == 1
```

--
components: Library (Lib)
messages: 331006
nosy: Montana Low
priority: normal
severity: normal
status: open
title: SQLite incorrect row count for UPDATE
versions: Python 2.7, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com