01: //
02: // Copyright 2000 Craig Spannring, Bozeman Montana
03: //
04: // All rights reserved.
05: //
06: // Redistribution and use in source and binary forms, with or without
07: // modification, are permitted provided that the following conditions are met:
08: // 1. Redistributions of source code must retain the above copyright
09: // notice, this list of conditions and the following disclaimer.
10: // 2. Redistributions in binary form must reproduce the above copyright
11: // notice, this list of conditions and the following disclaimer in the
12: // documentation and/or other materials provided with the distribution.
13: // 3. All advertising materials mentioning features or use of this software
14: // must display the following acknowledgement:
15: // This product includes software developed by Craig Spannring
16: // 4. The name of Craig Spannring may not be used to endorse or promote
17: // products derived from this software without specific prior
18: // written permission.
19: //
20: // THIS SOFTWARE IS PROVIDED BY CRAIG SPANNRING ``AS IS'' AND
21: // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22: // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23: // ARE DISCLAIMED. IN NO EVENT SHALL CRAIG SPANNRING BE LIABLE
24: // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25: // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26: // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27: // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28: // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29: // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30: // SUCH DAMAGE.
31: //
32:
33: package com.internetcds.jdbc.tds;
34:
35: import java.sql.*;
36:
37: public class TdsUtil {
38: public static final String cvsVersion = "$Id: TdsUtil.java,v 1.2 2007-10-19 13:23:55 sinisa Exp $";
39:
40: static public String javaSqlTypeToString(int type) {
41: switch (type) {
42: case java.sql.Types.BIT:
43: return "BIT";
44: case java.sql.Types.TINYINT:
45: return "TINYINT";
46: case java.sql.Types.SMALLINT:
47: return "SMALLINT";
48: case java.sql.Types.INTEGER:
49: return "INTEGER";
50: case java.sql.Types.BIGINT:
51: return "BIGINT";
52: case java.sql.Types.FLOAT:
53: return "FLOAT";
54: case java.sql.Types.REAL:
55: return "REAL";
56: case java.sql.Types.DOUBLE:
57: return "DOUBLE";
58: case java.sql.Types.NUMERIC:
59: return "NUMERIC";
60: case java.sql.Types.DECIMAL:
61: return "DECIMAL";
62: case java.sql.Types.CHAR:
63: return "CHAR";
64: case java.sql.Types.VARCHAR:
65: return "VARCHAR";
66: case java.sql.Types.LONGVARCHAR:
67: return "LONGVARCHAR";
68: case java.sql.Types.DATE:
69: return "DATE";
70: case java.sql.Types.TIME:
71: return "TIME";
72: case java.sql.Types.TIMESTAMP:
73: return "TIMESTAMP";
74: case java.sql.Types.BINARY:
75: return "BINARY";
76: case java.sql.Types.VARBINARY:
77: return "VARBINARY";
78: case java.sql.Types.LONGVARBINARY:
79: return "LONGVARBINARY";
80: case java.sql.Types.NULL:
81: return "NULL";
82: case java.sql.Types.OTHER:
83: return "OTHER";
84: default:
85: return "UNKNOWN" + type;
86: }
87: } /* javaSqlTypeToString() */
88: }
|