- Timestamp:
- 2008-05-29T15:52:50+12:00 (16 years ago)
- Location:
- gsdl/trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/lib/sqldbclass.h
r15796 r15803 42 42 // These functions MUST be implemented by subclasses, as they are database-specific 43 43 44 // returns array of document OIDs 45 virtual text_tarray get_documents_with_metadata_value (const text_t &metadata_element_name, 46 const text_t &metadata_value) = 0; 47 44 48 // returns array of values 45 49 virtual text_tarray get_metadata_values (const text_t &metadata_element_name) = 0; -
gsdl/trunk/lib/sqlitedbclass.cpp
r15800 r15803 97 97 98 98 99 // returns array of document OIDs 100 text_tarray sqlitedbclass::get_documents_with_metadata_value (const text_t &metadata_element_name, 101 const text_t &metadata_value) 102 { 103 text_tarray document_OIDs; 104 105 // Check a metadata element and value has been specified 106 if (metadata_element_name == "" || metadata_value == "") 107 { 108 return document_OIDs; 109 } 110 111 // Get the entries in the "document_metadata" table where the element and value matches those specified 112 text_t sql_cmd = "SELECT docOID FROM document_metadata WHERE element='" + metadata_element_name + "' AND value='" + metadata_value + "'"; 113 vector<text_tmap> sql_results; 114 if (!sqlgetarray(sql_cmd, sql_results) || sql_results.size() == 0) 115 { 116 return document_OIDs; 117 } 118 119 // Iterate through the documents and add them to the array to be returned 120 vector<text_tmap>::iterator sql_results_iterator = sql_results.begin(); 121 while (sql_results_iterator != sql_results.end()) 122 { 123 text_tmap sql_result = (*sql_results_iterator); 124 document_OIDs.push_back(sql_result["docOID"]); 125 sql_results_iterator++; 126 } 127 128 return document_OIDs; 129 } 130 131 99 132 // returns file extension string 100 133 text_t sqlitedbclass::getfileextension () … … 157 190 } 158 191 159 // Get the entries in the " value" column of the "document_metadata" table where the element matches192 // Get the entries in the "document_metadata" table where the element matches that specified 160 193 text_t sql_cmd = "SELECT value FROM document_metadata WHERE element='" + metadata_element_name + "'"; 161 194 vector<text_tmap> sql_results; -
gsdl/trunk/lib/sqlitedbclass.h
r15796 r15803 45 45 void deletekey (const text_t &key); 46 46 47 // returns array of document OIDs 48 text_tarray get_documents_with_metadata_value (const text_t &metadata_element_name, 49 const text_t &metadata_value); 50 47 51 // returns file extension string 48 52 text_t getfileextension ();
Note:
See TracChangeset
for help on using the changeset viewer.