• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

[Fix provided] metadata

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Fix provided] metadata


  • #2
    We are glad you are using the metaData option, we haven't used it much after putting it in so it hasn't been widely field tested. Did you change that from "int" to "float" in your source code? If not, do you just want to try it and let it know if it fixes your problem and if so we'll make the change in the base source code for the next release.

    Comment


    • #3
      What I did was copy the metadata that I was getting from Valence, change the type for the expression to 'float' and create a data model for it. The store can manage fine if the server sends only a subset of the fields defined in the model. I'll change the code in the CreateMetaData procedure later on this week or next and I'll let you know what results I get.


      -thanks,
      Hugo.

      Comment


      • #4
        Richard,
        I haven't checked myself, but in CreateMetaData do you still have access to the SQLDA? May be we could make it smart by checking whether a packed or zoned decimal has a scale of 0. In that case we can set the type to 'int' instead of 'float'.

        -thanks
        Hugo.

        Comment


        • #5
          Hugo has provided a fix for this that will be included in the final 3.0 release of Valence. For those who cannot wait, it is pasted below.

          Thanks Hugo!

          Code:
               p CreateMetaData  b
               d                 pi         65535a   varying
           
               d rtnFld          s          65535a   varying
               d ii              s              4  0
                * Set up DS over sqlvar's sqllen field
                * ------------------------------------
               d sqllenp         s               *   inz(%addr(sqllen))
               d sql_len         ds                  qualified based(sqllenp)
               d  length                        5i 0
               d  precision                     3i 0 overlay(length:1)
               d  scale                         3i 0 overlay(length:*next)
               d
               d nonSqlScale     s              3i 0
               d isDecimal       s               n
               d isNumeric       s               n
               d
                /free
                 rtnFld=DQ+'metaData'+DQ+COLON+OC+
                        DQ+'totalProperty'+DQ+COLON+DQ+'totalCount'+DQ+COMMA+
                        DQ+'root'+DQ+COLON+DQ+%trim(vvOut.rootName)+DQ+COMMA+
                        DQ+'id'+DQ+COLON+DQ+'reader'+%trim(vvOut.rootName)+DQ+COMMA+
                        DQ+'fields'+DQ+COLON+OB;
                 if executeSQL;
                   for ii=1 to sqlD;
                     sqlVar=sql_Var(ii);
                     isDecimal = (sqlType=SQLPACK
                                  or sqlType=SQLPACK_2
                                  or sqlType=SQLZONE
                                  or sqlType=SQLZONE_2);
                     rtnFld+=OC+DQ+'name'+DQ+COLON+DQ+%trim(sqlName)+DQ;
                     if ( isDecimal and sql_len.scale = 0)
                         or sqlType=SQLBIGINT
                         or sqlType=SQLBIGINT
                         or sqlType=SQLLARGEINT
                         or sqlType=SQLLARGEINT_2
                         or sqlType=SQLSMALLINT
                         or sqlType=SQLSMALLINT_2;
                       rtnFld+=COMMA+DQ+'type'+DQ+COLON+DQ+'int'+DQ;
                      elseif (isDecimal and sql_len.scale > 0)
                             or sqlType=SQLFLOAT
                             or sqlType=SQLFLOAT_2;
                       rtnFld+=COMMA+DQ+'type'+DQ+COLON+DQ+'float'+DQ;
                      elseif sqlType=SQLDATE or sqlType=SQLDATE_2;
                       rtnFld+=COMMA+DQ+'type'+DQ+COLON+DQ+'date'+DQ;
                     endif;
                     rtnFld+=CC;
                     if ii<sqlD;
                       rtnFld+=COMMA;
                     endif;
                   endfor;
                   rtnFld+=CB;
                  else;
                   for ii=1 to fldCnt;
                     rtnFld+=OC+DQ+'name'+DQ+COLON+DQ+%trim(fieldArray(ii).vvFldName)+DQ;
                     monitor;
                        nonSqlScale = %int(fieldArray(ii).vvFlddec);
                     on-error;
                        nonSqlScale = 0;
                     endmon;
                     isNumeric = (fieldArray(ii).vvFldType=SIGNFIELD
                                       or fieldArray(ii).vvFldType=PACKFIELD
                                       or fieldArray(ii).vvFldType=BINARYFIELD);
                     if isNumeric and nonSqlScale = 0;
                       rtnFld+=COMMA+DQ+'type'+DQ+COLON+DQ+'int'+DQ;
                      elseif (isNumeric and nonSqlScale > 0) or
                             fieldArray(ii).vvFldType=FLOATFIELD;
                       rtnFld+=COMMA+DQ+'type'+DQ+COLON+DQ+'float'+DQ;
                      elseif fieldArray(ii).vvFldType=DATEFIELD;
                       rtnFld+=COMMA+DQ+'type'+DQ+COLON+DQ+'date'+DQ;
                     endif;
                     rtnFld+=CC;
                     if ii<fldCnt;
                       rtnFld+=COMMA;
                     endif;
                   endfor;
                   rtnFld+=CB;
                 endif;
                 rtnFld+=CC;
                 return rtnFld;
                /end-free
               p                 e

          Comment

          Working...
          X