|
Function SQL _encode (strContent)
If isnull (strContent) = False Then
StrContent = replace (strContent ,"""",""")
StrContent = replace (strContent ,"'","'")
StrContent = replace (strContent, "+", "+ ")
StrContent = replace (strContent ,"*","*")
StrContent = replace (strContent ,"-","-")
StrContent = replace (strContent, "=", "= ")
StrContent = replace (strContent, "<", "<")
StrContent = replace (strContent, ">", "> ")
StrContent = replace (strContent, "%", "% ")
StrContent = replace (strContent ,"_","_")
SQL _encode = strContent
End If
End Function
Function SQL _decode (strContent)
If isnull (strContent) = False Then
StrContent = replace (strContent ,""","""")
StrContent = replace (strContent ,"'","'")
StrContent = replace (strContent, "+", "+ ")
StrContent = replace (strContent ,"*","*")
StrContent = replace (strContent ,"-","-")
StrContent = replace (strContent, "=", "= ")
StrContent = replace (strContent, "<", "<")
StrContent = replace (strContent, ">", "> ")
StrContent = replace (strContent, "%", "% ")
StrContent = replace (strContent ,"_","_")
SQL _Decode = strContent
End If
End Function
Edition 2006
-------------------------------------------------------------------
'Transform any SQL operators to their ascii equivalent
Function SQL _encode (strContent)
If isnull (strContent) = false then
'Transform SQL operators to ascii equivalents
StrContent = replace (strContent, "'", "| Q | ")
StrContent = replace (strContent, "," | QQ | ")
StrContent = replace (strContent, "+", "| PLUS | ")
StrContent = replace (strContent, "*", "| STAR | ")
StrContent = replace (strContent, "-", "| MINUS | ")
StrContent = replace (strContent, "=", "| EQUALS | ")
StrContent = replace (strContent, "<", "| LEFT | ")
StrContent = replace (strContent, ">", "| RIGHT | ")
StrContent = replace (strContent, "%", "| PERCENT | ")
StrContent = replace (strContent, "_", "| UNDER | ")
StrContent = replace (strContent, "/", "| BACKS | ")
StrContent = replace (strContent, "/", "| FRONTS | ")
SQL _encode = strContent
End if
End function
'Tranform ascii characters to their SQL equivalent
Function SQL _decode (strContent)
If isnull (strContent) = false then
'Transform SQL operators
StrContent = replace (strContent, "| Q | ","'")
StrContent = replace (strContent, "| QQ | ","""")
StrContent = replace (strContent, "| PLUS |", "+ ")
StrContent = replace (strContent, "| STAR | ","*")
StrContent = replace (strContent, "| MINUS | ","-")
StrContent = replace (strContent, "| EQUALS |", "= ")
StrContent = replace (strContent, "| LEFT |", "<")
StrContent = replace (strContent, "| RIGHT |", "> ")
StrContent = replace (strContent, "| PERCENT |", "% ")
StrContent = replace (strContent, "| UNDER | ","_")
StrContent = replace (strContent, "| BACKS | ","/")
StrContent = replace (strContent, "| FRONTS | ","/")
SQL _Decode = strContent
End if
End function
|