AttachmentsSizeSQL
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Found on my disk SQL that fetches attachments sizes from RT DB. It's not that trivial as we store it in headers. May be someone would find this useful. Works with mysql 4.1.x --RuslanZakirov
SELECT id, IF( LOCATE('Content-Length:', Headers), CAST(TRIM( SUBSTRING_INDEX( SUBSTRING_INDEX(Headers, 'Content-Length:', -1), "\n", 1 ) ) AS UNSIGNED INTEGER), BINARY LENGTH(Content) ) ContentLength FROM Attachments;