docs: public Timestamp getInternalTimestamp(ColumnInformation columnInfo, Calendar userCalendar,
        TimeZone timeZone) throws SQLException {
      if (lastValueWasNull()) {
        return null;
      }
      if (length == 0) {
        lastValueNull |= BIT_LAST_FIELD_NULL;
        return null;
      }
  
      int year = 1970;
      int month = 0;
      int day = 0;
      int hour = 0;
      int minutes = 0;
      int seconds = 0;
      int microseconds = 0;
  
      switch (columnInfo.getColumnType()) {
        case TIME:
          Calendar calendar = userCalendar != null ? userCalendar : Calendar.getInstance();
  
          boolean negate = false;
          if (length > 0) {
            negate = (buf[pos] & 0xff) == 0x01;
          }
          if (length > 4) {
            day = ((buf[pos + 1] & 0xff)
                + ((buf[pos + 2] & 0xff) << 8)
                + ((buf[pos + 3] & 0xff) << 16)
                + ((buf[pos + 4] & 0xff) << 24));
          }
          if (length > 7) {
            hour = buf[pos + 5];
            minutes = buf[pos + 6];
            seconds = buf[pos + 7];
          }
  
          if (length > 8) {
            microseconds = ((buf[pos + 8] & 0xff)
                + ((buf[pos + 9] & 0xff) << 8)
                + ((buf[pos + 10] & 0xff) << 16)
                + ((buf[pos + 11] & 0xff) << 24));
          }
          year = 1970;
          month = 1;
          day = ((negate ? -1 : 1) * day) + 1;
          hour = (negate ? -1 : 1) * hour;
          break;
  
        case STRING:
        case VARSTRING:
          String rawValue = new String(buf, pos, length, StandardCharsets.UTF_8);
          if (rawValue.startsWith("0000-00-00 00:00:00")) {
            lastValueNull |= BIT_LAST_ZERO_DATE;
            return null;
          }
  
          if (rawValue.length() >= 4) {
            year = Integer.parseInt(rawValue.substring(0, 4));
            if (rawValue.length() >= 7) {
              month = Integer.parseInt(rawValue.substring(5, 7));
              if (rawValue.length() >= 10) {
                day = Integer.parseInt(rawValue.substring(8, 10));
                if (rawValue.length() >= 19) {
                  hour = Integer.parseInt(rawValue.substring(11, 13));
                  minutes = Integer.parseInt(rawValue.substring(14, 16));
                  seconds = Integer.parseInt(rawValue.substring(17, 19));
                }
                microseconds = extractNanos(rawValue) / 1000000;
              }
            }
          }
          break;
  
        default:
          year = ((buf[pos] & 0xff) | (buf[pos + 1] & 0xff) << 8);
          month = buf[pos + 2];
          day = buf[pos + 3];
          if (length > 4) {
            hour = buf[pos + 4];
            minutes = buf[pos + 5];
            seconds = buf[pos + 6];
  
            if (length > 7) {
              microseconds = ((buf[pos + 7] & 0xff)
                  + ((buf[pos + 8] & 0xff) << 8)
                  + ((buf[pos + 9] & 0xff) << 16)
                  + ((buf[pos + 10] & 0xff) << 24));
            }
          }
      }
  
      Calendar calendar;
      if (userCalendar != null) {
        calendar = userCalendar;
      } else if (columnInfo.getColumnType().getSqlType() == Types.TIMESTAMP) {
        calendar = Calendar.getInstance(timeZone);
      } else {
        calendar = Calendar.getInstance();
      }
  
      Timestamp tt;
      synchronized (calendar) {
        calendar.clear();
        calendar.set(year, month - 1, day, hour, minutes, seconds);
        tt = new Timestamp(calendar.getTimeInMillis());
      }
      tt.setNanos(microseconds * 1000);
      return tt;
    }