server/schema2sql.py
changeset 10671 e08102f45237
parent 10481 6ac4b1726e9f
child 11003 53820b08a723
equal deleted inserted replaced
10670:96380c1524b0 10671:e08102f45237
   160         # XXX more quoting for literals?
   160         # XXX more quoting for literals?
   161         return value
   161         return value
   162 
   162 
   163 def check_constraint(eschema, aschema, attr, constraint, dbhelper, prefix=''):
   163 def check_constraint(eschema, aschema, attr, constraint, dbhelper, prefix=''):
   164     # XXX should find a better name
   164     # XXX should find a better name
   165     cstrname = 'cstr' + md5(eschema.type + attr + constraint.type() +
   165     cstrname = 'cstr' + md5((eschema.type + attr + constraint.type() +
   166                             (constraint.serialize() or '')).hexdigest()
   166                              (constraint.serialize() or '')).encode('ascii')).hexdigest()
   167     if constraint.type() == 'BoundaryConstraint':
   167     if constraint.type() == 'BoundaryConstraint':
   168         value = as_sql(constraint.boundary, dbhelper, prefix)
   168         value = as_sql(constraint.boundary, dbhelper, prefix)
   169         return cstrname, '%s%s %s %s' % (prefix, attr, constraint.operator, value)
   169         return cstrname, '%s%s %s %s' % (prefix, attr, constraint.operator, value)
   170     elif constraint.type() == 'IntervalBoundConstraint':
   170     elif constraint.type() == 'IntervalBoundConstraint':
   171         condition = []
   171         condition = []