ElseIf InStr(LCase$(m_strLine), enumTemplateConnectionEnd) <> 0 Then
Exit For
Else
Call ProcessOutputInsert
Print #m_intFileNoModule, m_strLine
End If
Next
Next
End Sub
Private Sub ProcessOutputField(intLineIndexCurrent As Integer)
'
' Emits code for a field loop
'
Dim intX As Integer
Dim intLineIndex As Integer
For m_intFieldIndex = g_recTable(m_intTableIndex).intFieldPtr To g_recTable(m_intTableIndex).intFieldPtr + g_recTable(m_intTableIndex).intFieldCount - 1
intLineIndex = intLineIndexCurrent
Do
intLineIndex = intLineIndex + 1
If intLineIndex >= UBound(m_strLines) Then
MsgBox "A '" & enumTemplateFieldEnd & "' line is missing from the template file", vbCritical
End
End If
m_strLine = m_strLines(intLineIndex)
If InStr(LCase$(m_strLine), enumTemplateFieldEnd) <> 0 Then
Exit Do
End If
If InStr(LCase$(m_strLine), enumTemplateFieldAutoKey) <> 0 Then
If Not g_recField(m_intFieldIndex).blnAutoKey Then
For intX = g_recQuery(m_intQueryIndex).intQueryLinePtr To g_recQuery(m_intQueryIndex).intQueryLinePtr + g_recQuery(m_intQueryIndex).intQueryLineCount - 1
If g_recQueryLine(intX).intQueryLineType = enumQueryLine.QueryField _
Or g_recQueryLine(intX).intQueryLineType = enumQueryLine.SetField Then
For intX = g_recQuery(m_intQueryIndex).intQueryLinePtr To g_recQuery(m_intQueryIndex).intQueryLinePtr + g_recQuery(m_intQueryIndex).intQueryLineCount - 1
Select Case g_recQueryLine(intX).intQueryLineType
Case Is = enumQueryLine.Conjunction, enumQueryLine.Parenthesis
If m_strArray(0) = "(" Or m_strArray(0) = ")" Then
.intQueryLineType = enumQueryLine.Parenthesis
.strFieldName = m_strArray(0)
ElseIf LCase$(m_strArray(0)) = "and" Or LCase$(m_strArray(0)) = "or" Then
.intQueryLineType = enumQueryLine.Conjunction
.strFieldName = UCase$(m_strArray(0))
ElseIf LCase$(m_strArray(0)) = "orderby" Or LCase$(m_strArray(0)) = "order" Then
If g_recQuery(m_intQueryCount).intQueryType <> enumQueryType.SelectQuery Then
Call ProcessSchemaError("ORDER BY clause was specified on a non-select query - " & g_recQuery(m_intQueryCount).strQueryName & "/" & g_recQuery(m_intQueryCount).strQueryTableExternal)
Else
.strFieldName = ""
blnOrderBy = True
End If
ElseIf LCase$(m_strArray(0)) = "set" Then
If g_recQuery(m_intQueryCount).intQueryType <> enumQueryType.SetQuery Then
Call ProcessSchemaError("SET clause was specified on a non-set query - " & g_recQuery(m_intQueryCount).strQueryName & "/" & g_recQuery(m_intQueryCount).strQueryTableExternal)
Else
.strFieldName = ""
blnSet = True
End If
Else
.strFieldName = m_strArray(0)
If blnOrderBy Then
.intQueryLineType = enumQueryLine.OrderByField
If UBound(m_strArray) >= 1 Then
.strFieldValue = UCase$(m_strArray(1))
End If
Else
If UBound(m_strArray) < 2 Then
Call ProcessSchemaError("Invalid query line configuration in query - " & g_recQuery(m_intQueryCount).strQueryName & "/" & g_recQuery(m_intQueryCount).strQueryTableExternal)
End If
.strOperator = m_strArray(1)
If .strOperator <> "=" _
And .strOperator <> "<>" _
And .strOperator <> "!=" _
And .strOperator <> ">" _
And .strOperator <> "<" _
And .strOperator <> ">=" _
And .strOperator <> "<=" _
And LCase$(.strOperator) <> "like" Then
Call ProcessSchemaError("An invalid query line operator was specified on - " & g_recQuery(m_intQueryCount).strQueryName & "/" & g_recQuery(m_intQueryCount).strQueryTableExternal)
Call ProcessSchemaError("An invalid query field for a table was specified - " & g_recQuery(m_intQueryCount).strQueryName & "/" & g_recQuery(m_intQueryCount).strQueryTableExternal)
End If
End If
End With
If .intQueryLineCount = 0 Then
.intQueryLinePtr = m_intQueryLineCount
End If
If g_recQueryLine(m_intQueryLineCount).strFieldName <> "" Then