package com.chenyang.druid.proxy.jdbc;

import java.util.Calendar;

public final class JdbcParameterNull implements JdbcParameter {
   private final int sqlType;
   public static final JdbcParameterNull CHAR = new JdbcParameterNull(1);
   public static final JdbcParameterNull VARCHAR = new JdbcParameterNull(12);
   public static final JdbcParameterNull NVARCHAR = new JdbcParameterNull(-9);
   public static final JdbcParameterNull BINARY = new JdbcParameterNull(-2);
   public static final JdbcParameterNull VARBINARY = new JdbcParameterNull(-3);
   public static final JdbcParameterNull TINYINT = new JdbcParameterNull(-6);
   public static final JdbcParameterNull SMALLINT = new JdbcParameterNull(5);
   public static final JdbcParameterNull INTEGER = new JdbcParameterNull(4);
   public static final JdbcParameterNull BIGINT = new JdbcParameterNull(-5);
   public static final JdbcParameterNull DECIMAL = new JdbcParameterNull(3);
   public static final JdbcParameterNull NUMERIC = new JdbcParameterNull(2);
   public static final JdbcParameterNull FLOAT = new JdbcParameterNull(6);
   public static final JdbcParameterNull DOUBLE = new JdbcParameterNull(8);
   public static final JdbcParameterNull NULL = new JdbcParameterNull(0);
   public static final JdbcParameterNull DATE = new JdbcParameterNull(91);
   public static final JdbcParameterNull TIME = new JdbcParameterNull(92);
   public static final JdbcParameterNull TIMESTAMP = new JdbcParameterNull(93);

   private JdbcParameterNull(int sqlType) {
      this.sqlType = sqlType;
   }

   public Object getValue() {
      return null;
   }

   public long getLength() {
      return 0L;
   }

   public Calendar getCalendar() {
      return null;
   }

   public int getSqlType() {
      return this.sqlType;
   }

   public static JdbcParameterNull valueOf(int sqlType) {
      switch (sqlType) {
         case -9:
            return NVARCHAR;
         case -6:
            return INTEGER;
         case -5:
            return BIGINT;
         case -3:
            return VARBINARY;
         case -2:
            return BINARY;
         case 0:
            return NULL;
         case 1:
            return CHAR;
         case 2:
            return NUMERIC;
         case 3:
            return DECIMAL;
         case 4:
            return INTEGER;
         case 5:
            return SMALLINT;
         case 6:
            return FLOAT;
         case 8:
            return DOUBLE;
         case 12:
            return VARCHAR;
         case 91:
            return DATE;
         case 92:
            return TIME;
         case 93:
            return TIMESTAMP;
         default:
            return new JdbcParameterNull(sqlType);
      }
   }
}
