LCOV - code coverage report
Current view: top level - backends/flint - flint_document.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 12 13 92.3 %
Date: 2011-08-21 Functions: 4 5 80.0 %
Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* flint_document.cc: Implementation of document for Flint database
       2                 :            :  *
       3                 :            :  * Copyright 1999,2000,2001 BrightStation PLC
       4                 :            :  * Copyright 2002 Ananova Ltd
       5                 :            :  * Copyright 2003,2004,2008 Olly Betts
       6                 :            :  *
       7                 :            :  * This program is free software; you can redistribute it and/or
       8                 :            :  * modify it under the terms of the GNU General Public License as
       9                 :            :  * published by the Free Software Foundation; either version 2 of the
      10                 :            :  * License, or (at your option) any later version.
      11                 :            :  *
      12                 :            :  * This program is distributed in the hope that it will be useful,
      13                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15                 :            :  * GNU General Public License for more details.
      16                 :            :  *
      17                 :            :  * You should have received a copy of the GNU General Public License
      18                 :            :  * along with this program; if not, write to the Free Software
      19                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
      20                 :            :  * USA
      21                 :            :  */
      22                 :            : 
      23                 :            : #include <config.h>
      24                 :            : #include "flint_document.h"
      25                 :            : 
      26                 :            : #include "debuglog.h"
      27                 :            : #include "flint_database.h"
      28                 :            : #include "flint_values.h"
      29                 :            : #include "flint_record.h"
      30                 :            : 
      31                 :            : /** Create a FlintDocument: this is only called by
      32                 :            :  *  FlintDatabase::open_document().
      33                 :            :  */
      34                 :     294737 : FlintDocument::FlintDocument(Xapian::Internal::RefCntPtr<const Xapian::Database::Internal> database_,
      35                 :            :                                const FlintValueTable *value_table_,
      36                 :            :                                const FlintRecordTable *record_table_,
      37                 :            :                                Xapian::docid did_, bool lazy)
      38                 :            :         : Xapian::Document::Internal(database_.get(), did_),
      39                 :            :           database(database_),
      40                 :            :           value_table(value_table_),
      41                 :     294737 :           record_table(record_table_)
      42                 :            : {
      43                 :            :     LOGCALL_CTOR(DB, "FlintDocument", database_ | value_table_ | record_table_ | did_ | lazy);
      44                 :            :     // FIXME: this should work but isn't great - in fact I wonder if
      45                 :            :     // we should cache the results anyway...
      46   [ +  +  #  # ]:     294737 :     if (!lazy) (void)record_table->get_record(did);
      47                 :     303787 : }
      48                 :            : 
      49                 :            : /** Retrieve a value from the database
      50                 :            :  *
      51                 :            :  *  @param valueid      The value number to retrieve.
      52                 :            :  */
      53                 :            : string
      54                 :     113676 : FlintDocument::do_get_value(Xapian::valueno valueid) const
      55                 :            : {
      56                 :            :     LOGCALL(DB, string, "FlintDocument::do_get_value", valueid);
      57                 :     113676 :     string retval;
      58                 :     113676 :     value_table->get_value(retval, did, valueid);
      59                 :          0 :     RETURN(retval);
      60                 :            : }
      61                 :            : 
      62                 :            : /** Retrieve all value values from the database
      63                 :            :  */
      64                 :            : void
      65                 :     172473 : FlintDocument::do_get_all_values(map<Xapian::valueno, string> & values_) const
      66                 :            : {
      67                 :            :     LOGCALL_VOID(DB, "FlintDocument::do_get_all_values", values_);
      68                 :     172473 :     value_table->get_all_values(values_, did);
      69                 :     172473 : }
      70                 :            : 
      71                 :            : /** Retrieve the document data from the database
      72                 :            :  */
      73                 :            : string
      74                 :     151667 : FlintDocument::do_get_data() const
      75                 :            : {
      76                 :            :     LOGCALL(DB, string, "FlintDocument::do_get_data", NO_ARGS);
      77                 :     151667 :     RETURN(record_table->get_record(did));
      78                 :            : }

Generated by: LCOV version 1.8