01: /*
02: * Copyright 2002 (C) TJDO.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the TJDO License version 1.0.
06: * See the terms of the TJDO License in the documentation provided with this software.
07: *
08: * $Id: ColumnIdentifier.java,v 1.4 2003/02/26 00:22:38 jackknifebarber Exp $
09: */
10:
11: package com.triactive.jdo.store;
12:
13: class ColumnIdentifier extends SQLIdentifier {
14: public ColumnIdentifier(DatabaseAdapter dba, String javaName) {
15: super (dba);
16:
17: setJavaName(javaName);
18: }
19:
20: public ColumnIdentifier(DatabaseAdapter dba, String javaName,
21: Class type, Role role) {
22: super (dba);
23:
24: setJavaName(javaName);
25: setSQLIdentifier(getSQLIdentifier()
26: + role.getSQLIdentifierSuffix(dba, type));
27: }
28:
29: public ColumnIdentifier(DatabaseAdapter dba,
30: SQLIdentifier baseSQLID, Class type, Role role) {
31: super (dba);
32:
33: this .javaName = null;
34:
35: String baseID = truncate(baseSQLID.getSQLIdentifier(),
36: getMaxLength());
37:
38: setSQLIdentifier(baseID
39: + role.getSQLIdentifierSuffix(dba, type));
40: }
41:
42: protected int getMaxLength() {
43: return dba.getMaxColumnNameLength() - Role.MAX_SUFFIX_LENGTH;
44: }
45: }
|