MySQLdb question
Karl Young
karly at kipshouse.org
Thu Jan 26 23:27:51 UTC 2017
DTD(doug at safeport.com)@2017.01.26 13:23:56 -0500:
> I am using py27-MySQLdb-1.2.5 (the default) for FreeBSD 10.3
>
> cmd="update ipv4 set s8='%s',s16='%s',s24='%s' where ip='%s'" % (s8,s16,s24,row[0])
> c.execute(cmd)
When you say that it isn't working, I assume you mean it's not updating
any rows? To see if that's the case, you can assign the return from
execute and print the result, and print it out.
numrows = c.execute(cmd)
print numrows
Or use the rowcount attr of the cursor
print c.rowcount
If it's showing 0 rows, try running select where
select * where ip='1.186.248.251
Is it possible you're connecting to a different host/db than you're
using for your manual SQL?
-karl
>
> does not work. I actually used try/except. It does not throw an error
>
> cmd=update ipv4 set s8='1.',s16='1.186.',s24='1.186.248.' where ip='1.186.248.251'
>
> is a valid statement and works. It just does not work through
> execute. I also tried appending a ';' to cmd
>
> Thanks for any help/thoughts
>
> _____
> Douglas Denault
> http://www.safeport.com
> doug at safeport.com
> Voice: 301-217-9220
> Fax: 301-217-9277
> _______________________________________________
> freebsd-python at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-python
> To unsubscribe, send any mail to "freebsd-python-unsubscribe at freebsd.org"
More information about the freebsd-python
mailing list