[Tutor] mysql formatting

Marilyn Davis marilyn at deliberate.com
Wed Nov 3 00:46:05 CET 2004


Can you folks please help me some more?

I'm having a trouble, now that I'm really trying to implement what I
learned yesterday.

Here's the error:

_mysql_exceptions.ProgrammingError: (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'\'doorman\' set status = "\'MOVED\'" where in_id = \'60\' and out_address like "%\'wrgf\' at line 1')


Here's my code:

     def execute_mysql(self, this, *args):
         if log.level & log.sql:
             log.it('About to execute:' + this + '<-->' + repr(args))
         try:
             self.cursor.execute(this, args)
         except _mysql_exceptions.Warning, msg:
             log.it('Mysql Warning: ' + str(msg))
         except _mysql_exceptions.OperationalError, msg:
             print "Are you using the right data base?  Try changing /b/local/doorman/configure.py TESTING = 0"
             raise

And from my log:

   About to execute:update %s set status = "%s" where in_id = %s and out_address like "%%%s%%"<-->('doorman', 'MOVED', '60', 'wrgfgtfdpmrwe at hewpwbpsk.rashpie.com')

Why am I getting those extra \' thingies?

Thank you so much!

Marilyn





More information about the Tutor mailing list