Bug #25950 DataSourceInformation collection contains incorrect values
Submitted: 30 Jan 2007 15:41 Modified: 31 Jan 2007 15:36
Reporter: Sönke Schau Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:5.0.3 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[30 Jan 2007 15:41] Sönke Schau
Description:
The DataSourceInformation collection contains incorrect values.

First of all: Some of the values must be dependent on the OldSyntax Settings in the Connectionstring. If this Option is supplied, Parameter markers are question marks, otherwise parameter markers are "at" signs.

The DataSourceInformation contains the columns 

ParameterMarkerFormat
ParameterMarkerPattern

see doc at http://msdn2.microsoft.com/en-us/library/ms254501(VS.80).aspx

which are used to describe how Parameters are handled in a provider independent way.

In case of OldSyntax=true the Value of ParameterMarkerFormat should be changed to "@{0}"

In case of OldSyntax=false the Value of ParameterMarkerFormat should be changed to "?{0}" and
the Value of ParameterMarkerPattern should be changed to "\?([A-Za-z0-9_$#]*)"

How to repeat:
n. a.

Suggested fix:
Apply the changes described in the description.
[30 Jan 2007 22:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/19051
[30 Jan 2007 22:39] Reggie Burnett
Fixed in 5.0.4

We don't need to change ParameterMarkerFormat since the docs indicate that if the parameter name is expected to include the leading marker, then the pattern should be {0} which is what we have.
[31 Jan 2007 15:36] MC Brown
A note has been added to the 5.0.4 changelog.
[10 Aug 2007 20:28] Max Toro
> ParameterMarkerFormat
> ---------------------
>  A format string that represents how to format a parameter. 
> 
> If named parameters are supported by the data source, the first placeholder in this string should be where the parameter name should be formatted.

> For example, if the data source expects parameters to be named and prefixed with an ‘:’ this would be “:{0}”. When formatting this with a parameter name of “p1” the resulting string is “:p1”. 

> If the data source expects parameters to be prefixed with the ‘@’, but the names already include them, this would be ‘{0}’, and the result of formatting a parameter named “@p1” would simply be “@p1”.

//******** MySql returns {0}, so that means that the '?' is expected to be a part of the parameter name?

> For data sources that do not expect named parameters and expect the use of the ‘?’ character, the format string can be specified as simply ‘?’, which would ignore the parameter name. For OLE DB we return ‘?’.
 

> ParameterMarkerPattern
> ----------------------
>  A regular expression that matches a parameter marker. It will have a match value of the parameter name, if any.

> For example, if named parameters are supported with an ‘@’ lead-in character that will be included in the parameter name, this would be: “(@[A-Za-z0-9_$#]*)”.

//******** MySql returns ?([A-Za-z0-9_$#]*), so that means that the '?' is NOT expected to be a part of the parameter name?

> However, if named parameters are supported with a ‘:’ as the lead-in character and it is not part of the parameter name, this would be: “:([A-Za-z0-9_$#]*)”.

> Of course, if the data source doesn’t support named parameters, this would simply be “?”.