handle conversion of None to null
This commit is contained in:
parent
f2d36f0d04
commit
dcb0287a79
@ -137,10 +137,13 @@ class SqlDumpEmitter(Emitter):
|
|||||||
table_name, '`,`'.join(fieldnames))
|
table_name, '`,`'.join(fieldnames))
|
||||||
|
|
||||||
def quote(self, item):
|
def quote(self, item):
|
||||||
if not isinstance(item, ('unicode','str')):
|
if item is None:
|
||||||
return "%s" % item
|
return "null"
|
||||||
|
elif isinstance(item, (unicode, str)):
|
||||||
item = item.replace("\\","\\\\").replace("'","\\'").replace(chr(0),'0')
|
item = item.replace("\\","\\\\").replace("'","\\'").replace(chr(0),'0')
|
||||||
return "'%s'" % item
|
return "'%s'" % item
|
||||||
|
else:
|
||||||
|
return "%s" % item
|
||||||
|
|
||||||
def emit_record(self, record):
|
def emit_record(self, record):
|
||||||
quoted_data = [self.quote(record[field]) for field in self._fieldnames]
|
quoted_data = [self.quote(record[field]) for field in self._fieldnames]
|
||||||
|
Loading…
Reference in New Issue
Block a user