Menu

index is corrupt

Help
2002-10-07
2002-10-14
  • Frank Hoppe

    Frank Hoppe - 2002-10-07

    Hello, i'm a german and my english is very bad. the index-file is corrupt. source-code:

    // $this_pos is a offset in import-file
        if($this_pos==0){ // Index anlegen
          $struct = array(array("id", "str"), array("record", "str"));
          $idb = new TextDB;
          $idb->create($idx_kar_pkz, $struct, true);
        }
        else { // Index ffnen
          $idb = new TextDB;
          $idb->open($idx_kar_pkz);
        }  
    // write data
        for ($i=$this_pos;$i<$this_size;$i++) // DBF-Datei abarbeiten
        {
          $dbf->get_record($i); // Datensatz laden
          $Kar["PKZ"] = $eb->pkz($dbf->get_field("PKZ"));

          // Index ergnzen
          $recnum = $idb->find("id", $Kar["PKZ"]);
          $indexdata = $idb->get($recnum);
          if($indexdata==TRUE) {
            $indexdata["id"]=$Kar["PKZ"];
              $indexdata["record"]=$indexdata["record"]."|$i";
            $idb->edit($indexdata);
          }  
          else {
            $indexdata["id"]=$Kar["PKZ"];
              $indexdata["record"]=$i;
            $idb->add($indexdata);
          }
    //$Kar["PKZ"] is a string - sample "00001322" or "45123002", $i is a recordnumber in import-file.

        $idb->compact();
        $idb->close();
    -------------------------------------------
    When I looking in the data-file I find this records - sample:
    at pos 2345: 28035003   19530
    at pos 25134: 28035003   21859|21861|21862|21863|21864|21865|21866|21867|21868|21869|21870|21871|21872|21873|21874|21875
    at pos 30256: 28035003   21860|76162

    Is function compact buggy ?
    When you will, then I mail the complete source code and data ?!

    Thanks
    Samson

     
    • andy brandt

      andy brandt - 2002-10-14

      have you tried it without the compact function in there? if so, and it still doesn't work, i'd suggest sending me your code and data, and seeing if i can figure it out too.

      andy

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.