Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 31st, 2004, 06:43 AM
mohikan mohikan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 36 mohikan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 54 m 43 sec
Reputation Power: 5
Send a message via ICQ to mohikan
mysql affected rows

how can I learn affected rows after a query with python ?

I am using MySQLdb for included. does it support the function which like mysql_affected_rows like php ?

best regards

Reply With Quote
  #2  
Old August 1st, 2004, 06:27 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 2 m 16 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Yes, there's a method called affectedrows() which should do what you want. You can see an example/semi-explanation of this here.

Hope this helps,

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #3  
Old August 2nd, 2004, 04:18 AM
mohikan mohikan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 36 mohikan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 54 m 43 sec
Reputation Power: 5
Send a message via ICQ to mohikan
it doesn't work

thank you mark,

but the sample for python 1.5.1 and I am using 2.3.4
and MySQLdb

accessing mysql in the sample is very well for me .
because it like php

importing mysql begin of the code, not mysqldb.

this mysql module is different from mysqldb or it is old version of mysqldb.


regards

Reply With Quote
  #4  
Old August 2nd, 2004, 08:24 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 2 m 16 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Sorry, i hadnt expected them to change the interface . Silly me. Anyway, this page: http://phplens.com/lens/adodb/adodb-py-docs.htm seems to think that you can use th Affected_Rows() method. Wether or not this is true i dont know.

Ill install MySQLdb and let you know. I really need to learn how to build MySQL on Unix anyway .

Mark.

Reply With Quote
  #5  
Old August 2nd, 2004, 10:07 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 2 m 16 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Ok, scratch that. After installing MySQL 4.0.20 and MySQLdb 1.0.0 on my IBook you can clearly see that the method is called affected_rows()... Which prompts me to say, STOP changing the name guys .

Quote:
>>> dir(connection)
['DataError', 'DatabaseError', 'Error', 'IntegrityError', 'InterfaceError', 'InternalError', 'NotSupportedError', 'OperationalError', 'ProgrammingError', 'Warning', '__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', '_make_connection', '_transactional', 'affected_rows', 'begin', 'change_user', 'character_set_name', 'client_flag', 'close', 'commit', 'converter', 'cursor', 'cursorclass', 'default_cursor', 'dump_debug_info', 'errno', 'error', 'errorhandler', 'escape', 'escape_string', 'field_count', 'get_host_info', 'get_proto_info', 'get_server_info', 'info', 'insert_id', 'kill', 'literal', 'messages', 'open', 'ping', 'port', 'query', 'rollback', 'select_db', 'server_capabilities', 'shutdown', 'stat', 'store_result', 'string_literal', 'thread_id', 'unicode_literal', 'use_result']
>>>


So in theory that should do it .

Take care,

Mark.

Reply With Quote
  #6  
Old August 3rd, 2004, 02:13 AM
mohikan mohikan is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 36 mohikan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 54 m 43 sec
Reputation Power: 5
Send a message via ICQ to mohikan
it works

thanks mark,

it works.
I tried it yesterday but I couldn't find affected_rows function
because I guess I should be try to dir(result)
but I have to check dir(connection)

whatever, I write script to help me.
it works like that,

it take functions about a value and docs and write to screen with for ,

aa = dir(value)
for a in aa:
print a, "\n help : \n", a.__doc__ , "\n\n"


something like that.
I can see which functions I can use with my variables.
but I dont know yet how can I add this script to under site-packages

if I can add a python module, I can call it everytime when I need it like a function.


thanks again, mohikan

Reply With Quote
  #7  
Old August 3rd, 2004, 11:13 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 2 m 16 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Im a little comfused, nothing new there . It is working though right?

If you want to add a script to site-packages just save the file and move it into the site-packages directory. You should then be able to import it without any problems.

Mark.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > mysql affected rows


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway