Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
3.1.6
I am doing a select for update and then SQLSetPos(SQL_UPDATE) on a particular row. Now, my table contains a column that is of type BINARY. The SQLSetPos(SQL_UPDATE) works fine unless the original data (as opposed to the updated data) contains a 0x00 byte. When it does contain such a byte, the SQLSetPos(SQL_UPDATE) returns success, but the row is not actually updated.
It should be noted that other unusual bytes are fine - e.g. 0x01; it is just 0x00 that is the problem I think.
I have create a Unit Test to demonstrate the issue, which I am putting here.
The sequence of events is
Create a table with a 6-byte BINARY column
Add some rows, one of which has a 0x00 as one of the bytes in the BINARY column.
Do a select
Update a row that does not have a 0x00 in it. (a)
Update a row that does have a 0x00 in it. (b)
Select all updated rows from (a) - there is one row.
Select all updated rows from (b) - there are no rows (there should be one).
Source code of the test is here ...
{{
ODBC_TEST(tmysql_setpos_upd_bin)
{
SQLRETURN rc;
SQLINTEGER nData = 500;
SQLLEN nlen;
SQLCHAR szData[255] =
{0}
;
SQLULEN pcrow;
SQLUSMALLINT rgfRowStatus;
OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS tmysql_setpos_bin");
OK_SIMPLE_STMT(Stmt, "create table tmysql_setpos_bin(col1 int, col2 binary(6))");
OK_SIMPLE_STMT(Stmt, "insert into tmysql_setpos_bin values(100,'MySQL1')");
OK_SIMPLE_STMT(Stmt, "insert into tmysql_setpos_bin values(300,'MySQL3')");
OK_SIMPLE_STMT(Stmt, "insert into tmysql_setpos_bin values(200,'My 0QL2')");
OK_SIMPLE_STMT(Stmt, "insert into tmysql_setpos_bin values(300,'MySQL3')");
OK_SIMPLE_STMT(Stmt, "insert into tmysql_setpos_bin values(400,'MySQL4')");
OK_SIMPLE_STMT(Stmt, "insert into tmysql_setpos_bin values(300,'MySQL3')");
rc = SQLTransact(NULL, Connection, SQL_COMMIT);
CHECK_DBC_RC(Connection,rc);
CHECK_STMT_RC(Stmt, SQLFreeStmt(Stmt, SQL_CLOSE));
CHECK_STMT_RC(Stmt, SQLSetStmtAttr(Stmt, SQL_ATTR_CURSOR_TYPE,
(SQLPOINTER)SQL_CURSOR_STATIC, 0));
rc = SQLSetCursorName(Stmt, (SQLCHAR *)"venu",SQL_NTS);
OK_SIMPLE_STMT(Stmt, "select * from tmysql_setpos_bin");
rc = SQLBindCol(Stmt,1,SQL_C_LONG,&nData,100,NULL);
CHECK_STMT_RC(Stmt,rc);
rc = SQLBindCol(Stmt,2,SQL_C_BINARY,szData,100,NULL);
CHECK_STMT_RC(Stmt,rc);
// Fetch Row 2 (That does not have a null) and update it
rc = SQLExtendedFetch(Stmt, SQL_FETCH_ABSOLUTE,2,&pcrow,&rgfRowStatus);
CHECK_STMT_RC(Stmt,rc);
diag(" pcrow:%d\n",pcrow);
diag(" row2:%d,%s\n",nData,szData);
rc = SQLSetPos(Stmt,1,SQL_POSITION,SQL_LOCK_NO_CHANGE);
CHECK_STMT_RC(Stmt,rc);
nData = 1000;
strcpy((char *)szData , "updat1");
rc = SQLSetPos(Stmt,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
CHECK_STMT_RC(Stmt,rc);
rc = SQLRowCount(Stmt,&nlen);
CHECK_STMT_RC(Stmt,rc);
diag(" rows affected:%d\n",nlen);
// Fetch Row 3 (That does have a null) and update it
rc = SQLExtendedFetch(Stmt, SQL_FETCH_ABSOLUTE,3,&pcrow,&rgfRowStatus);
CHECK_STMT_RC(Stmt,rc);
diag(" pcrow:%d\n",pcrow);
diag(" row3:%d,%s\n",nData,szData);
rc = SQLSetPos(Stmt,1,SQL_POSITION,SQL_LOCK_NO_CHANGE);
CHECK_STMT_RC(Stmt,rc);
nData = 1000;
strcpy((char *)szData , "updat2");
rc = SQLSetPos(Stmt,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
CHECK_STMT_RC(Stmt,rc);
rc = SQLRowCount(Stmt,&nlen);
CHECK_STMT_RC(Stmt,rc);
diag(" rows affected:%d\n",nlen);
rc = SQLFreeStmt(Stmt, SQL_UNBIND);
CHECK_STMT_RC(Stmt,rc);
rc = SQLFreeStmt(Stmt, SQL_CLOSE);
CHECK_STMT_RC(Stmt,rc);
OK_SIMPLE_STMT(Stmt, "select * from tmysql_setpos_bin");
myrowcount(Stmt);
rc = SQLFreeStmt(Stmt, SQL_CLOSE);
CHECK_STMT_RC(Stmt,rc);
OK_SIMPLE_STMT(Stmt, "DELETE FROM tmysql_setpos_bin WHERE col2 = 'updat1'");
rc = SQLRowCount(Stmt,&nlen);
CHECK_STMT_RC(Stmt,rc);
diag("\n total rows affected (updat1):%d",nlen);
IS(nlen == 1);
rc = SQLFreeStmt(Stmt,SQL_CLOSE);
CHECK_STMT_RC(Stmt,rc);
OK_SIMPLE_STMT(Stmt, "DELETE FROM tmysql_setpos_bin WHERE col2 = 'updat2'");
rc = SQLRowCount(Stmt,&nlen);
CHECK_STMT_RC(Stmt,rc);
diag("\n total rows affected (updat2):%d",nlen);
IS(nlen == 1);
rc = SQLFreeStmt(Stmt,SQL_CLOSE);
CHECK_STMT_RC(Stmt,rc);
rc = SQLTransact(NULL,Connection,SQL_COMMIT);
CHECK_DBC_RC(Connection,rc);
OK_SIMPLE_STMT(Stmt, "select * from tmysql_setpos_bin");
IS(5 == myrowcount(Stmt));
rc = SQLFreeStmt(Stmt,SQL_CLOSE);
CHECK_STMT_RC(Stmt,rc);
OK_SIMPLE_STMT(Stmt, "DROP TABLE IF EXISTS tmysql_setpos_bin");
return OK;
}
}}
Transition
Time In Source Status
Execution Times
Open
Closed
2d 9h 49m
1
{"report":{"fcp":819,"ttfb":169.39999997615814,"pageVisibility":"visible","entityId":85037,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"34b52e29-bfd7-42da-a2df-afdefad9c113","navigationType":0,"readyForUser":885.3999999761581,"redirectCount":0,"resourceLoadedEnd":1145.5,"resourceLoadedStart":174.89999997615814,"resourceTiming":[{"duration":133.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":174.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":174.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":308.5,"responseStart":0,"secureConnectionStart":0},{"duration":133.70000004768372,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":175.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":175.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":308.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":142.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":175.29999995231628,"connectEnd":175.29999995231628,"connectStart":175.29999995231628,"domainLookupEnd":175.29999995231628,"domainLookupStart":175.29999995231628,"fetchStart":175.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":175.29999995231628,"responseEnd":317.5,"responseStart":317.5,"secureConnectionStart":175.29999995231628},{"duration":219.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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":175.5,"connectEnd":175.5,"connectStart":175.5,"domainLookupEnd":175.5,"domainLookupStart":175.5,"fetchStart":175.5,"redirectEnd":0,"redirectStart":0,"requestStart":175.5,"responseEnd":394.59999990463257,"responseStart":394.59999990463257,"secureConnectionStart":175.5},{"duration":223.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":175.69999992847443,"connectEnd":175.69999992847443,"connectStart":175.69999992847443,"domainLookupEnd":175.69999992847443,"domainLookupStart":175.69999992847443,"fetchStart":175.69999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":175.69999992847443,"responseEnd":398.7999999523163,"responseStart":398.7999999523163,"secureConnectionStart":175.69999992847443},{"duration":223.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":175.89999997615814,"connectEnd":175.89999997615814,"connectStart":175.89999997615814,"domainLookupEnd":175.89999997615814,"domainLookupStart":175.89999997615814,"fetchStart":175.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":175.89999997615814,"responseEnd":399.39999997615814,"responseStart":399.39999997615814,"secureConnectionStart":175.89999997615814},{"duration":281.8000000715256,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":176.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":176.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":457.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":223.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":176.09999990463257,"connectEnd":176.09999990463257,"connectStart":176.09999990463257,"domainLookupEnd":176.09999990463257,"domainLookupStart":176.09999990463257,"fetchStart":176.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":176.09999990463257,"responseEnd":399.7999999523163,"responseStart":399.7999999523163,"secureConnectionStart":176.09999990463257},{"duration":223.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":176.39999997615814,"connectEnd":176.39999997615814,"connectStart":176.39999997615814,"domainLookupEnd":176.39999997615814,"domainLookupStart":176.39999997615814,"fetchStart":176.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":176.39999997615814,"responseEnd":400.2999999523163,"responseStart":400.2999999523163,"secureConnectionStart":176.39999997615814},{"duration":281.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":176.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":176.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":458,"responseStart":0,"secureConnectionStart":0},{"duration":224.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":176.69999992847443,"connectEnd":176.69999992847443,"connectStart":176.69999992847443,"domainLookupEnd":176.69999992847443,"domainLookupStart":176.69999992847443,"fetchStart":176.69999992847443,"redirectEnd":0,"redirectStart":0,"requestStart":176.69999992847443,"responseEnd":400.89999997615814,"responseStart":400.89999997615814,"secureConnectionStart":176.69999992847443},{"duration":967.5999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":177.5,"connectEnd":177.5,"connectStart":177.5,"domainLookupEnd":177.5,"domainLookupStart":177.5,"fetchStart":177.5,"redirectEnd":0,"redirectStart":0,"requestStart":177.5,"responseEnd":1145.0999999046326,"responseStart":1145.0999999046326,"secureConnectionStart":177.5},{"duration":968,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":177.5,"connectEnd":177.5,"connectStart":177.5,"domainLookupEnd":177.5,"domainLookupStart":177.5,"fetchStart":177.5,"redirectEnd":0,"redirectStart":0,"requestStart":177.5,"responseEnd":1145.5,"responseStart":1145.5,"secureConnectionStart":177.5},{"duration":77.69999992847443,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":469.5,"connectEnd":469.5,"connectStart":469.5,"domainLookupEnd":469.5,"domainLookupStart":469.5,"fetchStart":469.5,"redirectEnd":0,"redirectStart":0,"requestStart":469.5,"responseEnd":547.1999999284744,"responseStart":547.1999999284744,"secureConnectionStart":469.5},{"duration":461.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":739.7999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":739.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1201.2999999523163,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":21,"responseStart":169,"responseEnd":172,"domLoading":173,"domInteractive":1164,"domContentLoadedEventStart":1164,"domContentLoadedEventEnd":1201,"domComplete":1599,"loadEventStart":1599,"loadEventEnd":1599,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1148},{"name":"bigPipe.sidebar-id.end","time":1148.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":1148.8999999761581},{"name":"bigPipe.activity-panel-pipe-id.end","time":1149.6999999284744},{"name":"activityTabFullyLoaded","time":1211.7999999523163}],"measures":[],"correlationId":"c20f249e9aad2c","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":94,"dbReadsTimeInMs":9,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}