예제 #1
0
        public static BaseSerializer routeMe(Column colToRoute)
        {
            BaseSerializer serializer = null;

            switch (colToRoute.colType)
            {
            case COLUMN_TYPES.INT:
            case COLUMN_TYPES.TINYINT:
            case COLUMN_TYPES.AUTOINCREMENT:
                serializer = new IntSerializer(colToRoute);
                break;

            case COLUMN_TYPES.CHAR:
                serializer = new CharSerializer(colToRoute);
                break;

            // For now, I'm going to cheese out and treat these both
            // as decimal.  As Skeet says [1], they're both *floating point*
            // representations, even if we don't normally think of FLOATS
            // the same as we do decimals.
            // [1] http://tinyurl.com/mzu6t4j
            // TODO: Create a real float type for huge numbers.
            case COLUMN_TYPES.FLOAT:
            case COLUMN_TYPES.DECIMAL:
                serializer = new DecimalSerializer(colToRoute);
                break;

            // TODO: Create a real BIT column type with serializer.
            case COLUMN_TYPES.BIT:
                serializer = new IntSerializer(colToRoute);
                break;

            case COLUMN_TYPES.DATETIME:
                serializer = new DateSerializer(colToRoute);
                break;

            default:
                throw new Exception("Illegal/Unimplemented column type: " + colToRoute.colType);
            }

            return(serializer);
        }
예제 #2
0
        public static BaseSerializer routeMe(Column colToRoute)
        {
            BaseSerializer serializer = null;

            switch (colToRoute.colType)
            {
                case COLUMN_TYPES.INT:
                case COLUMN_TYPES.TINYINT:
                case COLUMN_TYPES.AUTOINCREMENT:
                    serializer = new IntSerializer(colToRoute);
                    break;

                case COLUMN_TYPES.CHAR:
                    serializer = new CharSerializer(colToRoute);
                    break;

                // For now, I'm going to cheese out and treat these both
                // as decimal.  As Skeet says [1], they're both *floating point*
                // representations, even if we don't normally think of FLOATS
                // the same as we do decimals.
                // [1] http://tinyurl.com/mzu6t4j
                // TODO: Create a real float type for huge numbers.
                case COLUMN_TYPES.FLOAT:
                case COLUMN_TYPES.DECIMAL:
                    serializer = new DecimalSerializer(colToRoute);
                    break;

                // TODO: Create a real BIT column type with serializer.
                case COLUMN_TYPES.BIT:
                    serializer = new IntSerializer(colToRoute);
                    break;

                case COLUMN_TYPES.DATETIME:
                    serializer = new DateSerializer(colToRoute);
                    break;

                default:
                    throw new Exception("Illegal/Unimplemented column type: " + colToRoute.colType);
            }

            return serializer;
        }