Description:
In this test a user who only has a SELECT grant is attempting to update the
datasource. After this attempt, the recordset status should have
adRecPermissionDenied added to it, but it doesn't.
When adUseClient cursor is used, the rs.status is set to adRecModified.
When adUseServer cursor is used, the status is set to adRecModified +
adRecIntegrityViolation.
The behavior in this test is identical for MyODBC 3.51 but a different bug is
entered for tracking purposes
How to repeat:
SETUP:
DROP TABLE IF EXISTS ado_test;
CREATE TABLE ado_test (C1 INT PRIMARY KEY, C2 CHAR(20));
INSERT INTO ado_test VALUES (1, 'A'), (2, 'B');
CREATE USER foo@localhost IDENTIFIED BY 'bar';
GRANT SELECT ON ado.* TO foo@localhost;
VB Code:
Private Sub Test()
On Error GoTo EH
Dim strSQL, strConn As String
Dim connection1 As ADODB.Connection
Dim recset1 As ADODB.Recordset
Dim fld As Field
Set connection1 = New ADODB.Connection
Set recset1 = New ADODB.Recordset
Set recset2 = New ADODB.Recordset
strSQL = "SELECT * FROM ado_test"
strConn = "DRIVER={MySQL Connector/ODBC v5};" & _
"SERVER=localhost;DATABASE=ado" & _
";UID=foo;PWD=bar;OPTION=3;"
' open connection
connection1.ConnectionString = strConn
connection1.CursorLocation = adUseClient
' connection1.CursorLocation = adUseServer
connection1.Open
strSQL = "SELECT * FROM ado_test"
recset1.Open strSQL, connection1, adOpenStatic, _
adLockBatchOptimistic, adCmdText
recset1.MoveFirst
recset1.Fields(0).Value = 111
recset1.Fields(1).Value = "test"
recset1.UpdateBatch
Debug.Print "New Status: " & recset1.Status
recset1.Close
Set recset1 = Nothing
connection1.Close
Set connection1 = Nothing
Exit Sub
EH:
Debug.Print Err.Description & " " & Err.Number & vbNewLine
Resume Next
End Sub
Description: In this test a user who only has a SELECT grant is attempting to update the datasource. After this attempt, the recordset status should have adRecPermissionDenied added to it, but it doesn't. When adUseClient cursor is used, the rs.status is set to adRecModified. When adUseServer cursor is used, the status is set to adRecModified + adRecIntegrityViolation. The behavior in this test is identical for MyODBC 3.51 but a different bug is entered for tracking purposes How to repeat: SETUP: DROP TABLE IF EXISTS ado_test; CREATE TABLE ado_test (C1 INT PRIMARY KEY, C2 CHAR(20)); INSERT INTO ado_test VALUES (1, 'A'), (2, 'B'); CREATE USER foo@localhost IDENTIFIED BY 'bar'; GRANT SELECT ON ado.* TO foo@localhost; VB Code: Private Sub Test() On Error GoTo EH Dim strSQL, strConn As String Dim connection1 As ADODB.Connection Dim recset1 As ADODB.Recordset Dim fld As Field Set connection1 = New ADODB.Connection Set recset1 = New ADODB.Recordset Set recset2 = New ADODB.Recordset strSQL = "SELECT * FROM ado_test" strConn = "DRIVER={MySQL Connector/ODBC v5};" & _ "SERVER=localhost;DATABASE=ado" & _ ";UID=foo;PWD=bar;OPTION=3;" ' open connection connection1.ConnectionString = strConn connection1.CursorLocation = adUseClient ' connection1.CursorLocation = adUseServer connection1.Open strSQL = "SELECT * FROM ado_test" recset1.Open strSQL, connection1, adOpenStatic, _ adLockBatchOptimistic, adCmdText recset1.MoveFirst recset1.Fields(0).Value = 111 recset1.Fields(1).Value = "test" recset1.UpdateBatch Debug.Print "New Status: " & recset1.Status recset1.Close Set recset1 = Nothing connection1.Close Set connection1 = Nothing Exit Sub EH: Debug.Print Err.Description & " " & Err.Number & vbNewLine Resume Next End Sub