https://github.com/sea-boat/mysql-protocol
a lib for mysql protocol operation
https://github.com/sea-boat/mysql-protocol
mysql-protocol
Last synced: 5 months ago
JSON representation
a lib for mysql protocol operation
- Host: GitHub
- URL: https://github.com/sea-boat/mysql-protocol
- Owner: sea-boat
- Created: 2017-01-08T01:55:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-06T09:28:38.000Z (about 9 years ago)
- Last Synced: 2023-09-19T16:39:33.552Z (over 2 years ago)
- Topics: mysql-protocol
- Language: Java
- Size: 58.6 KB
- Stars: 66
- Watchers: 11
- Forks: 35
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mysql-protocol
a lib for mysql protocol operation
# how to use
i want an OK packet, just simple as below ,bytes is what you need.
```
OKPacket ok = new OKPacket();
ok.packetId = 2;
ok.affectedRows = 0;
ok.insertId = 0;
ok.serverStatus = 2;
ok.warningCount = 0;
ByteBuffer buffer = ByteBuffer.allocate(256);
ok.write(buffer);
buffer.flip();
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes, 0, bytes.length);
```