Re: Insert asc(0) characters in strings




"Mikael Lenfors" <mikael@xxxxxxxxxx> wrote

We have data strings containing all 256 ascii characters
(from 0-255). When I Try to insert them into the database
it fails.
I'm replacing ' characters with two ', this seems to work.

Mikael, What do you mean by "characters with two"?

The problem seems to be all characters with ascii value 0.

I am not surprised. You probably know that ASCII 0
(also known as #0) is used as a string terminator in
a lot of code.

How can I insert them? My insert looks like:
ADOQuery.SQL.Add(
'Insert Into RadarData (DataString) Values (' +
StringReplace(MyData,'''','''''',[rfReplaceAll]) + ')' );
DataString is declared as Text and
MyData can be 100K big!

First, I suggest breaking that statement into three statements,
so that you can see the contents of the intermediate strings.

s := StringReplace(MyData,'''','''''',[rfReplaceAll]);
s := 'Insert Into RadarData (DataString) Values (' + s + ')';
ADOQuery.SQL.Add(s);

I suspect that IDE's debugger may not properly show beyond
the #0 characters, so you could also check the value of
length(s);

Good luck hunting, JohnH
.



Relevant Pages

  • Re: Image Module Bug
    ... This allows me to pass NULL characters. ... > I've got a problem with loading images using the Image Module. ... > black in my image which was screwing up the NULL string terminator. ... > This is also a problem when I am trying to do RGBA format because the ...
    (comp.lang.python)
  • Re: Using DLLImport with a function requiring char *
    ... Well, actualy all characters are passed, it's just ... as string terminator. ... Note that there is no need to specify LPStr as it's the default. ... > public unsafe static extern void SetCaption(void * Core, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Cycling to school - draft.
    ... At the moment it is about 80 characters per line which is perfect for two ... I'd advise avoiding it and replacing with a ... semi-bold or bold weight. ... Keep up the brilliant work. ...
    (uk.rec.cycling)
  • Re: Read/Write to file
    ... > whole data in one file and just replace characters. ... file and then replacing the old one with it tends to be simpler). ... You will probably have to do that manually, i.e. reading in lines, ... for the line count and increment it after each successful fgets(). ...
    (comp.lang.c)
  • Re: Batgirl: RIP
    ... I thought Batwoman and Bat-girl were mostly around in the ... A new generation is replacing you. ... the older characters stepping down or taking on new roles but I don't ... What's weird is Diddio's bringing back Ollie, Hal and Barry. ...
    (rec.arts.comics.dc.universe)