mysqldb - parameter issue

bruce badouglas at gmail.com
Wed Aug 11 11:08:21 EDT 2010


hi...

using python v2.6, using the mysqldb lib

the test tbl looks like:
DROP TABLE IF EXISTS `functionError_TBL`;
CREATE TABLE `functionError_TBL` (
  `parentFunction` varchar(100) NOT NULL default '',
  `currentFunction` varchar(100) NOT NULL default '',
  `parentFunctionID` int(10) NOT NULL default 0,
  `errorStatus` int(1) NOT NULL default 0,
  `clientServerUUID` varchar(100) NOT NULL default '',
  `processTime` timestamp NOT NULL default 0,
  `CollegeID` int(10) NOT NULL default 0,
  `CrawlID` varchar(200) NOT NULL default '',
  `CollegeName` varchar(200) NOT NULL default '',
  `CollegeAbbrv` varchar(200) NOT NULL default '',
  .
  .

the test script looks like
  .
  .
  tlist= [(1, 1, 1281502771)]

  ins="insert into functionError_TBL "
  ins=ins+"(errorStatus, CollegeID, processTime)"
  ins=ins+" values "
  ins=ins+"  (%s,%s,  from_unixtime(%s))"
  db.executemany (ins, tlist)


if the parameter is :
 (%s,%s,  from_unixtime(%s))"

it appears to work, data is inserted correctly...

if the parameters are changed to
(%s,from_unixtime(%s), %s)"

along with the corresponding insert portion, and the test list, an
error is generated..

this implies that something is going on with the use of the
"from_unixtime" that i don't fully understand..

thoughts/pointers/comments...

thanks


thoughts on how to resolve this would be greatly appreciated.

thanks



More information about the Python-list mailing list