Example #1
0
 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])
Example #2
0
 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
Example #3
0
 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)
Example #4
0
 def _mysqlType(self):
     return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues])
Example #5
0
 def _mysqlType(self):
     return "ENUM(%s)" % ", ".join([sqlbuilder.sqlrepr(v, "mysql") for v in self.enumValues])
Example #6
0
 def _mysqlType(self):
     return "SET(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.setValues])