Comments (12)
I'm having the same issue on Python 2.6.5 32bit in Windows 7 64-bit and pymsql
version 1.0.2 with the following code:
cur.execute('update stuff...',data)
if not cur.rowcount:
cur.execute('insert stuff',data)
rowcount always returns 0. So after updating the row the code attempts to
insert a duplicate.
Original comment by [email protected]
on 8 Jul 2010 at 11:07
from pymssql.
It used to work on
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
>>> pymssql.__version__
'0.8.0'
Original comment by [email protected]
on 8 Jul 2010 at 11:09
from pymssql.
Yes this changed. An effective work around is to use cur._source.rows_affected
which will have the correct rows_affected.
Original comment by jason.s.holmes
on 20 Jul 2010 at 5:00
from pymssql.
sorry my above comment was incorrect. I mean
cursor._source._conn.rows_affected will reveal the correct number of rows
affected.
Original comment by jason.s.holmes
on 20 Jul 2010 at 6:14
from pymssql.
awesome, thanks for the quick update Jason, its immediately useful to us.
Original comment by [email protected]
on 21 Jul 2010 at 7:58
from pymssql.
According to Python Database API Specification v2.0
rowcount is supposed to contain the rows affected. I suppose since they
haven't released pymssql 2.0 yet it is still acceptable to claim DB-API 2.0
compliance. It sure makes migrating code to use pymssql 1.9.x difficult
however.
Original comment by jason.s.holmes
on 26 Jul 2010 at 11:18
from pymssql.
[deleted comment]
from pymssql.
This isn't working for me. Even on successful updates,
cursor._source._con._rows_affected is returning -1. Any suggestions?
Original comment by [email protected]
on 23 Aug 2010 at 8:09
from pymssql.
Personally, I'm switching to pyodbc. There are too many bugs in 1.0.2 and
1.9.x seems too far way.
Original comment by jason.s.holmes
on 23 Aug 2010 at 8:20
from pymssql.
I tried pyodbc. It doesn't really work on OS X and it's too much trouble to get
set up anyway (well, that's true of ODBC in any form)
Original comment by [email protected]
on 23 Aug 2010 at 10:14
from pymssql.
This is now fixed in r209.
$ python pymssqltest.py
INSERT 1
UPDATE 1
[(1, '*line1*')]
SELECT 1
DELETE 1
Original comment by [email protected]
on 2 Nov 2010 at 9:34
- Changed state: Fixed
from pymssql.
Excellent work damoxc.
Thanks dude.
Original comment by [email protected]
on 3 Nov 2010 at 3:41
from pymssql.
Related Issues (20)
- Failure to pass Unicode characters to callproc; failing test: tests.test_sprocs.TestCallProcFancy.testCallProcWithUnicodeStringWithRussianCharacters HOT 7
- When pymssql.connect() - DB-Lib error message 20002, severity 9;Adaptive Server connection failed HOT 1
- Fix test_config.py typos. HOT 1
- Small fix about TDS protocol version in a comment HOT 1
- Fix a small bug in SP tests HOT 3
- Fix SP name handling in threaded test so we can actually run it. HOT 2
- Feature for discussion (with patch): pymssql_shell HOT 2
- A few tests fail if running on a system that has SQL Server available on port 1433 HOT 1
- add function for getting FreeTDS version HOT 1
- datetime conversion to sql is not converting sub-seconds correctly HOT 5
- memory leaks (patches included) HOT 24
- pymssql-2.0.0b1-dev-20130403.tar.gz doesn't compile due to /usr/bin/ld: cannot find -lct HOT 8
- Installer issue HOT 1
- error: unrecognized command line option "-Wno-parentheses-equality" HOT 8
- pymssql.so: undefined symbol: __fread_chk HOT 5
- Support "with" statement (PEP 343) HOT 5
- Can't compile on OS X 10.8.4 HOT 10
- Review pymssql result processing code
- Make Cython not necessary when pymssql.c and _mssql.c are already present HOT 1
- IOError: [Errno 2] No such file or directory: 'ChangeLog_highlights.rst' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pymssql.