Changeset 15752

Show
Ignore:
Timestamp:
28.05.2008 14:48:39 (11 years ago)
Author:
mdewsnip
Message:

(Adding dynamic classifiers) Added getmetadatavalues() function, which will not be part of dbclass because it cannot be implemented efficiently by gdbmclass.

Location:
gsdl/trunk/lib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/lib/sqlitedbclass.cpp

    r15679 r15752  
    138138 
    139139 
     140text_tarray sqlitedbclass::getmetadatavalues (const text_t &metadata_element_name) 
     141{ 
     142  text_tarray metadata_values; 
     143 
     144  // Get all the entries in the "value" column of the "document_metadata" table 
     145  text_t sql_cmd = "SELECT value FROM document_metadata WHERE element='" + metadata_element_name + "'"; 
     146  vector<text_tmap> sql_results; 
     147  if (!sqlgetarray(sql_cmd, sql_results) || sql_results.size() == 0) 
     148  { 
     149    return metadata_values; 
     150  } 
     151 
     152  // Iterate through the values and add them to the array to be returned 
     153  vector<text_tmap>::iterator sql_results_iterator = sql_results.begin(); 
     154  while (sql_results_iterator != sql_results.end()) 
     155  { 
     156    text_tmap sql_result = (*sql_results_iterator); 
     157    metadata_values.push_back(sql_result["value"]); 
     158    sql_results_iterator++; 
     159  } 
     160 
     161  return metadata_values; 
     162} 
     163 
     164 
    140165// returns true on success 
    141166bool sqlitedbclass::setkeydata (const text_t &key, const text_t &data) 
  • gsdl/trunk/lib/sqlitedbclass.h

    r15679 r15752  
    5454  text_tarray getkeys (); 
    5555 
     56  // returns array of values 
     57  text_tarray getmetadatavalues (const text_t &metadata_element_name); 
     58 
    5659  // returns true on success 
    5760  bool setkeydata (const text_t &key, const text_t &data);