diff --git a/bbdd.vb b/bbdd.vb index 71621d5..33b039d 100644 --- a/bbdd.vb +++ b/bbdd.vb @@ -4,6 +4,7 @@ Imports System.Data.Common Imports System.Data.SqlClient Imports System.Globalization Imports System.IO +Imports tsUtilidades.Extensiones Public Class bbdd Public Shared Function EjeMySqlHex(BD As DbConnection, sqlh As String) As String Try @@ -85,7 +86,7 @@ Public Class bbdd Tipo = "N" Tamaño = 20 End Select - If Tamaño <= 1024 Then + If Tamaño <= 2048 Then sLinea &= dc.ColumnName & "(" & Tipo & iInicioBuffer.ToString & ";" & Tamaño.ToString & ")|" iInicioBuffer += Tamaño End If @@ -96,10 +97,11 @@ Public Class bbdd For Each dc In dt.Columns Select Case dc.DataType Case GetType(String) + Dim tam = System.Math.Min(2048, dc.MaxLength) If Not dr(dc) Is DBNull.Value Then - sLinea &= dr(dc).ToString.PadRight(dc.MaxLength, " ") + sLinea &= dr(dc).ToString.Acortar(tam).PadRight(tam, " ") Else - sLinea &= "".PadRight(System.Math.Min(2048, dc.MaxLength), " ") + sLinea &= "".PadRight(tam, " ") End If Case GetType(DateTime), GetType(Date) Dim sFecha As String = "null" @@ -151,7 +153,7 @@ Public Class bbdd Select Case dc.DataType Case GetType(String) Tipo = "X" - Tamaño = dc.MaxLength + Tamaño = System.Math.Min(2048, dc.MaxLength) Case GetType(DateTime), GetType(Date) Tipo = "F" Tamaño = 20 @@ -159,7 +161,7 @@ Public Class bbdd Tipo = "N" Tamaño = 20 End Select - If Tamaño <= 1024 Then + If Tamaño <= 2048 Then sLinea &= dc.ColumnName & "(" & Tipo & iInicioBuffer.ToString & ";" & Tamaño.ToString & ")|" iInicioBuffer += Tamaño End If @@ -170,10 +172,11 @@ Public Class bbdd For Each dc In dt.Columns Select Case dc.DataType Case GetType(String) + Dim tam = System.Math.Min(2048, dc.MaxLength) If Not dr(dc) Is DBNull.Value Then - sLinea &= dr(dc).ToString.PadRight(dc.MaxLength, " ") + sLinea &= dr(dc).ToString.Acortar(tam).PadRight(tam, " ") Else - sLinea &= "".PadRight(dc.MaxLength, " ") + sLinea &= "".PadRight(tam, " ") End If Case GetType(DateTime), GetType(Date) Dim sFecha As String = "null" diff --git a/tsUtilidades.vbproj b/tsUtilidades.vbproj index 1fc2a44..89333c4 100644 --- a/tsUtilidades.vbproj +++ b/tsUtilidades.vbproj @@ -16,11 +16,12 @@ net8.0 tsUtilidades net8.0, libreria - 1.1.17 + 1.1.18 Manuel Tecnosis S.A Utilidades Varias + - 2026-05-29 1.1.18 Corrección rutina LeeMysql y LeeMysqlBytArray para que como maximo se admitan 2048 caracteres string - 2026-05-29 1.1.17 Corrección rutina LeeMysql para que como maximo se admitan 2048 caracteres string - 2026-05-19 1.1.16 Corrección multiplataforma tsNotificacionesClient - 2026-05-12 1.1.15 Se corrige tsNotificacionesClient