MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / TitleToSQL

Function TitleToSQL

src/database/WizIndex.cpp:2558–2640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2556}
2557
2558CString TitleToSQL(WizIndex& index, const CString& strKeywords, const WIZSEARCHDATA& data)
2559{
2560 bool bAddExtra = false;
2561 CString strTitle(data.strTitle);
2562 if (strTitle.isEmpty())
2563 {
2564 strTitle = strKeywords;
2565 bAddExtra = true;
2566 }
2567 //
2568 if (strTitle.isEmpty())
2569 return CString();
2570 //
2571 //
2572 CWizStdStringArray arrayWhere;
2573
2574 if (bAddExtra)
2575 {
2576 arrayWhere.push_back(WizFormatString1("(DOCUMENT_TITLE like %1)", STR2SQL_LIKE_BOTH(strTitle)));
2577 arrayWhere.push_back(WizFormatString1("(DOCUMENT_NAME like %1)", STR2SQL_LIKE_BOTH(strTitle)));
2578 arrayWhere.push_back(WizFormatString1("(DOCUMENT_SEO like %1)", STR2SQL_LIKE_BOTH(strTitle)));
2579 arrayWhere.push_back(WizFormatString1("(DOCUMENT_URL like %1)", STR2SQL_LIKE_BOTH(strTitle)));
2580 arrayWhere.push_back(WizFormatString1("(DOCUMENT_AUTHOR like %1)", STR2SQL_LIKE_BOTH(strTitle)));
2581 arrayWhere.push_back(WizFormatString1("(DOCUMENT_KEYWORDS like %1)", STR2SQL_LIKE_BOTH(strTitle)));
2582 if (data.strAttachmentName.isEmpty())
2583 {
2584 arrayWhere.push_back(WizFormatString1("(%1)", AttachmentNameToSQL(strTitle)));
2585 }
2586 if (data.arrayTag.empty())
2587 {
2588 CString strText = strTitle;
2589 //WizKMRegularTagsText(strText);
2590 //
2591 CWizStdStringArray arrayTag;
2592 ::WizSplitTextToArray(strText, ';', arrayTag);
2593 //
2594 CString strTagSQL = TagArrayToSQL(index, arrayTag);
2595 if (!strTagSQL.isEmpty())
2596 {
2597 arrayWhere.push_back(WizFormatString1("(%1)", strTagSQL));
2598 }
2599 }
2600 if (data.arrayFileType.empty())
2601 {
2602 CString strText = strTitle;
2603 //WizKMRegularTagsText(strText);
2604 //
2605 CWizStdStringArray arrayFileType;
2606 ::WizSplitTextToArray(strText, ';', arrayFileType);
2607 //
2608 CString strFileTypeSQL = FileTypeArrayToSQL(arrayFileType);
2609 if (!strFileTypeSQL.isEmpty())
2610 {
2611 arrayWhere.push_back(WizFormatString1("(%1)", strFileTypeSQL));
2612 }
2613 }
2614 CString strWhere;
2615 ::WizStringArrayToText(arrayWhere, strWhere, " or ");

Callers 1

searchMethod · 0.85

Calls 12

WizFormatString1Function · 0.85
AttachmentNameToSQLFunction · 0.85
WizSplitTextToArrayFunction · 0.85
TagArrayToSQLFunction · 0.85
FileTypeArrayToSQLFunction · 0.85
WizStringArrayToTextFunction · 0.85
isEmptyMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
CStringClass · 0.50
emptyMethod · 0.45
trimMethod · 0.45

Tested by

no test coverage detected