/[schmitzm]/trunk/src/skrueger/db/PGUtil.java
ViewVC logotype

Contents of /trunk/src/skrueger/db/PGUtil.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1002 - (show annotations)
Tue Sep 14 12:45:05 2010 UTC (14 years, 5 months ago) by alfonx
File MIME type: text/plain
File size: 839 byte(s)


1 package skrueger.db;
2
3 /**
4 * Hilfsmethoden für PostgreSQL
5 */
6 public class PGUtil {
7
8 // TODO isGeoColumn();
9
10 /**
11 * @param binding
12 * Eine "einfache" Javaklasse, die in PG abgebildet werden soll.
13 * @return einen PG-spezifischen Datentypenamen für einen Javatyp zurück, z.b. "double precision" für <code>Double.class</code>
14 */
15 public static String getColTypeName(Class<?> binding) {
16
17 if (binding.isAssignableFrom(Double.class)) {
18 return "double precision"; // eg 'number' at oracle
19 } else if (binding.isAssignableFrom(String.class)) {
20 return "text";
21 } else if (binding.isAssignableFrom(Integer.class)) {
22 return "integer";
23 } else if (binding.isAssignableFrom(Long.class)) {
24 return "bigint";
25 }
26
27 throw new RuntimeException("DB Type mapping for " + binding
28 + " not yet implemented.");
29 }
30
31 }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26