def _execute_raise_permission_denied(self, cursor, parameters, keepdb=False): error = DatabaseError('permission denied to create database') error.pgcode = errorcodes.INSUFFICIENT_PRIVILEGE raise DatabaseError() from error
def _execute_raise_database_already_exists(self, cursor, parameters, keepdb=False): error = DatabaseError('database %s already exists' % parameters['dbname']) error.pgcode = errorcodes.DUPLICATE_DATABASE raise DatabaseError() from error
def _execute_raise_insufficient_privileges(self, cursor, statements, parameters, verbosity, allow_quiet_fail=False): raise DatabaseError("ORA-01031: insufficient privileges")
def _execute_raise_tablespace_already_exists(self, cursor, statements, parameters, verbosity, allow_quiet_fail=False): raise DatabaseError("ORA-01543: tablespace 'string' already exists")
def fetch_returned_insert_id(self, cursor): try: return int(cursor._insert_id_var.getvalue()) except (IndexError, TypeError): # cx_Oracle < 6.3 returns None, >= 6.3 raises IndexError. raise DatabaseError( 'The database did not return a new row id. Probably "ORA-1403: ' 'no data found" was raised internally but was hidden by the ' 'Oracle OCI library (see https://code.djangoproject.com/ticket/28859).' )
def _execute_raise_user_already_exists(self, cursor, statements, parameters, verbosity, allow_quiet_fail=False): # Raise "user already exists" only in test user creation if statements and statements[0].startswith('CREATE USER'): raise DatabaseError( "ORA-01920: user name 'string' conflicts with another user or role name" )
def validate_thread_sharing(self): """ Validate that the connection isn't accessed by another thread than the one which originally created it, unless the connection was explicitly authorized to be shared between threads (via the `allow_thread_sharing` property). Raise an exception if the validation fails. """ if not (self.allow_thread_sharing or self._thread_ident == _thread.get_ident()): raise DatabaseError( "DatabaseWrapper objects created in a " "thread can only be used in that same thread. The object " "with alias '%s' was created in thread id %s and this is " "thread id %s." % (self.alias, self._thread_ident, _thread.get_ident()))
def _execute_raise_access_denied(self, cursor, parameters, keepdb=False): raise DatabaseError(1044, "Access denied for user")
def _execute_raise_database_exists(self, cursor, parameters, keepdb=False): raise DatabaseError( 1007, "Can't create database '%s'; database exists" % parameters['dbname'])