LCOV - code coverage report
Current view: top level - backends/flint - flint_record.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 14 14 100.0 %
Date: 2011-08-21 Functions: 4 4 100.0 %
Branches: 4 4 100.0 %

           Branch data     Line data    Source code
       1                 :            : /* flint_record.cc: Records in flint databases
       2                 :            :  *
       3                 :            :  * Copyright 2002 Ananova Ltd
       4                 :            :  * Copyright 2002,2003,2004,2005,2008 Olly Betts
       5                 :            :  *
       6                 :            :  * This program is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU General Public License as
       8                 :            :  * published by the Free Software Foundation; either version 2 of the
       9                 :            :  * License, or (at your option) any later version.
      10                 :            :  *
      11                 :            :  * This program is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            :  * GNU General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU General Public License
      17                 :            :  * along with this program; if not, write to the Free Software
      18                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
      19                 :            :  * USA
      20                 :            :  */
      21                 :            : 
      22                 :            : #include <config.h>
      23                 :            : #include "flint_record.h"
      24                 :            : #include "flint_utils.h"
      25                 :            : #include "str.h"
      26                 :            : #include <xapian/error.h>
      27                 :            : #include "debuglog.h"
      28                 :            : #include "omassert.h"
      29                 :            : 
      30                 :            : using std::string;
      31                 :            : 
      32                 :            : string
      33                 :     378346 : FlintRecordTable::get_record(Xapian::docid did) const
      34                 :            : {
      35                 :            :     LOGCALL(DB, string, "FlintRecordTable::get_record", did);
      36                 :     378346 :     string tag;
      37                 :            : 
      38         [ +  + ]:     378352 :     if (!get_exact_entry(flint_docid_to_key(did), tag)) {
      39                 :     378340 :         throw Xapian::DocNotFoundError("Document " + str(did) + " not found.");
      40                 :            :     }
      41                 :            : 
      42                 :       9052 :     RETURN(tag);
      43                 :            : }
      44                 :            : 
      45                 :            : Xapian::doccount
      46                 :     225993 : FlintRecordTable::get_doccount() const
      47                 :            : {   
      48                 :            :     LOGCALL(DB, Xapian::doccount, "FlintRecordTable::get_doccount", NO_ARGS);
      49                 :            :     STATIC_ASSERT_TYPE_DOMINATES(Xapian::doccount, flint_tablesize_t);
      50                 :     225993 :     RETURN(get_entry_count());
      51                 :            : }
      52                 :            : 
      53                 :            : void
      54                 :      47468 : FlintRecordTable::replace_record(const string & data, Xapian::docid did)
      55                 :            : {
      56                 :            :     LOGCALL_VOID(DB, "FlintRecordTable::replace_record", data | did);
      57                 :      47468 :     add(flint_docid_to_key(did), data);
      58                 :      47468 : }
      59                 :            : 
      60                 :            : void
      61                 :       9882 : FlintRecordTable::delete_record(Xapian::docid did)
      62                 :            : {
      63                 :            :     LOGCALL_VOID(DB, "FlintRecordTable::delete_record", did);
      64         [ +  + ]:       9882 :     if (!del(flint_docid_to_key(did)))
      65                 :          3 :         throw Xapian::DocNotFoundError("Can't delete non-existent document #" + str(did));
      66                 :       9879 : }

Generated by: LCOV version 1.8