Bug #67702 | Problem with BIT columns in MS Access | ||
---|---|---|---|
Submitted: | 25 Nov 2012 15:45 | Modified: | 20 Dec 2012 22:25 |
Reporter: | Sue J | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / ODBC | Severity: | S2 (Serious) |
Version: | 5.2.2 | OS: | Windows |
Assigned to: | Bogdan Degtyariov | CPU Architecture: | Any |
[25 Nov 2012 15:45]
Sue J
[3 Dec 2012 17:04]
Lawrenty Novitsky
Could you please try NO_SSPS connection string option(Prepare statements on client) to check if the problem persists?
[3 Dec 2012 19:20]
Sue J
Yes, that seems to resolve the problem. Does it affect performance in any way?
[4 Dec 2012 4:48]
Bogdan Degtyariov
The performance can decrease if your front end client (MS Access) prepares INSERT query once and then only supplies the data for the prepared query. So far I have not observed such behavior with MS Access installed in my system. Therefore, the performance for that particular client should not change. In any case you can disregard such issues as with the manual data entering/editing even a much bigger performance impact can be unnoticed.
[11 Dec 2012 2:30]
Bogdan Degtyariov
Another workaround is to use ADO instead of DAO. The following test case works well for me: ' create table bug67702(id int primary key auto_increment, ' vc varchar(32), yesno bit(1)); Sub bug67702() Dim conn As ADODB.Connection Set conn = New ADODB.Connection Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset conn.Open "DSN=test52w", "******", "******", 0 rs.Open "SELECT * FROM bug67702", conn, adOpenDynamic, adLockOptimistic With rs .AddNew !vc = "abcd 1234" !yesno = 1 .Update End With End Sub
[11 Dec 2012 2:49]
Bogdan Degtyariov
The DAO test case worked without problems as well: Sub bug67702() Dim ws As DAO.Workspace Dim db As DAO.Database Dim rs As DAO.Recordset Set ws = DBEngine.Workspaces(0) Set db = ws.OpenDatabase("", False, False, "ODBC;DSN=test52w") Set rs = db.OpenRecordset("SELECT * FROM bug67702") With rs .AddNew !vc = "abcd 1234" !yesno = 1 .Update End With End Sub
[11 Dec 2012 2:59]
Bogdan Degtyariov
Manual typing the value 1 in the bit field causes error. Verified with ODBC driver version 5.2.2.
[11 Dec 2012 6:39]
Bogdan Degtyariov
The executed statement on the server looks as follows: UPDATE `bug67702` SET `yesno`='1' WHERE `id` = '5' AND `vc` = 'bbb' AND `yesno` = '0' This is not right because `yesno` column is assigned the value 31, which is the code of symbol '1'. It is out of the allowed range, so the insert fails.
[13 Dec 2012 14:42]
Bogdan Degtyariov
Patch and test case
Attachment: bug67702.diff (application/octet-stream, text), 3.97 KiB.
[13 Dec 2012 23:38]
Lawrenty Novitsky
The patch has been pushed as rev#1104 and is supposed to be released in 5.2.3
[20 Dec 2012 22:25]
John Russell
Added to changelog for 5.2.3: Insert operations could fail if the inserted values contained any bit fields, mapped to table columns declared as bit(1): Data too long for column 'column_name'