KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > store > ColumnIdentifier


1 /*
2  * Copyright 2002 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $Id: ColumnIdentifier.java,v 1.4 2003/02/26 00:22:38 jackknifebarber Exp $
9  */

10
11 package com.triactive.jdo.store;
12
13
14 class ColumnIdentifier extends SQLIdentifier
15 {
16     public ColumnIdentifier(DatabaseAdapter dba, String JavaDoc javaName)
17     {
18         super(dba);
19
20         setJavaName(javaName);
21     }
22
23
24     public ColumnIdentifier(DatabaseAdapter dba, String JavaDoc javaName, Class JavaDoc type, Role role)
25     {
26         super(dba);
27
28         setJavaName(javaName);
29         setSQLIdentifier(getSQLIdentifier() + role.getSQLIdentifierSuffix(dba, type));
30     }
31
32
33     public ColumnIdentifier(DatabaseAdapter dba, SQLIdentifier baseSQLID, Class JavaDoc type, Role role)
34     {
35         super(dba);
36
37         this.javaName = null;
38
39         String JavaDoc baseID = truncate(baseSQLID.getSQLIdentifier(), getMaxLength());
40
41         setSQLIdentifier(baseID + role.getSQLIdentifierSuffix(dba, type));
42     }
43
44
45     protected int getMaxLength()
46     {
47         return dba.getMaxColumnNameLength() - Role.MAX_SUFFIX_LENGTH;
48     }
49 }
50
Popular Tags