def _mysqlType(self): # We need to map None in the enum expression to an appropriate # condition on NULL if None in self.enumValues: return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues if v is not None]) else: return "ENUM(%s) NOT NULL" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
def _firebirdType(self): length = max(map(len, self.enumValues)) enumValues = ', '.join([sqlbuilder.sqlrepr(v, 'firebird') for v in self.enumValues]) checkConstraint = "CHECK (%s in (%s))" % (self.dbName, enumValues) #NB. Return a tuple, not a string here return "VARCHAR(%i)" % (length), checkConstraint
def _postgresType(self): length = max(map(len, self.enumValues)) enumValues = ', '.join([sqlbuilder.sqlrepr(v, 'postgres') for v in self.enumValues]) checkConstraint = "CHECK (%s in (%s))" % (self.dbName, enumValues) return "VARCHAR(%i) %s" % (length, checkConstraint)
def _mysqlType(self): return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
def _mysqlType(self): return "ENUM(%s)" % ", ".join([sqlbuilder.sqlrepr(v, "mysql") for v in self.enumValues])
def _mysqlType(self): return "SET(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.setValues])