Statistics
| Revision:

root / trunk / extensions / extQuickInfo / src / org / gvsig / quickInfo / utils / SQLTypeNames.java @ 27817

History | View | Annotate | Download (2.79 KB)

1
package org.gvsig.quickInfo.utils;
2

    
3
/* gvSIG. Geographic Information System of the Valencian Government
4
 *
5
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
6
 * of the Valencian Government (CIT)
7
 * 
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 * 
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *  
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
21
 * MA  02110-1301, USA.
22
 * 
23
 */
24

    
25
import java.sql.Types;
26

    
27
import com.iver.andami.PluginServices;
28

    
29
/**
30
 * <p>Utility to convert an SQL data type in its representation in characters.</p>
31
 * 
32
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
33
 */
34
public class SQLTypeNames {
35
        /**
36
         * <p>Returns an <code>String</code> that represents a SQL type.</p>
37
         * 
38
         * @param type a type defined in {@link Types Types}
39
         * @return an <code>String</code> that represents the type
40
         */
41
        public static String getSQLTypeName(int type) {
42
                switch(type) {
43
                        case Types.ARRAY:
44
                                return "Array";
45
                        case Types.BIGINT:
46
                                return "BigInteger";
47
                        case Types.BINARY:
48
                                return "Binary";
49
                        case Types.BIT:
50
                                return "Bit";
51
                        case Types.BLOB:
52
                                return "Blob";
53
                        case Types.BOOLEAN:
54
                                return "Boolean";
55
                        case Types.CHAR:
56
                                return "Char";
57
                        case Types.CLOB:
58
                                return "Clob";
59
                        case Types.DATALINK:
60
                                return "Datalink";
61
                        case Types.DATE:
62
                                return "Date";
63
                        case Types.DECIMAL:
64
                                return "Decimal";
65
                        case Types.DISTINCT:
66
                                return "Distinct";
67
                        case Types.DOUBLE:
68
                                return "Double";
69
                        case Types.FLOAT:
70
                                return "Float";
71
                        case Types.INTEGER:
72
                                return "Integer";
73
                        case Types.JAVA_OBJECT:
74
                                return "Java Object";
75
                        case Types.LONGVARBINARY:
76
                                return "LongVarBinary";
77
                        case Types.LONGVARCHAR:
78
                                return "LongVarChar";
79
                        case Types.NULL:
80
                                return "Null";
81
                        case Types.NUMERIC:
82
                                return "Numeric";
83
                        case Types.OTHER:
84
                                return "Other";
85
                        case Types.REAL:
86
                                return "Real";
87
                        case Types.REF:
88
                                return "Ref";
89
                        case Types.SMALLINT:
90
                                return "SmallInt";
91
                        case Types.STRUCT:
92
                                return "Struct";
93
                        case Types.TIME:
94
                                return "Time";
95
                        case Types.TIMESTAMP:
96
                                return "TimeStamp";
97
                        case Types.TINYINT:
98
                                return "TinyInt";
99
                        case Types.VARBINARY:
100
                                return "VarBinary";
101
                        case Types.VARCHAR:
102
                                return "VarChar";                                
103
                        default:
104
                                return PluginServices.getText(null, "Unknown");
105
                }
106
        }
107
}