Project

General

Profile

« Previous | Next » 

Revision 2871

sql_gen.py: TypedCol: Added constraints instance var

View differences:

lib/sql_gen.py
567 567
##### Database structure
568 568

  
569 569
class TypedCol(Col):
570
    def __init__(self, name, type_, default=None, nullable=True):
570
    def __init__(self, name, type_, default=None, nullable=True,
571
        constraints=None):
571 572
        assert default == None or isinstance(default, Code)
572 573
        
573 574
        Col.__init__(self, name)
......
575 576
        self.type = type_
576 577
        self.default = default
577 578
        self.nullable = nullable
579
        self.constraints = constraints
578 580
    
579 581
    def to_str(self, db):
580 582
        str_ = Col.to_str(self, db)+' '+self.type
581 583
        if not self.nullable: str_ += ' NOT NULL'
582 584
        if self.default != None: str_ += ' DEFAULT '+self.default.to_str(db)
585
        if self.constraints != None: str_ += ' '+self.constraints
583 586
        return str_
584 587
    
585 588
    def to_Col(self): return Col(self.name)

Also available in: Unified diff