| 1713 | } |
| 1714 | |
| 1715 | bool WizIndex::documentFromLocationAndName(const CString& strLocation, const CString& strName, WIZDOCUMENTDATA& data) |
| 1716 | { |
| 1717 | if (!strLocation || !*strLocation) { |
| 1718 | TOLOG("Location is empty"); |
| 1719 | return false; |
| 1720 | } |
| 1721 | |
| 1722 | if (!strName || !*strName) { |
| 1723 | TOLOG("Name is empty"); |
| 1724 | return false; |
| 1725 | } |
| 1726 | |
| 1727 | CString strWhere; |
| 1728 | strWhere.format("DOCUMENT_LOCATION like %s AND DOCUMENT_NAME like %s", |
| 1729 | STR2SQL(strLocation).utf16(), |
| 1730 | STR2SQL(strName).utf16() |
| 1731 | ); |
| 1732 | |
| 1733 | CString strSQL = formatQuerySQL(TABLE_NAME_WIZ_DOCUMENT, FIELD_LIST_WIZ_DOCUMENT, strWhere); |
| 1734 | |
| 1735 | CWizDocumentDataArray arrayDocument; |
| 1736 | if (!sqlToDocumentDataArray(strSQL, arrayDocument)) { |
| 1737 | TOLOG("Failed to get document by guid"); |
| 1738 | return false; |
| 1739 | } |
| 1740 | |
| 1741 | if (arrayDocument.empty()) { |
| 1742 | //TOLOG("Failed to get document by guid, result is empty"); |
| 1743 | return false; |
| 1744 | } else if (arrayDocument.size() > 1) { |
| 1745 | CWizDocumentDataArray::const_iterator it; |
| 1746 | for (it = arrayDocument.begin(); it != arrayDocument.end(); it++) { |
| 1747 | TOLOG(WizFormatString5("Warning: Too more file name %1 in %2, Title=%3, FileName=%4, GUID=%5", strName, strLocation, it->strTitle, it->strName, it->strGUID)); |
| 1748 | } |
| 1749 | } |
| 1750 | |
| 1751 | data = arrayDocument[0]; |
| 1752 | return true; |
| 1753 | } |
| 1754 | |
| 1755 | bool WizIndex::changeDocumentsLocation(const CString& strOldLocation, const CString& strNewLocation) |
| 1756 | { |