스토리지 프로세스는 복잡하고 복잡하지만 여러 논리적 문자를 지원할 수 있습니다. 이 테이블에서 검색하고 저장 프로 시저의 속도를 최적화하도록 선택할 수 있습니다. 저장된 절차에서 프로그램을 검색하는 ASP 및 저장된 절차의 코드 구현을 알고 있습니까? The Foot New Technology Channel의 편집자가 당신을 더 많이 배우게하십시오!
ASP 기능
코드 사본은 다음과 같습니다.함수 analysekeyword (a_strsource)
dim m_strdest, m_intloop
dim m_intbeginpos, m_intendpos
dim m_strhead, m_strmiddle, m_strail
m_strdest = a_strsource
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'먼저 끝에 공간을 제거하십시오
m_strdest = ltrim (rtrim (m_strdest))
'교체 &, "및"등을 +, -, 공백으로
m_strdest = replace (m_strdest, "&", "+")
m_strdest = replace (m_strdest, "및", "+")
m_strdest = replace (m_strdest, "또는", chr (32))
m_strdest = replace (m_strdest, "not", "-")
'변수를 초기화하여 다음 루프를 이동하십시오
m_intbeginpos = 1
m_intbeginpos <> 0 동안 수행하십시오
m_intbeginpos = inst (m_strdest, chr (32))
m_intbeginpos <> 0이면 '공간이 발견되면
m_stread = rtrim (ltrim (왼쪽 (m_strdest, m_intbeginpos))))))
Call Print ( "[anyalsekeyword ()] : space m_strhead =" + m_strhead)를 처리합니다.
m_strail = rtrim (ltrim (오른쪽 (m_strdest, len (m_strdest)) -m_intbeginpos)))))
Call Print ( "[anyalsekeyword ()] : space m_strail =" + m_strail)를 처리합니다.
m_strdest = m_strhead + "*" + m_strail
또 다른
출구
끝 If
고리
m_strdest = replace (m_strdest, "*", chr (32))
Call print ( "[anicalsekeyword ()] : 공간을 처리 한 후 m_strdest =" + m_strdest)
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'먼저 단일 따옴표를 이중 따옴표로 바꿉니다
m_strdest = replace (m_strdest, chr (39), chr (34))
'루프를 만들기 위해 초기 값을 설정하십시오
m_intbeginpos = 1
m_intendpos = 1
m_strhead = ""
m_strail = ""
m_intbeginpos <> 0 및 m_intendpos <> 0 동안 수행하십시오
'이중 인용문이 발견되면 시작 위치를 기록하고 다음 이중 견적을 찾으십시오.
m_intbeginpos = inst (m_strdest, chr (34))
m_intbeginpos <> 0이면 '첫 번째 견적이 발견되면'
Call print ( "[anicalsekeyword ()] : 첫 번째 견적이 나타나는 위치 :" + cstr (m_intbeginpos))
m_intendpos = instr (m_intbeginpos + 1, m_strdest, chr (34))
m_intendpos <> 0이면 '두 번째 견적이 발견되면'
Call print ( "[anicalsekeyword ()] : 두 번째 인용문이 나타나는 곳 :" + cstr (m_intendpos))
'전체 문자열을 따옴표로 세 단락으로 분리하십시오
Call print ( "[anyalsekeyword ()] : 처리 m_strdest =" + m_strdest)
m_strhead = 왼쪽 (m_strdest, m_intbeginpos -1)
Call print ( "[anyalsekeyword ()] : handles quotes m_strhead =" + m_strhead)
m_strmiddle = mid (m_strdest, m_intbeginpos + 1, m_intendpos -m_intbeginpos -1)
Call print ( "[anicalsekeyword ()] : 처리 인용문 m_strmiddle =" + m_strmiddle)
m_strail = right (m_strdest, len (m_strdest) -m_intendpos)
Call print ( "[anicalsekeyword ()] : m_strail =" + m_strail)
'따옴표에 A + 표시가 있으면 캐릭터로 처리되고 다른 캐릭터로 일시적으로 대체됩니다.
m_strmiddle = replace (m_strmiddle, "+", "|")
m_strdest = m_strhead + replace (rtrim (ltrim (m_strmiddle)), chr (32), "#") + m_strail
또 다른
출구
끝 If
또 다른
출구
끝 If
고리
m_strdest = replace (m_strdest, chr (34), "+")
Call print ( "[anyalsekeyword ()] : 견적 표시를 처리 한 후 m_strdest =" + m_strdest)
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'다중 플러스 표지판 문제 해결, 다중 플러스 표지판에 직면하면 논리적 문자가 아닌 문자열이라고 생각합니다.
m_strdest = replace (m_strdest, "+++", "|||")
m_strdest = replace (m_strdest, "++", "||")
Call Print ( "[AnalyseKeyword ()] : 다중 마이너스 부호를 처리 한 후 m_strdest = ' + m_strdest +"' ")
'플러스 부호의 양쪽에서 공간을 대하십시오
m_strdest = replace (m_strdest, " +", " +")
m_strdest = replace (m_strdest, "+", "+")
m_strdest = replace (m_strdest, " +", " +")
Call Print ( "[anicalsekeyword ()] : 마이너스 부호 M_Strdest = ' + M_Strdest +"' "")의 양쪽에서 공백을 처리 한 후)
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'여러 마이너스 부호 문제 해결, 다중 마이너스 부호가 발생하면 논리적 문자가 아닌 문자열이라고 생각할 수 있습니다.
m_strdest = replace (m_strdest, "---", "~~~~")
m_strdest = replace (m_strdest, "-", "~~")
Call Print ( "[AnalyseKeyword ()] : 다중 마이너스 부호를 처리 한 후 m_strdest = ' + m_strdest +"' ")
'마이너스 부호의 양쪽에서 공간을 대하십시오
m_strdest = replace (m_strdest, " -", " -")
m_strdest = replace (m_strdest, "-", "-")
m_strdest = replace (m_strdest, " -", " -")
Call print ( "[anicalsekeyword ()] : 플러스 부호의 양쪽에서 공백을 처리 한 후 m_strdest = ' + m_strdest +"' ")
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LEN (m_strdest)> = 3 인 경우
m_strhead = 왼쪽 (m_strdest, 1)
m_strmiddle = mid (m_strdest, 2, len (m_strdest) -2)
m_strail = right (m_strdest, 1)
m_strhead = "+"또는 m_strhead = "-"인 경우
m_strhead = ""
끝 If
m_strail = "+"또는 m_strail = "-"인 경우
m_strail = ""
끝 If
m_strdest = m_strhead + m_strmiddle + m_strail
끝 If
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
m_strdest = replace (m_strdest, "-", "~~")
m_strdest = replace (m_strdest, "++", "||")
m_strdest = replace (m_strdest, chr (32), "@")
AnalySekeyWord = M_Strdest
Call Print ( "[AnalyseKeyword ()] : 모든 처리가 완료된 후 m_strdest = ' + m_strdest +"' ")
엔드 기능
%>
저장된 절차
/*******************************************************/
/ * Proc Name : up_parsewordsearch */
/ * */
/ * 설명 : 키워드 검색 */
/ * */
/ * 매개 변수 : @A_STRCATEGORYID 카테고리 ID */
/ * @a_intposition 통화 위치 */
/ * @A_StrParseword 키워드 검색 */
/ * @a_introwCount는 최대 레코드 수를 제한합니다 */
/ * */
/ * 날짜 : 2000/6/28 */
/ * */
/ * 저자 : liuyunpeng */
/ * */
/* 역사: */
/*******************************************************/
존재하는 경우 (id = object_id ( "up_parsewordsearch")
proc up_parsewordsearch를 드롭합니다
가다
proc up_parsewordsearch @a_strparseword varchar (255) 만들기
@A_StrcategoryId varchar (255),
@a_intposition tinyint,
@A_IntrowCount int
~처럼
@M_STRSQLCONDITION VARCHAR (255) -SQL 문의 조건부 부분
@m_strsqlselect varchar (255) --sql 문 선택 부분을 선언하십시오
@M_STRSQLCATEGORY VARCHAR (100) -SQL 문의 카테고리 부분을 선언합니다
/*통화 위치에 따라 SQL의 선택 부분을 방어*/
@m_strsqlselect를 선택하십시오
= 케이스
@A_IntPosition = 4 일 때 -Product Library
"productId, 'title'= productName, 'description'= left (description, 100)를 선택하십시오."
+ "제품에서"
@A_IntPosition = 5 일 때 -Business Opportunity Library
"선택 ID, 제목, 'description'= left (convert (varchar, content), 100)"
+ "비즈니스에서"
@A_IntPosition = 6 일 때 -회사 라이브러리
"CompanyId, 'title'= CompanyName, 'description'= left (description, 100)"
+ "회사에서"
끝
/*분류 ID*/에 따라 SQL의 분류 부분을 방어하십시오.
@m_strsqlcategory를 선택하십시오
= 케이스
@A_StrcategoryID <> "0"이면 "CategoryId like '" + @A_StrcategoryID + "%'및"
또 다른 ""
끝
/*통화 위치에 따라 SQL의 조건부 부분을 결정*/
@m_strsqlcondition을 선택하십시오
= 케이스
@A_IntPosition = 4- 제품
그런 다음 "( '%" + @a_strparseword + "%'와 같은 ProductName" "
+ "또는 '%" + @a_strparseword + "%'와 같은 설명
+ "또는 '%" + @a_strparseword + "%'와 같은 프로듀서 이름") "
@a_intposition = 5- 사업 기회
그런 다음 "( '%" + @a_strparseword + "%'와 같은 제목" "
+ "또는 '%" + @a_strparseword + "%'와 같은 키워드") "
@a_intposition = 6 일 때
그런 다음 "( '%" + @a_strparseword + "%'와 같은 회사 이름" "
+ "또는 설명 '%" + @a_strparseword + "%')"
끝
RowCount @A_IntrowCount를 설정하십시오
exec (@m_strsqlselect + @m_strsqlcategory + @m_strsqlcondition)
RowCount 0을 설정하십시오
가다
위는 ASP 및 저장 절차에서 검색 프로그램의 코드 구현입니다. 나는 모든 사람이 특정한 이해를 가지고 있다고 생각합니다. 더 많은 기술 정보를 알고 싶다면 잘못된 새로운 기술 채널에 계속주의를 기울이십시오!