Created
September 6, 2016 07:13
-
-
Save Phuseos/13b5a4a34b6f4e0b5b489a152bcffb57 to your computer and use it in GitHub Desktop.
Translate JetSQL to SQL (VBA)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function TranslateToSQL(ByVal jSQL As String) As String | |
If (Application.CurrentProject.ProjectType = acADP) Then | |
' Operators, constants, delimiters and wildcard characters | |
jSQL = Replace$(jSQL, "#", "'") | |
jSQL = Replace$(jSQL, """", "'") | |
jSQL = Replace$(jSQL, "&", "+") | |
jSQL = Replace$(jSQL, "?", "_") | |
jSQL = Replace$(jSQL, "*", "%") | |
jSQL = Replace$(jSQL, "True", "-1") | |
jSQL = Replace$(jSQL, "False", "0") | |
' correct SELECT * FROM and SELECT <table>.* FROM | |
jSQL = Replace$(jSQL, ".% ", ".* ") | |
jSQL = Replace$(jSQL, ".%,", ".*,") | |
jSQL = Replace$(jSQL, " % ", " * ") | |
' correct SELECT COUNT(*) | |
jSQL = Replace$(asSQL, "(%)", "(*)") | |
Else | |
' Correctie voor ABS(TRUE) | |
jSQL = Replace$(asSQL, "ABS(True)", "True") | |
End If | |
TranslateToSQL = jSQL | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment