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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 778 - (hide annotations)
Mon Mar 29 10:53:14 2010 UTC (14 years, 11 months ago) by alfonx
File MIME type: text/plain
File size: 814 byte(s)
Neue PGUtil mit Hilfsmethoden für PostgreSQL erstellt.
1 alfonx 778 package skrueger.db;
2    
3     /**
4     * Hilfsmethoden für PostgreSQL
5     */
6     public class PGUtil {
7    
8     /**
9     * @param binding
10     * Eine "einfache" Javaklasse, die in PG abgebildet werden soll.
11     * @return einen PG-spezifischen Datentypenamen für einen Javatyp zurück, z.b. "double precision" für <code>Double.class</code>
12     */
13     public static String getColTypeName(Class<?> binding) {
14    
15     if (binding.isAssignableFrom(Double.class)) {
16     return "double precision"; // eg 'number' at oracle
17     } else if (binding.isAssignableFrom(String.class)) {
18     return "text";
19     } else if (binding.isAssignableFrom(Integer.class)) {
20     return "integer";
21     } else if (binding.isAssignableFrom(Long.class)) {
22     return "bigint";
23     }
24    
25     throw new RuntimeException("DB Type mapping for " + binding
26     + " not yet implemented.");
27     }
28    
29     }

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