Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/31#discussion_r35019592
  
    --- Diff: core/sql/src/main/java/org/trafodion/sql/udr/TupleInfo.java ---
    @@ -1309,100 +1277,27 @@ public void setString(int colNum, String val) 
throws UDRException {
             }
     
             TypeInfo.SQLTypeCode sqlType = t.getSQLType();
    -        boolean isApproxNumeric = false;
    -        int stringLen = val.length();
             ByteBuffer bb;
    -        
    -        // a string overflow will raise an exception
    -        if (stringLen > t.getByteLength())
    -            throw new UDRException(38900,
    -                                   "setString() with a string of length %d 
on a column with length %d",
    -                                   stringLen,
    -                                   t.getByteLength());
    -        
    +
             switch (sqlType)
             {
             case DATE:
             case TIME:
             case TIMESTAMP:
    -        case BLOB:
    -            if ((stringLen != t.getByteLength()) && (sqlType != 
TypeInfo.SQLTypeCode.BLOB))
    +            val = val.trim();
    +            if ((val.length() != t.getByteLength()))
                     throw new UDRException(38900,
    -                                       "setString() with a string of 
length %d on a column with length %d",
    -                                       stringLen,
    +                                       "setString() with a string of 
length %d on a datetime column with length %d",
    +                                       val.length(),
                                            t.getByteLength());
    -            bb = isoCharset.encode(val);
    -            row_.position(t.getDataOffset());
    -            row_.put(bb);
    -            if (sqlType == TypeInfo.SQLTypeCode.BLOB)
    -            {
    -                // set the varchar length indicator
    -                if (t.getVcLenIndOffset() < 0)
    -                    throw new UDRException(38900,
    -                                           "Internal error, BLOB without 
length indicator");
    -                
    -                if ((t.getFlags() & TypeInfo.TYPE_FLAG_4_BYTE_VC_LEN) == 1)
    -                    row_.putInt(t.getVcLenIndOffset(),stringLen);
    -                else
    -                    row_.putShort(t.getVcLenIndOffset(),(short)stringLen);
    -            }
    -            break ;
    +            // fall through to next case
    +
             case CHAR:
             case VARCHAR:
    +        case BLOB:
    --- End diff --
    
    A question: Is it appropriate to blank-pad a BLOB? (It might be binary 
data, for example.)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to