Exemplo n.º 1
0
        public static string TypeTag(CustomFormField field)
        {
            var pre  = SqlType(field);
            var retv = Regex.Match(pre, "^(\\d+)").Groups[0].Value.ToLower();

            return(retv);
        }
Exemplo n.º 2
0
        public static Type GetRuntimeType(CustomFormField field)
        {
            switch (field.Type)
            {
            case "int":
            case "int32":
            case "enum": return(typeof(int?));

            case "uint":
            case "uint32": return(typeof(uint?));

            case "long":
            case "int64": return(typeof(long?));

            case "ulong":
            case "uint64": return(typeof(ulong?));

            case "short":
            case "int16": return(typeof(short?));

            case "ushort":
            case "uint16": return(typeof(ushort?));

            case "bool":
            case "boolean": return(typeof(bool?));

            case "date":
            case "datetime":
            case "time":
            case "timestamp": return(typeof(DateTime?));

            case "rid":
            case "string":
            case "text": return(typeof(String));
            }

            return(typeof(String));
        }
Exemplo n.º 3
0
        public static String SqlType(CustomFormField campo)
        {
            switch (campo.Type.ToLower())
            {
            case "int":
            case "int32":
            case "enum": return($"INT");

            case "uint":
            case "uint32": return($"INT UNSIGNED");

            case "long": return($"BIGINT");

            case "ulong": return($"BIGINT UNSIGNED");

            case "int16": return($"SMALLINT");

            case "uint16": return($"SMALLINT UNSIGNED");

            case "bool":
            case "boolean": return($"TINYINT(1)");

            case "date":
            case "datetime":
            case "time":
            case "timestamp": return($"DATETIME");

            case "rid": return($"VARCHAR(64)");

            case "string": return($"VARCHAR({campo.Size})");

            case "text": return("TEXT");
            }

            return($"VARCHAR({campo.Size})");
        }