@@ -1246,7 +1246,7 @@ protected void WriteRawParameter(IXdrWriter xdr, DbField field)
1246
1246
else
1247
1247
{
1248
1248
var svalue = field . DbValue . GetString ( ) ;
1249
- if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . Length > field . CharCount )
1249
+ if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . RuneCount ( ) > field . CharCount )
1250
1250
{
1251
1251
throw IscException . ForErrorCodes ( new [ ] { IscCodes . isc_arith_except , IscCodes . isc_string_truncation } ) ;
1252
1252
}
@@ -1271,7 +1271,7 @@ protected void WriteRawParameter(IXdrWriter xdr, DbField field)
1271
1271
else
1272
1272
{
1273
1273
var svalue = field . DbValue . GetString ( ) ;
1274
- if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . Length > field . CharCount )
1274
+ if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . RuneCount ( ) > field . CharCount )
1275
1275
{
1276
1276
throw IscException . ForErrorCodes ( new [ ] { IscCodes . isc_arith_except , IscCodes . isc_string_truncation } ) ;
1277
1277
}
@@ -1394,7 +1394,7 @@ protected async ValueTask WriteRawParameterAsync(IXdrWriter xdr, DbField field,
1394
1394
else
1395
1395
{
1396
1396
var svalue = await field . DbValue . GetStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
1397
- if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . Length > field . CharCount )
1397
+ if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . RuneCount ( ) > field . CharCount )
1398
1398
{
1399
1399
throw IscException . ForErrorCodes ( new [ ] { IscCodes . isc_arith_except , IscCodes . isc_string_truncation } ) ;
1400
1400
}
@@ -1419,7 +1419,7 @@ protected async ValueTask WriteRawParameterAsync(IXdrWriter xdr, DbField field,
1419
1419
else
1420
1420
{
1421
1421
var svalue = await field . DbValue . GetStringAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
1422
- if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . Length > field . CharCount )
1422
+ if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 && svalue . RuneCount ( ) > field . CharCount )
1423
1423
{
1424
1424
throw IscException . ForErrorCodes ( new [ ] { IscCodes . isc_arith_except , IscCodes . isc_string_truncation } ) ;
1425
1425
}
@@ -1533,7 +1533,7 @@ protected object ReadRawValue(IXdrReader xdr, DbField field)
1533
1533
{
1534
1534
var s = xdr . ReadString ( innerCharset , field . Length ) ;
1535
1535
if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 &&
1536
- s . Length > field . CharCount )
1536
+ s . RuneCount ( ) > field . CharCount )
1537
1537
{
1538
1538
return s . Substring ( 0 , field . CharCount ) ;
1539
1539
}
@@ -1630,7 +1630,7 @@ protected async ValueTask<object> ReadRawValueAsync(IXdrReader xdr, DbField fiel
1630
1630
{
1631
1631
var s = await xdr . ReadStringAsync ( innerCharset , field . Length , cancellationToken ) . ConfigureAwait ( false ) ;
1632
1632
if ( ( field . Length % field . Charset . BytesPerCharacter ) == 0 &&
1633
- s . Length > field . CharCount )
1633
+ s . RuneCount ( ) > field . CharCount )
1634
1634
{
1635
1635
return s . Substring ( 0 , field . CharCount ) ;
1636
1636
}
0 commit comments