Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ IsMaxLengthViolated()

bool System.Data.DataColumn.IsMaxLengthViolated ( )
inlinepackage

Definition at line 1471 of file DataColumn.cs.

1472 {
1473 if (MaxLength < 0)
1474 {
1475 return true;
1476 }
1477 bool result = false;
1478 string text = null;
1479 foreach (DataRow row in Table.Rows)
1480 {
1481 if (!row.HasVersion(DataRowVersion.Current))
1482 {
1483 continue;
1484 }
1485 object obj = row[this];
1486 if (!_isSqlType)
1487 {
1488 if (obj != null && obj != DBNull.Value && ((string)obj).Length > MaxLength)
1489 {
1490 if (text == null)
1491 {
1492 text = ExceptionBuilder.MaxLengthViolationText(ColumnName);
1493 }
1495 row.SetColumnError(this, text);
1496 result = true;
1497 }
1498 }
1499 else if (!DataStorage.IsObjectNull(obj) && ((SqlString)obj).Value.Length > MaxLength)
1500 {
1501 if (text == null)
1502 {
1503 text = ExceptionBuilder.MaxLengthViolationText(ColumnName);
1504 }
1506 row.SetColumnError(this, text);
1507 result = true;
1508 }
1509 }
1510 return result;
1511 }
static bool IsObjectNull(object value)
DataRowCollection Rows
Definition DataTable.cs:701

References System.Data.DataColumn._isSqlType, System.Data.DataColumn.ColumnName, System.Xml.Dictionary, System.Data.Common.DataStorage.IsObjectNull(), System.Data.DataColumn.MaxLength, System.Data.ExceptionBuilder.MaxLengthViolationText(), System.obj, System.Data.DataTable.Rows, System.Data.DataColumn.Table, System.text, and System.DBNull.Value.