{"record":{"id":"d9b6845bf246f6d4","repo":"apache/shardingsphere","slug":"unsupported-format-type-s","errorCode":null,"errorMessage":"Unsupported format type %s","messagePattern":"Unsupported format type (.+?)","errorType":"exception","errorClass":"FirebirdProtocolException","httpStatus":null,"severity":"error","filePath":"database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBuffer.java","lineNumber":74,"sourceCode":"    }\n    \n    private Object parseValue(final ByteBuf parameterBuffer, final FirebirdParameterBufferType type) {\n        boolean traditionalStyle = isTraditionalType.apply(version);\n        switch (type.getFormat()) {\n            case INT:\n                if (traditionalStyle) {\n                    parameterBuffer.skipBytes(1);\n                } else {\n                    parameterBuffer.skipBytes(4);\n                }\n                return parameterBuffer.readIntLE();\n            case BOOLEAN:\n                return true;\n            case STRING:\n                int length = traditionalStyle ? parameterBuffer.readByte() : parameterBuffer.readIntLE();\n                return parameterBuffer.readSlice(length).toString(StandardCharsets.UTF_8);\n            default:\n                throw new FirebirdProtocolException(\"Unsupported format type %s\", type.getFormat().name());\n        }\n    }\n    \n    /**\n     * Get property value.\n     *\n     * @param key property key\n     * @param <T> class type of return value\n     * @return property value or null\n     */\n    @SuppressWarnings(\"unchecked\")\n    public <T> T getValue(final FirebirdParameterBufferType key) {\n        return (T) parameterBuffer.get(key);\n    }\n}\n","sourceCodeStart":56,"sourceCodeEnd":90,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBuffer.java#L56-L90","documentation":"MySQL error 1295 (ER_UNSUPPORTED_PS) thrown by MySQLComStmtPrepareExecutor.failedIfContainsMultiStatements(): preparing a statement is rejected when the session has multi-statements enabled (CLIENT_MULTI_STATEMENTS negotiated and SET OPTION multi_statements=1) and the SQL string contains a ';'. Because the SQL parser cannot yet reliably identify multi-statement SQL, a literal semicolon is treated as a probable multi-statement payload, which the prepared-statement protocol path does not support.","triggerScenarios":"Issuing COM_STMT_PREPARE with SQL containing ';' while OPTION_MULTI_STATEMENTS is ON for the connection: e.g. preparing 'SELECT 1; SELECT 2' or SQL that merely contains a semicolon inside the text (the check is substring-based).","commonSituations":"Frameworks or clients that default to multi-statements enabled (some connectors set it for pipelining); developers preparing batch SQL separated by ';'; stored procedure bodies or hints containing semicolons caught by the naive substring check after multi-statements was switched on by another statement.","solutions":["Prepare each statement separately — split the SQL on ';' and issue one COM_STMT_PREPARE per statement.","Turn multi-statements off for the connection (SET OPTION multi_statements = 0 / disable CLIENT_MULTI_STATEMENTS in the driver) before preparing.","If the semicolon is not a statement separator (e.g. inside a string literal the substring check still trips on), restructure the SQL to avoid ';' or execute via COM_QUERY instead of the prepared protocol.","Ensure only one statement per prepared SQL; the prepared-statement protocol is single-statement by design."],"exampleFix":"-- before: multi-statements ON + prepare\nPREPARE stmt FROM 'SELECT * FROM t WHERE id=?; SELECT 1';\n\n-- after: one statement per prepare\nPREPARE stmt FROM 'SELECT * FROM t WHERE id=?';\nPREPARE stmt2 FROM 'SELECT 1';","handlingStrategy":"validation","validationCode":"// Client-side: reject multi-statement SQL before prepare when multi-statements is ON\nif (connectionHasMultiStatementsOn() && sql.contains(\";\")) {\n    throw new IllegalArgumentException(\"Prepared statements must contain a single statement (no ';'): \" + sql);\n}","typeGuard":null,"tryCatchPattern":"// Vendor code 1295 on prepare\ntry {\n    PreparedStatement ps = conn.prepareStatement(sql);\n} catch (SQLException e) {\n    if (e.getErrorCode() == 1295 && sql.contains(\";\")) {\n        String[] parts = sql.split(\";\");\n        // fall back to preparing each statement individually\n        return prepareIndividually(conn, parts);\n    }\n    throw e;\n}","preventionTips":["Keep one statement per prepared SQL string.","Disable multi-statements on connections used for the prepared-statement path.","Beware the check is substring-based: any ';' in the SQL text can trip it when multi-statements is ON."],"tags":["mysql","prepared-statement","multi-statement","sql-parser"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}