Skip to content

Instantly share code, notes, and snippets.

@mpchadwick
Created February 7, 2020 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpchadwick/a9ac3ce2dbc7a230ea143f83fefd2225 to your computer and use it in GitHub Desktop.
Save mpchadwick/a9ac3ce2dbc7a230ea143f83fefd2225 to your computer and use it in GitHub Desktop.
COM_QUERY_RESPONSE
Generating the strace:
sudo -u apache strace -s 10000 -xx -f -e sendto,recvfrom php load-category.php
Useful Links:
- https://www.rapidtables.com/convert/number/hex-to-ascii.html
- https://dev.mysql.com/doc/internals/en/protocoltext-resultset.html
- Query:
\x84\x00\x00\x00\x03\x53\x45\x4c\x45\x43\x54\x20\x60\x69\x6e\x76\x65\x6e\x74\x6f\x72\x79\x5f\x73\x74\x6f\x63\x6b\x5f\x73\x61\x6c\x65\x73\x5f\x63\x68\x61\x6e\x6e\x65\x6c\x60\x2e\x60\x73\x74\x6f\x63\x6b\x5f\x69\x64\x60\x20\x46\x52\x4f\x4d\x20\x60\x69\x6e\x76\x65\x6e\x74\x6f\x72\x79\x5f\x73\x74\x6f\x63\x6b\x5f\x73\x61\x6c\x65\x73\x5f\x63\x68\x61\x6e\x6e\x65\x6c\x60\x20\x57\x48\x45\x52\x45\x20\x28\x74\x79\x70\x65\x20\x3d\x20\x27\x77\x65\x62\x73\x69\x74\x65\x27\x29\x20\x41\x4e\x44\x20\x28\x63\x6f\x64\x65\x20\x3d\x20\x27\x62\x61\x73\x65\x27\x29
SELECT `inventory_stock_sales_channel`.`stock_id` FROM `inventory_stock_sales_channel` WHERE (type = 'website') AND (code = 'base')
- Result:
\x01\x00\x00\x01\x01\x70\x00\x00\x02\x03\x64\x65\x66\x10\x6d\x61\x67\x65\x6e\x74\x6f\x5f\x32\x5f\x33\x5f\x33\x5f\x65\x65\x1d\x69\x6e\x76\x65\x6e\x74\x6f\x72\x79\x5f\x73\x74\x6f\x63\x6b\x5f\x73\x61\x6c\x65\x73\x5f\x63\x68\x61\x6e\x6e\x65\x6c\x1d\x69\x6e\x76\x65\x6e\x74\x6f\x72\x79\x5f\x73\x74\x6f\x63\x6b\x5f\x73\x61\x6c\x65\x73\x5f\x63\x68\x61\x6e\x6e\x65\x6c\x08\x73\x74\x6f\x63\x6b\x5f\x69\x64\x08\x73\x74\x6f\x63\x6b\x5f\x69\x64\x0c\x3f\x00\x0a\x00\x00\x00\x03\x29\x50\x00\x00\x00\x05\x00\x00\x03\xfe\x00\x00\x02\x00\x02\x00\x00\x04\x01\x31\x05\x00\x00\x05\xfe\x00\x00\x02\x00
+----------+
| stock_id |
+----------+
| 1 |
+----------+
-------------------------------------------
--- Column Count ---
payload_length
\x01\x00\x00
sequence_id
\x01
column_count
\x01
--- Column Definition (https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnDefinition) ---
payload_length
\x70\x00\x00
sequence_id
\x02
payload:
catalog:
length:
\x03
value:
\x64\x65\x66 <-- def (always def)
schema:
length:
\x10
value:
\x6d\x61\x67\x65\x6e\x74\x6f\x5f\x32\x5f\x33\x5f\x33\x5f\x65\x65 <-- magento_2_3_3_ee
table:
length:
\x1d
value:
\x69\x6e\x76\x65\x6e\x74\x6f\x72\x79\x5f\x73\x74\x6f\x63\x6b\x5f\x73\x61\x6c\x65\x73\x5f\x63\x68\x61\x6e\x6e\x65\x6c <-- inventory_stock_sales_channel
org_table:
length:
\x1d
value:
\x69\x6e\x76\x65\x6e\x74\x6f\x72\x79\x5f\x73\x74\x6f\x63\x6b\x5f\x73\x61\x6c\x65\x73\x5f\x63\x68\x61\x6e\x6e\x65\x6c <-- inventory_stock_sales_channel
name:
length:
\x08
value
\x73\x74\x6f\x63\x6b\x5f\x69\x64 <-- stock_id
org_name:
length:
\x08
value:
\x73\x74\x6f\x63\x6b\x5f\x69\x64 <-- stock_id
filler_1 (https://dev.mysql.com/doc/internals/en/protocoltext-resultset.html)
\x0c
character_set (https://dev.mysql.com/doc/internals/en/character-set.html#packet-Protocol::CharacterSet):
\x3f\x00 <-- binary
column_length:
\x0a\x00\x00\x00 <-- 10
column_type (https://dev.mysql.com/doc/internals/en/com-query-response.html#column-type):
\x03
flags
\x29\x50
decimals:
\x00
filler_2 (https://dev.mysql.com/doc/internals/en/protocoltext-resultset.html)
\x00\x00
--- EOF ---
payload_length
\x05\x00\x00
sequence_id
\x03
payload:
\xfe\x00\x00\x02\x00
--- Row ---
payload_length
\x02\x00\x00
sequence_id:
\x04
payload:
\x01\x31 <- 1
--- EOF ---
payload_length:
\x05\x00\x00
sequence_id:
\x05
payload:
\xfe\x00\x00\x02\x00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment