Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The field contains single quotation marks. It is written by proxy and will report an error. #2007

Closed
bruceyan1220 opened this issue Mar 11, 2019 · 3 comments
Assignees
Milestone

Comments

@bruceyan1220
Copy link

Bug Report

Test Topology

(1) python driver ------> proxy ------> mysql
(2) python driver ------> mysql

row info:

rows =
((datetime.datetime(2019, 3, 11, 14, 6, 11), datetime.datetime(2019, 3, 11, 14, 6, 11), 1, u"abc'"),)

insert statement

sql = """
insert into tbl_key_test (data_create_time,data_update_time,id,key_name_partial) values
(%s, %s, %s, %s )
"""

Test1 python driver ------> proxy ------> mysql

connect to proxy

conn_d = get_mysql_connection('10.10.5.xxx:3306', 'test')
cur_d = conn_d.cursor()
cur_d.executemany(sql , rows)
error info:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/site-packages/pymysql/cursors.py", line 169, in executemany
self.rowcount = sum(self.execute(query, arg) for arg in args)
File "/usr/local/lib/python2.7/site-packages/pymysql/cursors.py", line 169, in
self.rowcount = sum(self.execute(query, arg) for arg in args)
File "/usr/local/lib/python2.7/site-packages/pymysql/cursors.py", line 146, in execute
result = self._query(query)
File "/usr/local/lib/python2.7/site-packages/pymysql/cursors.py", line 296, in _query
conn.query(q)
File "/usr/local/lib/python2.7/site-packages/pymysql/connections.py", line 781, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python2.7/site-packages/pymysql/connections.py", line 942, in _read_query_result
result.read()
File "/usr/local/lib/python2.7/site-packages/pymysql/connections.py", line 1138, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python2.7/site-packages/pymysql/connections.py", line 906, in _read_packet
packet.check_error()
File "/usr/local/lib/python2.7/site-packages/pymysql/connections.py", line 367, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python2.7/site-packages/pymysql/err.py", line 120, in raise_mysql_exception
_check_mysql_exception(errinfo)
File "/usr/local/lib/python2.7/site-packages/pymysql/err.py", line 115, in _check_mysql_exception
raise InternalError(errno, errorvalue)
pymysql.err.InternalError: (3054, u"Unknown exception: Illegal input, unterminated '''.")

Test2 python driver ------> mysql

connect to mysql

conn_d = get_mysql_connection('10.10.4.xxx:3307', 'test')
cur_d = conn_d.cursor()
cur_d.executemany(sql , rows)
conn_d.commit()

insert sucessfully

@tuohai666
Copy link
Member

@bruceyan1220 , thanks for your report. This issue will be fixed in 4.0.0.

@bruceyan1220
Copy link
Author

@tuohai666 Has this issue been fixed in RC?

@tuohai666
Copy link
Member

@bruceyan1220 , yes.
Has been fixed via #1674.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants