2

Estoy inentando construir una string con multiples SQL queries para ejecutarla en una database de SQLite, pero solo me permite almacenar 4096 caracteres en la string, he probado con AnsiStrings pero es la misma cosa.

Estoy usando Delphi Berlin 10.1 Esta es la seccion de mi codigo

for i := 1 to S.Count-1 do
  begin
    //checkeamos que no halla algun tipo de valor faltante en la cadena, estamos comprobando:
    //0,9,9,9,9,1,2,00:00
    D.Clear;
    D.CommaText := s[i];

    //ShowMessage(D[7]);
    if Length(D[7])=4 then
      begin
        Aux:=D[7];
        insert('0', Aux, 1);
        D[7]:=Aux;
      end;
    //ShowMessage(D[7]);
    R[0]:=R[0]+D[0];
    R[1]:=R[1]+D[1];
    R[2]:=R[2]+D[2];
    R[3]:=R[3]+D[3];
    R[4]:=R[4]+D[4];
    //ZQuery1.Close;
    //ZQuery1.SQL.Clear;
    sqlQuery:= sqlQuery+'Insert Into numbers(Date,A,B,C,D,E) Values("'+formatdatetime('yyyy-mm-dd', Fecha)+' '+D[7]+':00","'+D[0]+'","'+D[1]+'","'+D[2]+'","'+D[3]+'","'+D[4]+'");';
    //ZQuery1.SQL.Add(sqlQuery);
    //ZQuery1.ExecSQL;
    //preparamos la consulta
    //0,9,9,9,9,1,2,00:00

  end;

Este es el resultado truncado de la string sqlQuery:

'Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:05:00","1","4","6","5","5");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:10:00","5","2","1","1","1");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:15:00","9","3","8","5","8");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:20:00","7","7","8","2","8");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:25:00","0","1","9","1","8");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:30:00","1","2","3","5","3");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:35:00","7","9","2","0","6");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:40:00","0","8","0","6","9");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:45:00","7","6","0","1","2");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:50:00","5","0","7","5","8");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 00:55:00","9","9","8","7","4");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:00:00","3","7","3","5","7");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:05:00","6","4","2","5","0");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:10:00","2","3","6","5","3");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:15:00","6","7","1","0","0");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:20:00","5","8","1","7","0");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:25:00","1","0","3","3","2");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:30:00","4","7","9","9","5");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:35:00","1","6","0","9","9");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:40:00","2","8","6","1","9");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:45:00","3","8","4","0","1");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:50:00","1","1","2","7","8");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 01:55:00","3","8","2","3","9");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:00:00","5","5","8","6","3");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:05:00","2","9","1","9","1");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:10:00","9","5","6","9","5");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:15:00","0","3","2","6","2");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:20:00","2","2","9","0","8");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:25:00","1","3","8","7","9");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:30:00","3","6","6","7","2");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:35:00","8","2","2","6","8");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:40:00","2","5","8","0","6");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:45:00","5","9","0","2","9");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:50:00","1","2","1","8","4");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 02:55:00","1","9","7","8","4");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:00:00","7","5","5","1","0");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:05:00","7","5","6","5","3");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:10:00","2","1","9","0","2");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:15:00","6","9","0","1","5");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:20:00","9","4","5","8","5");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:25:00","5","6","8","5","9");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:30:00","9","3","7","1","1");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:35:00","5","9","4","2","6");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:40:00","7","5","3","5","5");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:45:00","3","2","4","2","7");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:50:00","4","0","5","7","3");Insert Into numbers(Date,A,B,C,D,E) Values("2017-03-26 03:55:00","7","8","9","8","5");Insert Into numbers(Date,A,B,C,D,E) Values("2017...

Se trunco al 4096 caracter, alguna manera de arreglar esto?

3
  • Todavia sigues teniendo problemas? ya que el string no deberia fallar en el caracter 4096
    – JGarnica
    Commented el 21 abr. 2017 a las 23:32
  • Aun sigo teniendo ese problema, al final tuve que usar un vector para almacenar la string, de alli si la leo sin problemas
    – Martini002
    Commented el 22 abr. 2017 a las 3:19
  • Que raro, probaste asignadole un tamano de manera dinamica con setlength mayor a 4096 haber si hay alguna mejora?
    – JGarnica
    Commented el 22 abr. 2017 a las 3:21

1 respuesta 1

1

Si estás revisando la variable sqlQuery en el debugger de Delphi,existe un límite de 4096 caracteres y es por eso que puedes ver los tres puntos "..." al final del string.

Si escribes el string en un memo o un archivo deberías poder ver todo el contenido.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.