From c7851c5d9880d518447ebf168fc640ae5743d261 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 1 Jun 2026 11:20:27 +0200 Subject: [PATCH] =?UTF-8?q?-=202026-05-29=201.1.18=20Correcci=C3=B3n=20rut?= =?UTF-8?q?ina=20LeeMysql=20y=20LeeMysqlBytArray=20para=20que=20como=20max?= =?UTF-8?q?imo=20se=20admitan=202048=20caracteres=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbdd.vb | 17 ++++++++++------- tsUtilidades.vbproj | 3 ++- 2 files changed, 12 insertions(+), 8 deletions(-) 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