Explorar o código

added GreaterThan, LessThen, OrEqualTo in WFS API ogc:Filter

Piotr Labudda %!s(int64=9) %!d(string=hai) anos
pai
achega
3cd83078d0

+ 32 - 0
SE/schema/wfs/convertOgcFilterToXmlTaskList.xsl

@@ -98,4 +98,36 @@
 		</xsl:element>
 	</xsl:template>
 
+	<xsl:template match="ogc:PropertyIsGreaterThan">
+		<xsl:element name="sql_filter_comparisonFieldToValue">
+			<xsl:attribute name="fieldName"><xsl:value-of select="ogc:PropertyName" /></xsl:attribute>
+			<xsl:attribute name="comparisonSign"><xsl:value-of select="'GreaterThen'" /></xsl:attribute>
+			<xsl:attribute name="value"><xsl:value-of select="ogc:Literal" /></xsl:attribute>
+		</xsl:element>
+	</xsl:template>
+
+	<xsl:template match="ogc:PropertyIsGreaterThanOrEqualTo">
+		<xsl:element name="sql_filter_comparisonFieldToValue">
+			<xsl:attribute name="fieldName"><xsl:value-of select="ogc:PropertyName" /></xsl:attribute>
+			<xsl:attribute name="comparisonSign"><xsl:value-of select="'GreaterThenOrEqualTo'" /></xsl:attribute>
+			<xsl:attribute name="value"><xsl:value-of select="ogc:Literal" /></xsl:attribute>
+		</xsl:element>
+	</xsl:template>
+
+	<xsl:template match="ogc:PropertyIsLessThan">
+		<xsl:element name="sql_filter_comparisonFieldToValue">
+			<xsl:attribute name="fieldName"><xsl:value-of select="ogc:PropertyName" /></xsl:attribute>
+			<xsl:attribute name="comparisonSign"><xsl:value-of select="'LessThen'" /></xsl:attribute>
+			<xsl:attribute name="value"><xsl:value-of select="ogc:Literal" /></xsl:attribute>
+		</xsl:element>
+	</xsl:template>
+
+	<xsl:template match="ogc:PropertyIsLessThanOrEqualTo">
+		<xsl:element name="sql_filter_comparisonFieldToValue">
+			<xsl:attribute name="fieldName"><xsl:value-of select="ogc:PropertyName" /></xsl:attribute>
+			<xsl:attribute name="comparisonSign"><xsl:value-of select="'LessThenOrEqualTo'" /></xsl:attribute>
+			<xsl:attribute name="value"><xsl:value-of select="ogc:Literal" /></xsl:attribute>
+		</xsl:element>
+	</xsl:template>
+
 </xsl:stylesheet>

+ 8 - 0
SE/se-lib/SqlQueryWhereBuilder.php

@@ -24,6 +24,10 @@ class SqlQueryWhereBuilder {
 		switch ($comparisonSign) {
 			case '=': $sqlCompSign = '='; break;
 			case 'like': $sqlCompSign = 'like'; break;
+			case 'GreaterThen': $sqlCompSign = '>'; break;
+			case 'LessThen': $sqlCompSign = '<'; break;
+			case 'GreaterThenOrEqualTo': $sqlCompSign = '>='; break;
+			case 'LessThenOrEqualTo': $sqlCompSign = '<='; break;
 			default: throw new Exception("Unsupported comparison sign");
 		}
 		$this->_log[] = array('comparisonFieldToValue', $fieldName, $sqlCompSign, $value);
@@ -34,6 +38,10 @@ class SqlQueryWhereBuilder {
 		switch ($comparisonSign) {
 			case '=': $sqlCompSign = '='; break;
 			case 'like': $sqlCompSign = 'like'; break;
+			case 'GreaterThen': $sqlCompSign = '>'; break;
+			case 'LessThen': $sqlCompSign = '<'; break;
+			case 'GreaterThenOrEqualTo': $sqlCompSign = '>='; break;
+			case 'LessThenOrEqualTo': $sqlCompSign = '<='; break;
 			default: throw new Exception("Unsupported comparison sign");
 		}
 		$this->_log[] = array('comparisonFieldFunToValue', $fieldFun, $fieldName, $sqlCompSign, $value);