Просмотр исходного кода

if there is an existing * or ? then don't put *'s around it
[SAB]


git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@158 595ec19a-5cb4-439b-94a8-42fb3063c22c

sabrogden 20 лет назад
Родитель
Сommit
8424c77c5b
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      FormatSQL.cpp

+ 9 - 1
FormatSQL.cpp

@@ -122,7 +122,15 @@ bool CFormatSQL::AddToSQL(CString cs, eSpecialTypes &eNOTValue, eSpecialTypes &e
 	CString csThisSQL;
 	cs.TrimLeft();
 	cs.TrimRight();
-	csThisSQL.Format("%s%sLIKE \'*%s*\'", m_csVariable, GetKeyWordString(eNOTValue), cs);
+
+	if(cs.Find("*") < 0 && cs.Find("?") < 0)
+	{
+		csThisSQL.Format("%s%sLIKE \'*%s*\'", m_csVariable, GetKeyWordString(eNOTValue), cs);
+	}
+	else
+	{
+		csThisSQL.Format("%s%sLIKE \'%s\'", m_csVariable, GetKeyWordString(eNOTValue), cs);
+	}
 
 	if(m_csWhere.GetLength() > 0)
 	{