Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test

  • Loading branch information...
commit 8c26eb4479f4cd46881e8fc510127ef52e33ebb3 1 parent b6ebc12
@fredmorin authored
Showing with 24 additions and 28 deletions.
  1. +2 −7 src/ows/ows_psql.c
  2. +22 −21 src/wfs/wfs_describe.c
View
9 src/ows/ows_psql.c
@@ -355,11 +355,6 @@ list *ows_psql_column_check_constraint(ows * o, buffer * constraint_name){
for (ln = intermediate_constraints->first ; ln ; ln = ln->next) {
if(ln->value->buf[0] == '\''){
- /*
- fprintf(o->output, "[");
- buffer_flush(ln->value, o->output);
- fprintf(o->output, "]\n");
- */
buf = buffer_init();
for (i = 1; ln->value->buf[i] != '\0'; i++){
if(ln->value->buf[i] == '\'')
@@ -370,13 +365,13 @@ list *ows_psql_column_check_constraint(ows * o, buffer * constraint_name){
list_add(constraints, buf);
}
}
-
+ /* For test purposes
for (ln = constraints->first ; ln ; ln = ln->next) {
fprintf(o->output, "[");
buffer_flush(ln->value, o->output);
fprintf(o->output, "]\n");
}
-
+ */
return constraints;
}
View
43 src/wfs/wfs_describe.c
@@ -88,18 +88,26 @@ static void wfs_complex_type(ows * o, wfs_request * wr, buffer * layer_name)
if(!strcmp(xsd_type, "string")){
table_name = ows_psql_table_name(o, layer_name);
-
+
+ fprintf(o->output, " <xs:element name ='%s' ", an->key->buf);
+ if (mandatory_prop && in_list(mandatory_prop, an->key))
+ fprintf(o->output, "nillable='false' minOccurs='1' ");
+ else
+ fprintf(o->output, "nillable='true' minOccurs='0' ");
+ fprintf(o->output, "maxOccurs='1'>\n");
+
+ /* Read string constraint from database and convert to gml restrictions*/
+ table_name = ows_psql_table_name(o, layer_name);
character_maximum_length = ows_psql_column_character_maximum_length(o, an->key, table_name);
- constraint_name = ows_psql_column_constraint_name(o, an->key, table_name);
- if(strcmp(constraint_name->buf, "")){
-
- /* TODO : Remove this line. */
- /*fprintf(o->output, "constraint_name= '%s'\n", constraint_name->buf); */
- check_constraint = ows_psql_column_check_constraint(o, constraint_name);
-
-
- /*check_constraint = */
- /*
+ constraint_name = ows_psql_column_constraint_name(o, an->key, table_name);
+ fprintf(o->output, "<xs:simpleType><xs:restriction base='string'>");
+ if(strcmp(constraint_name->buf, "")){
+ check_constraint = ows_psql_column_check_constraint(o, constraint_name);
+ for (ln = intermediate_constraints->first ; ln ; ln = ln->next) {
+ fprintf(o->output, "<xs:enumeration value='%s'/>", ln->value->buf);
+ }
+ }
+ /*
<xs:simpleType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="StatusCodeTypeEnumerationType">
<xs:restriction base="string">
<xs:enumeration value="REJECTED"/>
@@ -107,17 +115,10 @@ static void wfs_complex_type(ows * o, wfs_request * wr, buffer * layer_name)
</xs:restriction>
</xs:simpleType>
*/
+
- }
-
- fprintf(o->output, " <xs:element name ='%s' ", an->key->buf);
- if (mandatory_prop && in_list(mandatory_prop, an->key))
- fprintf(o->output, "nillable='false' minOccurs='1' ");
- else
- fprintf(o->output, "nillable='true' minOccurs='0' ");
- fprintf(o->output, "maxOccurs='1'>\n");
-
- fprintf(o->output, "<xs:simpleType><xs:restriction base='string'> <maxLength value='%s'/></xs:restriction></xs:simpleType></xs:element>\n", character_maximum_length->buf);
+
+ fprintf(o->output, "<maxLength value='%s'/></xs:restriction></xs:simpleType></xs:element>\n", character_maximum_length->buf);
}else{
fprintf(o->output, " <xs:element name ='%s' type='%s' ", an->key->buf, xsd_type);
Please sign in to comment.
Something went wrong with that request. Please try again.