예제 #1
0
        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
예제 #2
0
        }         // readData

        /*
        ** Name: readInfo
        **
        ** Description:
        **	Read an INFO message.  The INFO message parameters are read
        **	and processed.  Currently, the only INFO parameter supported
        **	is Trace Text which is simply written to the trace file.
        **
        ** Input:
        **	None.
        **
        ** Output:
        **	None.
        **
        ** Returns:
        **	void
        **
        ** History:
        **	21-Apr-06 (gordy)
        **	    Created.
        **	 3-Jul-06 (gordy)
        **	    Support dedicated DBMS trace log.
        */

        protected internal virtual void readInfo()
        {
            while (msg.moreData())
            {
                short param_id  = msg.readShort();
                short param_len = msg.readShort();

                switch (param_id)
                {
                case MSG_IP_TRACE:
                {
                    if (trace.enabled() || conn.dbms_log.enabled())
                    {
                        String txt = msg.readString(param_len);
                        trace.log("DBMS TRACE: " + txt);
                        conn.dbms_log.write(txt);
                    }
                    else
                    {
                        msg.skip(param_len);
                    }
                    break;
                }

                default:
                    if (trace.enabled(1))
                    {
                        trace.write(tr_id + ": Invalid info param ID " + param_id);
                    }
                    throw SqlEx.get(ERR_GC4002_PROTOCOL_ERR);
                }
            }

            return;
        }         // readInfo
예제 #3
0
        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;
        }