From 7a846cf5e35ebcad852309aebaa0bac8a7244744 Mon Sep 17 00:00:00 2001 From: Evax Software Date: Thu, 4 Oct 2012 13:34:39 -0400 Subject: Allow pip install from git Merged with modifications from https://github.com/evax/MySQLdb1/commit/a8152690101733904b16a32ff8467220ca07242c --- _mysql_exceptions.py | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 _mysql_exceptions.py (limited to '_mysql_exceptions.py') diff --git a/_mysql_exceptions.py b/_mysql_exceptions.py new file mode 100644 index 0000000..3241e74 --- /dev/null +++ b/_mysql_exceptions.py @@ -0,0 +1,87 @@ +"""_mysql_exceptions: Exception classes for _mysql and MySQLdb. + +These classes are dictated by the DB API v2.0: + + http://www.python.org/topics/database/DatabaseAPI-2.0.html +""" + +try: + from exceptions import Exception, StandardError, Warning +except ImportError: + # Python 3 + StandardError = Exception + + +class MySQLError(StandardError): + + """Exception related to operation with MySQL.""" + + +class Warning(Warning, MySQLError): + + """Exception raised for important warnings like data truncations + while inserting, etc.""" + +class Error(MySQLError): + + """Exception that is the base class of all other error exceptions + (not Warning).""" + + +class InterfaceError(Error): + + """Exception raised for errors that are related to the database + interface rather than the database itself.""" + + +class DatabaseError(Error): + + """Exception raised for errors that are related to the + database.""" + + +class DataError(DatabaseError): + + """Exception raised for errors that are due to problems with the + processed data like division by zero, numeric value out of range, + etc.""" + + +class OperationalError(DatabaseError): + + """Exception raised for errors that are related to the database's + operation and not necessarily under the control of the programmer, + e.g. an unexpected disconnect occurs, the data source name is not + found, a transaction could not be processed, a memory allocation + error occurred during processing, etc.""" + + +class IntegrityError(DatabaseError): + + """Exception raised when the relational integrity of the database + is affected, e.g. a foreign key check fails, duplicate key, + etc.""" + + +class InternalError(DatabaseError): + + """Exception raised when the database encounters an internal + error, e.g. the cursor is not valid anymore, the transaction is + out of sync, etc.""" + + +class ProgrammingError(DatabaseError): + + """Exception raised for programming errors, e.g. table not found + or already exists, syntax error in the SQL statement, wrong number + of parameters specified, etc.""" + + +class NotSupportedError(DatabaseError): + + """Exception raised in case a method or database API was used + which is not supported by the database, e.g. requesting a + .rollback() on a connection that does not support transaction or + has transactions turned off.""" + + -- cgit v1.2.1