3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 namespace IBM.Data.DB2
\r
48 LongVarGraphic = 20,
\r
56 public class DB2TypeConverter
\r
58 public static Type GetManagedType(int sql_type)
\r
62 case DB2Constants.SQL_INTEGER:
\r
64 case DB2Constants.SQL_SMALLINT:
\r
65 return typeof(short);
\r
66 case DB2Constants.SQL_BIGINT:
\r
67 return typeof(long);
\r
68 case DB2Constants.SQL_DOUBLE:
\r
69 return typeof(double);
\r
70 case DB2Constants.SQL_DECIMAL:
\r
71 return typeof(decimal);
\r
72 case DB2Constants.SQL_DATETIME:
\r
73 case DB2Constants.SQL_TYPE_DATE:
\r
74 case DB2Constants.SQL_TYPE_TIMESTAMP:
\r
75 return typeof(DateTime);
\r
76 case DB2Constants.SQL_TYPE_TIME:
\r
77 return typeof(TimeSpan);
\r
78 case DB2Constants.SQL_CHAR:
\r
79 case DB2Constants.SQL_VARCHAR:
\r
80 case DB2Constants.SQL_TYPE_CLOB:
\r
81 return typeof(string);
\r
82 case DB2Constants.SQL_TYPE_BLOB:
\r
83 case DB2Constants.SQL_TYPE_BINARY:
\r
84 case DB2Constants.SQL_LONGVARBINARY:
\r
85 case DB2Constants.SQL_VARBINARY:
\r
86 return typeof(byte[]);
\r
88 throw new NotImplementedException("Unknown SQL type " + sql_type);
\r