You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.
It would be expected that all of these would function the same
abcdef
abcdef
abcdef
However the observed result is:
a
a
abcdef
Only the 3rd list usage works as expected.
The truncation occurs before the query, from the general query log:
4341 Query SELECT 'a'
4341 Query SELECT 'a'
4341 Query SELECT 'abcdef'
The text was updated successfully, but these errors were encountered:
It seems that the issue is not tuple related, but rather that a parameter of a single str should be treated as such for escaping and not as a sequence of characters.
If a string to be escaped is passed in as either a single argument or in a tuple it gets truncated to the first character.
This does not occur if the string is passed within a list, or if multiple arguments are given.
Minimal test case:
import umysql
conn = umysql.Connection()
conn.connect('localhost', 3306, 'user', 'pass', 'test')
rs = conn.query("SELECT %s", 'abcdef')
print rs.rows[0][0]
rs = conn.query("SELECT %s", ('abcdef'))
print rs.rows[0][0]
rs = conn.query("SELECT %s", ['abcdef'])
print rs.rows[0][0]
It would be expected that all of these would function the same
abcdef
abcdef
abcdef
However the observed result is:
a
a
abcdef
Only the 3rd list usage works as expected.
The truncation occurs before the query, from the general query log:
4341 Query SELECT 'a'
4341 Query SELECT 'a'
4341 Query SELECT 'abcdef'
The text was updated successfully, but these errors were encountered: