load(DrvConn conn) { MsgConn msg = conn.msg; bool isBlankDateNull = conn.isBlankDateNull; short count = msg.readShort(); AdvanRSMD rsmd = new AdvanRSMD(count, conn.trace); for (short col = 0; col < count; col++) { ProviderType sql_type = (ProviderType) msg.readShort(); short dbms_type = msg.readShort(); short length = msg.readShort(); byte precision = msg.readByte(); byte scale = msg.readByte(); byte flags = msg.readByte(); if (isBlankDateNull && sql_type == ProviderType.DateTime) { flags |= MSG_DSC_NULL; // return empty date as null } String name = msg.readString(); switch (sql_type) { case ProviderType.DateTime: if (dbms_type == 0) { dbms_type = DBMS_TYPE_IDATE; } break; case ProviderType.Interval: /* ** Intervals are not supported directly */ if (dbms_type == DBMS_TYPE_INTDS) { sql_type = ProviderType.IntervalDayToSecond; } else { sql_type = ProviderType.VarChar; } length = (short)((dbms_type == DBMS_TYPE_INTYM) ? 8 : 15); precision = scale = 0; break; } rsmd.desc[col].name = name; rsmd.desc[col].sql_type = sql_type; rsmd.desc[col].dbms_type = dbms_type; rsmd.desc[col].length = length; rsmd.desc[col].precision = precision; rsmd.desc[col].scale = scale; rsmd.desc[col].flags = flags; } return(rsmd); } // load
reload(DrvConn conn) { MsgConn msg = conn.msg; bool isBlankDateNull = conn.isBlankDateNull; short new_count = msg.readShort(); short common = (short)System.Math.Min(new_count, count); if (new_count != count) { resize(new_count); } for (short col = 0; col < count; col++) { ProviderType sql_type = (ProviderType)msg.readShort(); short dbms_type = msg.readShort(); short length = msg.readShort(); byte precision = msg.readByte(); byte scale = msg.readByte(); byte flags = msg.readByte(); if (isBlankDateNull && sql_type == ProviderType.DateTime) { flags |= MSG_DSC_NULL; // return empty date as null } String name = msg.readString(); switch (sql_type) { case ProviderType.DateTime: if (dbms_type == 0) { dbms_type = DBMS_TYPE_IDATE; } break; case ProviderType.Interval: /* ** Intervals are not supported directly */ if (dbms_type == DBMS_TYPE_INTDS) { sql_type = ProviderType.IntervalDayToSecond; } else { sql_type = ProviderType.VarChar; } length = (short)((dbms_type == DBMS_TYPE_INTYM) ? 8 : 15); precision = scale = 0; break; } if (col < common && trace.enabled(5)) { if (sql_type != desc[col].sql_type) { trace.write(tr_id + ": reload[" + col + "] sql_type " + desc[col].sql_type + " => " + sql_type); } if (dbms_type != desc[col].dbms_type) { trace.write(tr_id + ": reload[" + col + "] dbms_type " + desc[col].dbms_type + " => " + dbms_type); } if (length != desc[col].length) { trace.write(tr_id + ": reload[" + col + "] length " + desc[col].length + " => " + length); } if (precision != desc[col].precision) { trace.write(tr_id + ": reload[" + col + "] precision " + desc[col].precision + " => " + precision); } if (scale != desc[col].scale) { trace.write(tr_id + ": reload[" + col + "] scale " + desc[col].scale + " => " + scale); } if (flags != desc[col].flags) { trace.write(tr_id + ": reload[" + col + "] flags " + desc[col].flags + " => " + flags); } } desc[col].name = name; desc[col].sql_type = sql_type; desc[col].dbms_type = dbms_type; desc[col].length = length; desc[col].precision = precision; desc[col].scale = scale; desc[col].flags = flags; } return; }
} // readInfo /* ** Name: readError ** ** Description: ** Read an ERROR message. Warnings and User messages are saved ** on the warnings list and NULL is returned. Errors are returned ** as SqlEx objects. ** ** Input: ** None. ** ** Output: ** None. ** ** Returns: ** SqlEx Error or NULL. ** ** History: ** 31-Oct-02 (gordy) ** Extracted from readResults(). ** 04-Mar-09 (thoda04) ** Support XA errors. */ protected internal virtual SqlEx readError() { SqlEx ex = null; int status = msg.readInt(); String sqlState = msg.readString(5); byte type = msg.readByte(); String message = msg.readString(); switch (type) { case MSG_ET_ERR: if (trace.enabled(1)) { trace.write(tr_id + ": Received error '" + sqlState + "' 0x" + System.Convert.ToString(status, 16) + " -- " + message); } ex = SqlEx.get(message, sqlState, status); break; case MSG_ET_WRN: if (trace.enabled(1)) { trace.write(tr_id + ": Received warning '" + sqlState + "' 0x" + System.Convert.ToString(status, 16) + " -- " + message); } setWarning(SqlEx.get(message, sqlState, status)); break; case MSG_ET_MSG: if (trace.enabled(1)) { trace.write(tr_id + ": Received message '" + sqlState + "' 0x" + System.Convert.ToString(status, 16) + " -- " + message); } setWarning(SqlEx.get(message, sqlState, status)); break; case MSG_ET_XA: if (status >= 0) // not an error if all is OK { break; } //get a readable message of the XAER_xxx such as // "XA error XAER_NOTA (the XID is not valid)" message = XASwitch.XAER_ToString(status); if (trace.enabled(1)) { trace.write(tr_id + ": Received XA error " + "0x" + System.Convert.ToString(status, 16) + " -- " + message); } ex = SqlEx.get(message, "5000R", status); break; } return(ex); } // readError