When calling SQLGetData to read a variable length TEXT utf8mb4 field as SQL_C_WCHAR, if the text contains utf-8 4 bytes character (UTF-16 surrogate pair) and it falls at the end of the buffer so only one half can fit, the successive calls to the function return the same content, making an indefinite loop.
For example, if the field contains Unicode codes 'a', 0xD83D, 0xDE18, and 'd', and the buffer is 6 bytes (3 wchar_t's), the function puts 'a' and high surrogate 0xD83D and 0 into the buffer, returns SQL_SUCCESS_WITH_INFO with SQL state [01004], but the successive calls do not advance but keep returning the same results.
The significant lines of code are as follows:
SQLWCHAR temp_stringW[3];
while (!Success)
{
rc=SQLGetData(hstmt,col,SQL_C_WCHAR,temp_stringW,sizeof(temp_stringW),&size);
...
}
NOTE: While typing this description, this web site reported an exception when the above sample text contained real character, like 'a<smiley>d'. No need to mention that I had to retype the whole text from scratch. Obviously, all MySQL flavours are simple plagued with bugs when it comes to handling 4-byte utf8 characters! That is the reason why I cannot provide here the exact sample string. Here it is in UTF-8 bytes: 61 F0 9F 98 98 64.
{"report":{"fcp":778.5999999046326,"ttfb":198,"pageVisibility":"visible","entityId":59263,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"72512487-cb1f-4018-bdd6-41848704390c","navigationType":0,"readyForUser":808,"redirectCount":0,"resourceLoadedEnd":333.09999990463257,"resourceLoadedStart":203,"resourceTiming":[{"duration":5.700000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bsh/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":203,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":203,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":208.70000004768372,"responseStart":0,"secureConnectionStart":0},{"duration":6.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bsh/820016/12ta74/eb142f92e4bd16bd1ef8b08c1b9d5d56/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":203.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":203.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":209.70000004768372,"responseStart":0,"secureConnectionStart":0},{"duration":84.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/b09d0d077992e4331b5f9ec0d3ec448c-CDN/lu2bsh/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":203.39999985694885,"connectEnd":203.39999985694885,"connectStart":203.39999985694885,"domainLookupEnd":203.39999985694885,"domainLookupStart":203.39999985694885,"fetchStart":203.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":215.09999990463257,"responseEnd":288.09999990463257,"responseStart":228.89999985694885,"secureConnectionStart":203.39999985694885},{"duration":117.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/b47ab3df14096803b180217eb8482517-CDN/lu2bsh/820016/12ta74/eb142f92e4bd16bd1ef8b08c1b9d5d56/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":203.5,"connectEnd":203.5,"connectStart":203.5,"domainLookupEnd":203.5,"domainLookupStart":203.5,"fetchStart":203.5,"redirectEnd":0,"redirectStart":0,"requestStart":215.29999995231628,"responseEnd":320.7999999523163,"responseStart":239.09999990463257,"secureConnectionStart":203.5},{"duration":39.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/6c569cbf8087ab04e40d0bef98627457-CDN/lu2bsh/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":203.59999990463257,"connectEnd":203.59999990463257,"connectStart":203.59999990463257,"domainLookupEnd":203.59999990463257,"domainLookupStart":203.59999990463257,"fetchStart":203.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":216.70000004768372,"responseEnd":243.20000004768372,"responseStart":242.70000004768372,"secureConnectionStart":203.59999990463257},{"duration":50.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":203.59999990463257,"connectEnd":203.59999990463257,"connectStart":203.59999990463257,"domainLookupEnd":203.59999990463257,"domainLookupStart":203.59999990463257,"fetchStart":203.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":217.70000004768372,"responseEnd":254.09999990463257,"responseStart":253.5,"secureConnectionStart":203.59999990463257},{"duration":64.69999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":203.70000004768372,"connectEnd":203.70000004768372,"connectStart":203.70000004768372,"domainLookupEnd":203.70000004768372,"domainLookupStart":203.70000004768372,"fetchStart":203.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":220.89999985694885,"responseEnd":268.39999985694885,"responseStart":267.7999999523163,"secureConnectionStart":203.70000004768372},{"duration":14.099999904632568,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bsh/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":203.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":203.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":217.89999985694885,"responseStart":0,"secureConnectionStart":0},{"duration":67.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":204,"connectEnd":204,"connectStart":204,"domainLookupEnd":204,"domainLookupStart":204,"fetchStart":204,"redirectEnd":0,"redirectStart":0,"requestStart":222.70000004768372,"responseEnd":271.59999990463257,"responseStart":270.89999985694885,"secureConnectionStart":204},{"duration":16.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bsh/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":204.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":204.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":220.5,"responseStart":0,"secureConnectionStart":0},{"duration":68.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/81b5d7c27af3ebc078cc4a36383678ba-CDN/lu2bsh/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":204.20000004768372,"connectEnd":204.20000004768372,"connectStart":204.20000004768372,"domainLookupEnd":204.20000004768372,"domainLookupStart":204.20000004768372,"fetchStart":204.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":225.70000004768372,"responseEnd":272.39999985694885,"responseStart":271.7999999523163,"secureConnectionStart":204.20000004768372},{"duration":115.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":217.70000004768372,"connectEnd":217.70000004768372,"connectStart":217.70000004768372,"domainLookupEnd":217.70000004768372,"domainLookupStart":217.70000004768372,"fetchStart":217.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":245.20000004768372,"responseEnd":332.89999985694885,"responseStart":330.39999985694885,"secureConnectionStart":217.70000004768372},{"duration":112.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bsh/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":220.5,"connectEnd":220.5,"connectStart":220.5,"domainLookupEnd":220.5,"domainLookupStart":220.5,"fetchStart":220.5,"redirectEnd":0,"redirectStart":0,"requestStart":255.39999985694885,"responseEnd":333.09999990463257,"responseStart":331.89999985694885,"secureConnectionStart":220.5},{"duration":185.89999985694885,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":508.5,"connectEnd":508.5,"connectStart":508.5,"domainLookupEnd":508.5,"domainLookupStart":508.5,"fetchStart":508.5,"redirectEnd":0,"redirectStart":0,"requestStart":663.5999999046326,"responseEnd":694.3999998569489,"responseStart":693.3999998569489,"secureConnectionStart":508.5},{"duration":72,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":731.3999998569489,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":731.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":803.3999998569489,"responseStart":0,"secureConnectionStart":0},{"duration":98.10000014305115,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":747.3999998569489,"connectEnd":747.3999998569489,"connectStart":747.3999998569489,"domainLookupEnd":747.3999998569489,"domainLookupStart":747.3999998569489,"fetchStart":747.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":814.8999998569489,"responseEnd":845.5,"responseStart":844.7000000476837,"secureConnectionStart":747.3999998569489}],"fetchStart":0,"domainLookupStart":47,"domainLookupEnd":55,"connectStart":55,"connectEnd":75,"secureConnectionStart":64,"requestStart":77,"responseStart":198,"responseEnd":220,"domLoading":201,"domInteractive":863,"domContentLoadedEventStart":863,"domContentLoadedEventEnd":905,"domComplete":1042,"loadEventStart":1042,"loadEventEnd":1043,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":839.0999999046326},{"name":"bigPipe.sidebar-id.end","time":840},{"name":"bigPipe.activity-panel-pipe-id.start","time":840.2000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":841.2999999523163},{"name":"activityTabFullyLoaded","time":923.2999999523163}],"measures":[],"correlationId":"52e963a6c3690","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":71,"dbReadsTimeInMs":10,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thank you for your bug report - that is what helps to reduce number of bugs. And looks like jira also has problems with 4-bytes utf8