Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dveeden/dfe2f11b64871cb4d234 to your computer and use it in GitHub Desktop.
Save dveeden/dfe2f11b64871cb4d234 to your computer and use it in GitHub Desktop.
MySQL Bug #73967 - Incorrect string value for sql_text
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:fd40d8aa0b3812fa34fc498e6d17a4430a09fe52b18f7bc3df37fb303ff1a35f"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import mysql.connector\n",
"import hashlib"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 76
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c = mysql.connector.connect(unix_socket='/tmp/mysql_sandbox5622.sock', user='msandbox', password='msandbox')\n",
"c.get_warnings = True"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 77
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cur = c.cursor()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 78
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cur.execute(\"SET NAMES binary\")\n",
"cur.execute(\"UPDATE performance_schema.setup_consumers SET ENABLED='YES' WHERE name='events_statements_history_long'\")\n",
"cur.execute(\"TRUNCATE TABLE performance_schema.events_statements_history_long\")\n",
"cur.execute(\"DROP TABLE IF EXISTS test.t1 CASCADE\")\n",
"cur.execute(\"CREATE TABLE test.t1 (id int, data blob)\")"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 79
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"checksum = hashlib.sha256(\"test\").digest()\n",
"query=\"INSERT INTO test.t1 VALUES(1,%s)\"\n",
"cur.execute(query, (checksum,))\n",
"cur.fetchone()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 80
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cur.execute('SELECT sql_text FROM performance_schema.events_statements_history_long')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 81
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for row in cur:\n",
" print(row[0])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"TRUNCATE TABLE performance_schema.events_statements_history_long\n",
"DROP TABLE IF EXISTS test.t1 CASCADE\n",
"CREATE TABLE test.t1 (id int, data blob)\n",
"INSERT INTO test.t1 VALUES(1,'\n"
]
}
],
"prompt_number": 82
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for warning in cur.fetchwarnings():\n",
" print(\"%s: %s: %s\" % warning)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Warning: 1366: Incorrect string value: '\\x9F\\x86\\xD0\\x81\\x88L...' for column 'SQL_TEXT' at row 4\n"
]
}
],
"prompt_number": 83
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cur.close()\n",
"c.close()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 84
}
],
"metadata": {}
}
]
}
@dveeden
Copy link
Author

dveeden commented Jan 13, 2015

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