Marcin Jurczuk <mj*******@tkb.pl> wrote in message news:<cg*********@korweta.task.gda.pl>...
Hello group.
Could someone descripe how to delete many row at one time
from MySQL database using SkunkWeb PyDO pacgage ??
Documentation is very short about that ...
Assume that Base is class define like in PyDO doc, so
Base.new(...) adds new row..
Documetation show ony delete() without any arguments.
SQL query is like "DELETE FROM SESSIONS WHERE acc_time < '398984353'"
I just came across this by accident; PyDO questions are better asked
on the skunkweb mailing list.
But to answer it quickly -- the delete() method deletes a particular
instance (one row). If you want delete a range of rows with a single
SQL statement, the best way is simply to use SQL, accessing the
underlying db connection:
c=Sessions.getDBI().conn.cursor()
c.execute("DELETE FROM SESSIONS WHERE acc_time < '333333'")
# this is equivalent to Sessions.getDBI().conn.commit()
Sessions.commit()
Hope that helps,
Jacob Smullyan