Project

General

Profile

« Previous | Next » 

Revision 2523

sql.py: Added MissingCastException and parse it in run_query()

View differences:

lib/sql.py
53 53
        self.name = name
54 54
        self.cols = cols
55 55

  
56
class MissingCastException(DbException):
57
    def __init__(self, type_, col, cause=None):
58
        DbException.__init__(self, 'Missing cast to type '+strings.as_tt(type_)
59
            +' on column: '+strings.as_tt(col), cause)
60
        self.type = type_
61
        self.col = col
62

  
56 63
class NameException(DbException): pass
57 64

  
58 65
class DuplicateKeyException(ConstraintException): pass
......
387 394
                value, name = match.groups()
388 395
                raise FunctionValueException(name, strings.to_unicode(value), e)
389 396
            
397
            match = re.search(r'column "(.+?)" is of type (\S+) but expression '
398
                r'is of type', msg)
399
            if match:
400
                col, type_ = match.groups()
401
                raise MissingCastException(type_, col, e)
402
            
390 403
            match = re.search(r'relation "(.+?)" already exists', msg)
391 404
            if match: raise DuplicateTableException(match.group(1), e)
392 405
            

Also available in: Unified diff