{"record":{"id":"be07d4d405d1f39d","repo":"phalcon/cphalcon","slug":"only-phql-statements-that-return-resultsets-can-be","errorCode":null,"errorMessage":"Only PHQL statements that return resultsets can be cached","messagePattern":"Only PHQL statements that return resultsets can be cached","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Query\\Exceptions\\ResultsetNonCacheable","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query.zep","lineNumber":475,"sourceCode":"                    mergedParams,\n                    mergedTypes\n                );\n\n                break;\n\n            default:\n                throw new UnknownPhqlStatement(type);\n        }\n\n        /**\n         * We store the resultset in the cache if any\n         */\n        if cacheOptions !== null {\n            /**\n             * Only PHQL SELECTs can be cached\n             */\n            if type != PHQL_T_SELECT {\n                throw new ResultsetNonCacheable();\n            }\n\n            cache->set(key, result, lifetime);\n        }\n\n        /**\n         * Check if only the first row must be returned\n         */\n        if uniqueRow {\n            let preparedResult = result->getFirst();\n        } else {\n            let preparedResult = result;\n        }\n\n        return preparedResult;\n    }\n\n    /**","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query.zep#L457-L493","documentation":"Error \"Only PHQL statements that return resultsets can be cached\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query.zep:475 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}