Bug #62094 char field mapped to System.String of MaxLength=3*len(char) in .NET/Connector
| Submitted: | 5 Aug 2011 14:39 | Modified: | 29 Sep 2011 20:52 |
|---|---|---|---|
| Reporter: | River D | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / NET | Severity: | S2 (Serious) |
| Version: | 6.4.3 | OS: | Windows |
| Assigned to: | Fernando Gonzalez.Sanchez | CPU Architecture: | Any |
| Tags: | .net/connector, char, maxlength, System.String | ||
[5 Aug 2011 14:39]
River D
[5 Aug 2011 15:37]
Valeriy Kravchuk
Please, send the output of: show create table tbltest\G show variables like 'char%'; from your MySQL server. I wonder if utf8 character set is used.
[9 Aug 2011 3:14]
River D
Hi, Valeriy Kravchuk,
Apologize for late response.
It is sure I am using utf8 character set.
But I wonder this can cause problems in .NET programming.
Ex: I want to restrict MaxLength of all TextBoxes on a form by means of MaxLength of the bound text programmatically as follows:
private void setMaxLength()
{
foreach (Control c in this.Controls)
{
if (c is TextBox)
{
TextBox t = (TextBox)c;
string fld = t.DataBindings["text"].BindingMemberInfo.BindingField;
if (dataSet1.t1.Columns[fld].DataType.ToString() == "System.String")
t.MaxLength = dataSet1.t1.Columns[fld].MaxLength;
}
}
}
Since the varchar and char fields in MySQL are both reflected to a column DataType of "System.String", the corresponding MaxLength of the TextBox will be set to 3 times of the field length in MySQL.
Any suggestions?
[9 Aug 2011 6:06]
River D
Sorry, the corresponding MaxLength of the TextBox whose Text attribute is bound with a char field will be set to 3 times of the field length in MySQL.
[29 Sep 2011 20:52]
Fernando Gonzalez.Sanchez
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at http://www.mysql.com/downloads/ This was fixed in releases 6.2.6, 6.3.8, 6.4.4.
[29 Feb 2012 21:29]
John Russell
Added to changelog for 6.2.6, 6.3.8, 6.4.4: When creating a tableadapter through a Dataset form in Visual Studio, the MaxLength of the field for a CHAR column could be set to 3 times the length of the table column. Although this many bytes could be needed to hold a UTF-8 character value, the length value was not appropriate for restricting the length of a TextBox.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.