You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/03 06:43:08 UTC

[GitHub] [shardingsphere] yoloz commented on pull request #21922: support MySQLComQuery Blob

yoloz commented on PR #21922:
URL: https://github.com/apache/shardingsphere/pull/21922#issuecomment-1301703670

   Hi @TeslaCN 
   java-connector will append blob(stream) and bytes  in sql to send, which you can see [https://github.com/mysql/mysql-connector-j/blob/release/8.0/src/main/user-impl/java/com/mysql/cj/jdbc/ClientPreparedStatement.java](https://github.com/mysql/mysql-connector-j/blob/release/8.0/src/main/user-impl/java/com/mysql/cj/jdbc/ClientPreparedStatement.java) 1047行:
   ` Message sendPacket = ((PreparedQuery<?>) this.query).fillSendPacket(bindings);`
   ```java
    for (int i = 0; i < bindValues.length; i++) {
                   bindings.checkParameterSet(i);
   
                   sendPacket.writeBytes(StringLengthDataType.STRING_FIXED, staticSqlStrings[i]);
   
                   if (bindValues[i].isStream()) {
                       streamToBytes(sendPacket, bindValues[i].getStreamValue(), true, bindValues[i].getStreamLength(), useStreamLengths);
                   } else {
                       sendPacket.writeBytes(StringLengthDataType.STRING_FIXED, bindValues[i].getByteValue());
                   }
               }
   ```
   if use hex, begin with `x`, default `type bytes` use this, while no other set , `type blob` default use escape ,begin with `_binary` and:
   * `0` to `\0` , can see ascii ;
   * `\` and "`"  to double;


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org