// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst 
// Source File Name:   DBType.java
// Class Version:      45.3

package oracle.jdbc.dbaccess;

import oracle.jdbc.Const;
import oracle.jdbc.oracore.OracleType;

// flag ACC_SUPER is set
public class DBType
{
    // Constants:          145
    // Interfaces:         0
    // Fields:             28
    // Methods:            11
    // Class Attributes:   1


    public int type;
    public int max_length;
    public boolean is_stream;
    public int ncs;
    public short FormOfUse;
    public static int max_bind_array_length;
    public OracleType otype;
    public int external_type;
    public static final int FIXED_CHAR = 999;
    public static final int CHAR = 96;
    public static final int VARCHAR = 1;
    public static final int LONG = 8;
    public static final int NUMBER = 2;
    public static final int VARNUM = 6;
    public static final int RAW = 23;
    public static final int LONG_RAW = 24;
    public static final int ROWID = 104;
    public static final int RESULT_SET = 102;
    public static final int DATE = 12;
    public static final int BLOB = 113;
    public static final int CLOB = 112;
    public static final int BFILE = 114;
    public static final int NAMED_TYPE = 109;
    public static final int REF_TYPE = 111;
    public static final int TIMESTAMP = 180;
    public static final int TIMESTAMPTZ = 181;
    public static final int TIMESTAMPLTZ = 231;
    public static final int PLSQL_INDEX_TABLE = 998;

    // Decompiling method: <init>  Signature: ()V
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 1677
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type V At 0 5 Range 0 4 Init 0 fixed
    public DBType()
    {
        super();
        return;
    }

    // Decompiling method: <init>  Signature: (IIS)V
    // Max stack: 3, #locals: 4, #params: 4
    // Code length: 42 bytes, Code offset: 1720
    // Line Number Table found: 8 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 42 Range 0 41 Init 0 fixed
    // Parameter  1 added: Name i Type I At 0 42 Range 0 41 Init 0
    // Parameter  2 added: Name j Type I At 0 42 Range 0 41 Init 0
    // Parameter  3 added: Name word0 Type S At 0 42 Range 0 41 Init 0
    // RetValue   4 added: Name <returnValue> Type V At 0 42 Range 0 41 Init 0 fixed
    public DBType(int i, int j, short word0)
    {
        super();
        type = i;
        setFields(i, word0);
        if(i == 102)
        {
            max_length = j;
        } else
        {
            max_length = Math.min(j, max_length);
        }
        return;
    }

    // Decompiling method: <init>  Signature: (IIZS)V
    // Max stack: 3, #locals: 5, #params: 5
    // Code length: 46 bytes, Code offset: 1828
    // Line Number Table found: 9 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 46 Range 0 45 Init 0 fixed
    // Parameter  1 added: Name i Type I At 0 46 Range 0 45 Init 0
    // Parameter  2 added: Name j Type I At 0 46 Range 0 45 Init 0
    // Parameter  3 added: Name flag Type Z At 0 46 Range 0 45 Init 0
    // Parameter  4 added: Name word0 Type S At 0 46 Range 0 45 Init 0
    // RetValue   5 added: Name <returnValue> Type V At 0 46 Range 0 45 Init 0 fixed
    public DBType(int i, int j, boolean flag, short word0)
    {
        super();
        type = i;
        setFields(i, word0);
        if(!flag)
        {
            max_length = Math.min(j, max_length);
        } else
        {
            max_length = j;
        }
        is_stream = flag;
        return;
    }

    // Decompiling method: <init>  Signature: (IS)V
    // Max stack: 3, #locals: 3, #params: 3
    // Code length: 16 bytes, Code offset: 1944
    // Line Number Table found: 4 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 16 Range 0 15 Init 0 fixed
    // Parameter  1 added: Name i Type I At 0 16 Range 0 15 Init 0
    // Parameter  2 added: Name word0 Type S At 0 16 Range 0 15 Init 0
    // RetValue   3 added: Name <returnValue> Type V At 0 16 Range 0 15 Init 0 fixed
    public DBType(int i, short word0)
    {
        super();
        type = i;
        setFields(i, word0);
        return;
    }

    // Decompiling method: getExternalType  Signature: ()I
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 2010
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type I At 0 5 Range 0 4 Init 0 fixed
    public int getExternalType()
    {
        return external_type;
    }

    // Decompiling method: getStringType  Signature: (I)Ljava/lang/String;
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 235 bytes, Code offset: 2053
    // Line Number Table found: 22 entries
    // Parameter  0 added: Name i Type I At 0 235 Range 0 234 Init 0
    // RetValue   1 added: Name <returnValue> Type Ljava/lang/String; At 0 235 Range 0 234 Init 0 fixed
    public static String getStringType(int i)
    {
        switch(i)
        {
        case 999: 
            return " FIXED_CHAR ";

        case 96: // '`'
            return " CHAR ";

        case 1: // '\001'
            return " VARCHAR ";

        case 8: // '\b'
            return " LONG ";

        case 2: // '\002'
            return " NUMBER ";

        case 6: // '\006'
            return " VARNUM ";

        case 23: // '\027'
            return " RAW ";

        case 24: // '\030'
            return " LONG_RAW ";

        case 104: // 'h'
            return " ROWID ";

        case 102: // 'f'
            return " RESULT_SET ";

        case 12: // '\f'
            return " DATE ";

        case 112: // 'p'
            return " CLOB ";

        case 113: // 'q'
            return " BLOB ";

        case 114: // 'r'
            return " BFILE ";

        case 109: // 'm'
            return " NAMED_TYPE ";

        case 111: // 'o'
            return " REF_TYPE ";

        case 998: 
            return " PLSQL_INDEX_TABLE ";

        case 180: 
            return " TIMESTAMP ";

        case 181: 
            return " TIMESTAMPTZ ";

        case 231: 
            return " TIMESTAMPLTZ ";
        }
        return " Type is not set ";
    }

    // Decompiling method: isNType  Signature: ()Z
    // Max stack: 2, #locals: 1, #params: 1
    // Code length: 14 bytes, Code offset: 2410
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 14 Range 0 13 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type Z At 0 14 Range 0 13 Init 0 fixed
    public boolean isNType()
    {
        return FormOfUse == 2;
    }

    // Decompiling method: setExternalType  Signature: (I)V
    // Max stack: 2, #locals: 2, #params: 2
    // Code length: 6 bytes, Code offset: 2462
    // Line Number Table found: 2 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 6 Range 0 5 Init 0 fixed
    // Parameter  1 added: Name i Type I At 0 6 Range 0 5 Init 0
    // RetValue   2 added: Name <returnValue> Type V At 0 6 Range 0 5 Init 0 fixed
    public void setExternalType(int i)
    {
        external_type = i;
        return;
    }

    // Decompiling method: setFields  Signature: (IS)V
    // Max stack: 2, #locals: 3, #params: 3
    // Code length: 415 bytes, Code offset: 2510
    // Line Number Table found: 51 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 415 Range 0 414 Init 0 fixed
    // Parameter  1 added: Name i Type I At 0 415 Range 0 414 Init 0
    // Parameter  2 added: Name word0 Type S At 0 415 Range 0 414 Init 0
    // RetValue   3 added: Name <returnValue> Type V At 0 415 Range 0 414 Init 0 fixed
    protected void setFields(int i, short word0)
    {
        is_stream = false;
        external_type = 0;
        if(word0 >= 8000)
        {
            max_bind_array_length = 4000;
        } else
        {
            max_bind_array_length = 2000;
        }
        switch(i)
        {
        case 998: 
        default:
            break;

        case 96: // '`'
        case 999: 
            if(word0 >= 8000)
            {
                max_length = 2000;
            } else
            {
                max_length = 255;
            }
            break;

        case 1: // '\001'
            if(word0 >= 8000)
            {
                max_length = 4000;
            } else
            {
                max_length = 2000;
            }
            break;

        case 8: // '\b'
            max_length = 0x7fffffff;
            is_stream = true;
            break;

        case 2: // '\002'
        case 6: // '\006'
            max_length = 22;
            break;

        case 23: // '\027'
            if(word0 >= 8000)
            {
                max_length = 2000;
            } else
            {
                max_length = 255;
            }
            break;

        case 24: // '\030'
            max_length = 0x7fffffff;
            is_stream = true;
            break;

        case 104: // 'h'
            max_length = 128;
            break;

        case 102: // 'f'
            max_length = 0;
            break;

        case 12: // '\f'
            max_length = 7;
            break;

        case 112: // 'p'
        case 113: // 'q'
            max_length = 86;
            break;

        case 114: // 'r'
            max_length = 530;
            break;

        case 111: // 'o'
            max_length = 4000;
            break;

        case 109: // 'm'
            max_length = 0x7fffffff;
            break;

        case 180: 
            max_length = 11;
            break;

        case 181: 
            max_length = 13;
            break;

        case 231: 
            max_length = 11;
            break;
        }
        return;
    }

    // Decompiling method: setMaxSize  Signature: (I)V
    // Max stack: 2, #locals: 2, #params: 2
    // Code length: 6 bytes, Code offset: 3163
    // Line Number Table found: 2 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 6 Range 0 5 Init 0 fixed
    // Parameter  1 added: Name i Type I At 0 6 Range 0 5 Init 0
    // RetValue   2 added: Name <returnValue> Type V At 0 6 Range 0 5 Init 0 fixed
    public void setMaxSize(int i)
    {
        max_length = i;
        return;
    }

    // Decompiling method: setPlsqlMaxLength  Signature: ()V
    // Max stack: 2, #locals: 1, #params: 1
    // Code length: 85 bytes, Code offset: 3211
    // Line Number Table found: 6 entries
    // Parameter  0 added: Name this Type Loracle/jdbc/dbaccess/DBType; At 0 85 Range 0 84 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type V At 0 85 Range 0 84 Init 0 fixed
    public void setPlsqlMaxLength()
    {
        switch(type)
        {
        case 1: // '\001'
        case 23: // '\027'
        case 96: // '`'
        case 999: 
            max_length = 32767;
            break;

        case 8: // '\b'
        case 24: // '\030'
            max_length = 32760;
            break;
        }
        return;
    }
}
