in reply to Re: Updating entry in DBM file adds extra character %09
in thread Updating entry in DBM file adds extra character %09

I'm passing with POST, but that's not the issue. When I first populate the record in the DBM file, no special characters are appended. The problem only occurs when I update a record in the DBM file.

This all has something to do, I think, with the fact that when I delete a record from the database it is still present when I open the .pag file in a text editor, yet will not show up in a search of the DBM using the 'each' function (the desired effect). Obviously, some sort of incomplete deletion seems to be affecting the updated record.

%09 is explained as the following on some sources I have read on the net: HT::=character_nbr(9)::= Move to next Tab-stop(ASCII'HT)\t. Decimal = 9, Hex = 09, ASCII = HT
  • Comment on Re: Re: Updating entry in DBM file adds extra character %09

Replies are listed 'Best First'.
Re: Re: Re: Updating entry in DBM file adds extra character %09
by dws (Chancellor) on Mar 18, 2002 at 05:57 UTC
    Don't be mislead by what a .pag file looks like in a text editor. When you delete a record, the space use for it in the file isn't reclaimed right away. A .pag file isn't like a flat text file, where deleting a line means rewriting the entire file to make the line really go away. As long as you can't get the deleted line back out of the DBM file via public interfaces, dont' worry about whether remnants of the record are still in the file.

    Show us the code that's setting up %header.

      >Show us the code that's setting up %header.

      Which code would that be? I think I posted the code that produces the %09. The only thing I didn't include was the part of the code that creates the html form with default values from the DBM file, but that part is just opening the DBM, reading the values into variables, and setting the default values of the html form to these variables. I open the database and read in as follows:

      dbmopen(%synusers,"synusers",0666) || die "Can't open synusers DBM fil +e\n"; #search database entries while (($key, $value) = each(%synusers)){ if (index($key,$fields{'alumnamelogin'})!=-1){ ($alumemail, $emailpub, $alumsnail1, $snail1pub, $alumsna +il2, $snail2pub, $alumsnail3, $snail3pub, $phone, $phonepub, $alumyears, $yearspub, $comment, $comme +ntpub, $synpass, $synpass2)=split(/::/,$value);
      ...Closing brackets later...

      Edit by dws for <code> tags</code>

        And I do the html defaults, for example, like this:
        Email: input type=text name=updalumemail value=$alumemail size=50 color=#ffffff>

        for some reason, this message board isn't letting me post that less than symbol there...anyway, u get the idea