Changeset 903


Ignore:
Timestamp:
Apr 19, 2019, 4:08:59 PM (6 years ago)
Author:
djay
Message:

Fix issue with UOM definitions

Location:
branches/prototype-v0/thirds/zcfg2sql
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/thirds/zcfg2sql/Makefile

    r839 r903  
    44CC=gcc
    55
     6ifeq (${CALLBACK_FILE},service_callback.o)
     7CALLBACK_FILES=${ZRPATH}/zoo-kernel/${CALLBACK_FILE} ${ZRPATH}/zoo-kernel/ulinet.o ${ZRPATH}/zoo-kernel/caching.o
     8else
     9CALLBACK_FILES=
     10endif
    611zcfg2sql: zcfg2sql.c
    712        g++ -g -O2 ${JSCFLAGS} ${RUBYCFLAGS} ${XML2CFLAGS} ${LCFLAGS} -c zcfg2sql.c  -fno-common -DPIC -o zcfg2sql.o
    8         g++  ${XML2CFLAGS} ${LCFLAGS} zcfg2sql.o ${ZRPATH}/zoo-kernel/server_internal.o ${ZRPATH}/zoo-kernel/service_internal.o ${ZRPATH}/zoo-kernel/${MS_FILE} ${ZRPATH}/zoo-kernel/response_print.o ${ZRPATH}/zoo-kernel/lex.cr.o ${ZRPATH}/zoo-kernel/lex.sr.o ${ZRPATH}/zoo-kernel/service_conf.tab.o ${ZRPATH}/zoo-kernel/main_conf_read.tab.o  ${ZRPATH}/zoo-kernel/${YAML_FILE} -o zcfg2sql -L${ZRPATH}/zoo-kernel/ ${LDFLAGS}
     13        g++  ${XML2CFLAGS} ${LCFLAGS} zcfg2sql.o ${CALLBACK_FILES} ${ZRPATH}/zoo-kernel/server_internal.o ${ZRPATH}/zoo-kernel/service_internal.o ${ZRPATH}/zoo-kernel/${MS_FILE} ${ZRPATH}/zoo-kernel/response_print.o ${ZRPATH}/zoo-kernel/lex.cr.o ${ZRPATH}/zoo-kernel/lex.sr.o ${ZRPATH}/zoo-kernel/service_conf.tab.o ${ZRPATH}/zoo-kernel/main_conf_read.tab.o  ${ZRPATH}/zoo-kernel/${YAML_FILE} -o zcfg2sql -L${ZRPATH}/zoo-kernel/ ${LDFLAGS}
    914
    1015clean:
  • branches/prototype-v0/thirds/zcfg2sql/zcfg2sql.c

    r839 r903  
    22 * Author : Gérald FENOY
    33 *
    4  *  Copyright (c) 2017 GeoLabs SARL. All rights reserved.
     4 *  Copyright (c) 2017-2019 GeoLabs SARL. All rights reserved.
    55 *
    66 * Permission is hereby granted, free of charge, to any person obtaining a copy
     
    9696            if(values[2]!=NULL)
    9797              fprintf(f,"UPDATE CollectionDB.LiteralDataDomain \n"
    98                       "set uom = (SELECT id from CollectionDB.PrimitiveDatatypes WHERE name=$q$%s$q$ \n WHERE id = \n"
     98                      "set uom = (SELECT id from CollectionDB.PrimitiveUOM WHERE uom=$q$%s$q$) \n WHERE id = \n"
    9999                      "  (SELECT last_value FROM CollectionDB.ows_DataDescription_id_seq);\n ",
    100100                      values[2]->value);
     
    299299              getMap(tmpio->content,"AllowedValues")
    300300            };
     301            map* values0[4]={
     302              getMap(tmp->defaults->content,"dataType"),
     303              getMap(tmp->defaults->content,"value"),
     304              getMap(tmp->defaults->content,"uom"),
     305              getMap(tmp->defaults->content,"AllowedValues")
     306            };
    301307            char *fields[20]={
    302308              "default_value",
     
    305311            fprintf(f,"INSERT INTO CollectionDB.LiteralDataDomain"
    306312                    " (def,data_type_id) VALUES \n(false,");
    307             fprintf(f,"(SELECT id from CollectionDB.PrimitiveDatatypes"
    308                     " where name = '%s'));\n",values[0]->value);
     313            if(values[0]!=NULL)
     314              fprintf(f,"(SELECT id from CollectionDB.PrimitiveDatatypes"
     315                      " where name = '%s'));\n",values[0]->value);
     316            else
     317              fprintf(f,"(SELECT id from CollectionDB.PrimitiveDatatypes"
     318                      " where name = '%s'));\n",values0[0]->value);
    309319            if(values[1]!=NULL)
    310320              fprintf(f,"UPDATE CollectionDB.LiteralDataDomain \n"
     
    312322                      "  ((SELECT last_value FROM CollectionDB.ows_DataDescription_id_seq));\n ",
    313323                      fields[0],values[1]->value);
     324            if(values[2]!=NULL)
     325              fprintf(f,"UPDATE CollectionDB.LiteralDataDomain \n"
     326                      "set uom = (SELECT id from CollectionDB.PrimitiveUOM WHERE uom=$q$%s$q$) \n WHERE id = \n"
     327                      "  (SELECT last_value FROM CollectionDB.ows_DataDescription_id_seq);\n ",
     328                      values[2]->value);
     329            if(type!=NULL)
    314330            fprintf(f,"INSERT INTO CollectionDB.%sDataDescriptionAssignment"
    315331                    " (%s_id,data_description_id) VALUES "
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png