summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/dump.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-01-11 02:10:40 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-01-11 02:10:40 (GMT)
commit32851d61f2779b4fcefb92fa0a74f814a87211cb (patch)
tree33fd54e670a79121c4f9705283dd5805d5eb7317 /Lib/sqlite3/dump.py
parentbcd9971b0592946687d8aeb120efde5b8f5909e6 (diff)
downloadcpython-32851d61f2779b4fcefb92fa0a74f814a87211cb.zip
cpython-32851d61f2779b4fcefb92fa0a74f814a87211cb.tar.gz
cpython-32851d61f2779b4fcefb92fa0a74f814a87211cb.tar.bz2
#15109: revert '%'->'format' changes in 4b105d328fe7 to fix regression.
With '%', non-ascii worked because the '%' automatically got promoted to unicode. With format that doesn't happen, which led to encoding errors. This fix goes back to using %, and adds a test to make sure non-ascii string values work in iterdump.
Diffstat (limited to 'Lib/sqlite3/dump.py')
-rw-r--r--Lib/sqlite3/dump.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/sqlite3/dump.py b/Lib/sqlite3/dump.py
index de9c368..e5c5ef2 100644
--- a/Lib/sqlite3/dump.py
+++ b/Lib/sqlite3/dump.py
@@ -43,7 +43,7 @@ def _iterdump(connection):
# qtable,
# sql.replace("''")))
else:
- yield('{0};'.format(sql))
+ yield('%s;' % sql)
# Build the insert statement for each row of the current table
table_name_ident = table_name.replace('"', '""')
@@ -54,7 +54,7 @@ def _iterdump(connection):
",".join("""'||quote("{0}")||'""".format(col.replace('"', '""')) for col in column_names))
query_res = cu.execute(q)
for row in query_res:
- yield("{0};".format(row[0]))
+ yield("%s;" % row[0])
# Now when the type is 'index', 'trigger', or 'view'
q = """
@@ -65,6 +65,6 @@ def _iterdump(connection):
"""
schema_res = cu.execute(q)
for name, type, sql in schema_res.fetchall():
- yield('{0};'.format(sql))
+ yield('%s;' % sql)
yield('COMMIT;')