Bug #33130 MyODBC / ADO reading connection.property: Special Characters causes crash
Submitted: 11 Dec 2007 8:05 Modified: 10 Jan 10:30
Reporter: Eric MaLossi
Status: Closed
Category:Connector/ODBC Severity:S2 (Serious)
Version:5.1.0 OS:Microsoft Windows (xp sp2)
Assigned to: Jim Winstead Target Version:
Tags: ADO

[11 Dec 2007 8:05] Eric MaLossi
Description:
There are two problems found in the collection properties collection:

First property 62: "Driver ODBC Version" incorrectly reports the value "03.51"

Second property 64: "Special Characters" If the value of this property is read, the
invoking program will crash.

A test case for this bug has been committed to the ADO Compliance Tests Bug directory.  An
ODBC Trace is attached

How to repeat:
Sub Test()
  On Error Resume Next
  Dim strSQL, oConn, prop, bPass
  bPass = cBool(False)
  Set oConn = CreateObject("ADODB.Connection")
	
  ' open connection
  oConn.ConnectionString = connstr
  oConn.CursorLocation = adUseServer
  oConn.Open

   For Each prop In oConn.Properties
     If prop.name = "Driver ODBC Version" then
        Assert.Trace prop.Value
        Elseif prop.Name = "Special Characters" Then
        Assert.Trace prop.Value
     End If
   Next
End Sub
[11 Dec 2007 8:08] Eric MaLossi
ODBC Trace

Attachment: SQL.LOG (application/octet-stream, text), 47.12 KiB.

[11 Dec 2007 17:47] Jim Winstead
driver odbc version (SQL_DRIVER_ODBC_VER) should be 03.51, that's the version of the odbc
api that is implemented by the driver. there's another property to get the driver version
itself (SQL_DRIVER_VER).
[11 Dec 2007 18:47] Jim Winstead
the problem is probably that the list of special characters is hardcoded as a latin1
string, but it may not be converted properly.
[31 Dec 2007 22:11] Jess Balint
The doc says that this should contain any characters besides alpha-numeric characters that
are allowed in an identifier name. If one of these character is included, the identifier
must be "delimited".

I don't think there's any reason that characters above 0x7f (for latin1) or any other
characters besides what we already have should be included. I think we should just use: "
!\"#$%&'()*+,-.:;<=>?@[\\]^`{|}~"
[2 Jan 23:13] Jim Winstead
Remove latin1 chars and $ (no quoting required) from SQL_SPECIAL_CHARACTERS

Attachment: bug33130.patch (text/plain), 1.06 KiB.

[3 Jan 23:08] Jim Winstead
The fix for this bug was committed, and will be in 5.1.2.
[10 Jan 10:30] MC Brown
A note has been added to the 5.1.2 changelog: 

SQLGetInfo() reported characters for SQL_SPECIAL_CHARACTERS that were
not encoded correctly.
[15 Jan 17:09] Jess Balint
Bug#33875 was marked as a duplicate of this.