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

Fix issue with UOM definitions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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