{"record":{"id":"d4c2ea923c6e233c","repo":"apache/shardingsphere","slug":"unsupported-firebird-format-code-s","errorCode":null,"errorMessage":"Unsupported Firebird format code `%s`","messagePattern":"Unsupported Firebird format code `(.+?)`","errorType":"exception","errorClass":"UnsupportedSQLOperationException","httpStatus":null,"severity":"error","filePath":"database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/FirebirdValueFormat.java","lineNumber":57,"sourceCode":"    STRING(4);\n    \n    private final int code;\n    \n    /**\n     * Value of.\n     *\n     * @param code format code\n     * @return Firebird value format\n     * @throws UnsupportedSQLOperationException unsupported SQL operation exception\n     */\n    public static FirebirdValueFormat valueOf(final int code) {\n        switch (code) {\n            case 0:\n                return TEXT;\n            case 1:\n                return BINARY;\n            default:\n                throw new UnsupportedSQLOperationException(String.format(\"Unsupported Firebird format code `%s`\", code));\n        }\n    }\n}\n","sourceCodeStart":39,"sourceCodeEnd":61,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/FirebirdValueFormat.java#L39-L61","documentation":"MySQL error 1295 (ER_UNSUPPORTED_PS) thrown by MySQLComStmtExecuteExecutor while reconstructing parameter types for COM_STMT_EXECUTE. When the packet carries no new parameter types and no cached types exist, the executor can only proceed if every expected parameter is marked NULL in the null bitmap; otherwise it cannot infer the wire type of a non-NULL parameter and throws UnsupportedPreparedStatementException.","triggerScenarios":"Executing a prepared statement whose SQL declares parameters, where the COM_STMT_EXECUTE packet omits parameter types (first-execution types were not supplied/cached) and at least one parameter is non-NULL in the null bitmap, or the null bitmap itself is missing.","commonSituations":"Client drivers that skip re-sending parameter types on later executions; hand-crafted binary-protocol clients; drivers after an upgrade changing when they include new_parameter_types; statements whose parameter count from the parsed SQL disagrees with what the client sends.","solutions":["Use a mainstream, up-to-date MySQL driver (Connector/J, mysql-connector-python, etc.) that always sends parameter types on the first COM_STMT_EXECUTE after prepare.","Ensure at least one execution includes new parameter types so the executor caches them for subsequent executions.","If writing a custom client, populate the new_parameter_types block or set every unused parameter NULL in the null bitmap.","Check that the SQL sent at prepare time really has the parameter count the client assumes at execute time (server-side and client-side counts must agree)."],"exampleFix":"// before (custom binary-protocol client): execute with types omitted\nstmtExecute(null_bitmap, values, /* new_parameter_types */ null);\n\n// after: send types on first execution after prepare\nstmtExecute(null_bitmap, values, List.of(new MySQLPreparedStatementParameterType(VAR_STRING, 0)));","handlingStrategy":"validation","validationCode":"// Custom binary-protocol client: send types on first execute after prepare\nif (!typesSentForStatement.containsKey(stmtId)) {\n    executePacket.withNewParameterTypes(inferTypesFromBoundValues(values));\n    typesSentForStatement.put(stmtId, true);\n}","typeGuard":null,"tryCatchPattern":"// Vendor code 1295 = ER_UNSUPPORTED_PS; not retryable as-is\ntry {\n    stmt.execute();\n} catch (SQLException e) {\n    if (e.getErrorCode() == 1295) {\n        // re-prepare and retry once WITH explicit parameter types\n        stmt = rePrepareSendingTypes(sql, values);\n        return stmt.execute();\n    }\n    throw e;\n}","preventionTips":["Use maintained drivers that populate new_parameter_types on first COM_STMT_EXECUTE.","Mark all unused parameters NULL in the null bitmap when types are omitted.","Keep prepare-time and execute-time parameter counts consistent."],"tags":["mysql","prepared-statement","binary-protocol","parameters"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}