Changeset 15803 for gsdl/trunk/lib/sqlitedbclass.cpp
- Timestamp:
- 2008-05-29T15:52:50+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.