~geertjmvdk/+junk/myconnpy-buildbot

« back to all changes in this revision

Viewing changes to py3k/mysql/connector/cursor.py

  • Committer: Geert Vanderkelen
  • Date: 2010-01-25 17:15:07 UTC
  • Revision ID: geert.vanderkelen@sun.com-20100125171507-7xdivm5d4lwu1luw
Adding MySQL server errors and better exceptions (part 1)

* We try to raise appropriate exceptions based on the server errno we get
using the errors.raise_mysql_error()-method.
* Adding server side errno: this will take time to sort out (lots of them!)
* Updating test cases with new exceptions being thrown.

Show diffs side-by-side

added added

removed removed

Lines of Context:
318
318
        
319
319
        try:
320
320
            if params is not None:
321
 
                stmt = operation % self._process_params(params)
 
321
                try:
 
322
                    stmt = operation % self._process_params(params)
 
323
                except TypeError:
 
324
                    raise errors.ProgrammingError(
 
325
                        "Wrong number of arguments during string formatting")
322
326
            else:
323
327
                stmt = operation
324
328
            stmt = stmt.encode(self.db.charset_name)
332
336
                self.db.unread_result = True
333
337
                self._have_result = True
334
338
                self._handle_resultset()
335
 
        except errors.Error:
 
339
        except errors.Error as e:
 
340
            errors.raise_mysql_error(e.errno,e)
336
341
            raise
337
342
        except Exception as e:
338
343
            raise errors.InterfaceError(