修改了插入数据时发生错误时输出错误sql语句
修改了插入数据时字符串数据‘号的问题
diff --git a/v2convert.py b/v2convert.py
index d23a210..218a5fa 100755
--- a/v2convert.py
+++ b/v2convert.py
@@ -12,7 +12,7 @@
 import re

 

 

-VERSION = "1.4"

+VERSION = "1.5"

 SYSENCODING = locale.getdefaultlocale()[1]

 

 if not SYSENCODING:

@@ -111,7 +111,7 @@
             self._dst_db = self._connect_db(self._dst_type, **param)

             print u"连接目标库成功"

         except Exception, ex:

-            print u"连接数据失败, {0}".format(ex)

+            print u"连接数据失败, {0}".format(str(ex).decode('utf-8'))

             return

 

         self._convert()

@@ -202,19 +202,21 @@
                 elif isinstance(data, float):

                     v.append('%f' % data)

                 elif isinstance(data, str) or isinstance(data, unicode):

-                    v.append("'{0}'".format(data))

+                    v.append("'{0}'".format(data.replace("'", "''")))

                 elif data is None:

                     v.append('NULL')

                 else:

                     v.append(data)

             values = ",".join(v)

-            insert_sql = 'insert into {0} ({1}) values({2})'.format(rule['name'],

-                     rule['dest_column'], values)

+            values = values.decode('utf-8')

+            insert_sql = u'insert into {0} ({1}) values({2})'.format(rule['name'],

+                         rule['dest_column'], values)

             # print insert_sql

             count += 1

             if not self._dst_db.exec_sql(insert_sql):

                 print u"导入第{0}条记录错误".format(count)

                 self._dst_db.rollback()

+                print u"SQL<{0}>".format(insert_sql)

                 return False

 

             if count % self._commit_count == 0: