KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > expression > booleanvalueexpression > SRESERVEDWORD1206543922Optparenlength


1 package com.daffodilwoods.daffodildb.server.sql99.expression.
2     booleanvalueexpression;
3
4 import com.daffodilwoods.daffodildb.server.sql99.common.*;
5 import com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors.*;
6 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*;
7 import com.daffodilwoods.daffodildb.server.sql99.token.*;
8 import com.daffodilwoods.database.resource.*;
9
10 public class SRESERVEDWORD1206543922Optparenlength extends AbstractRowValueExpression implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter,
11     datatype, predefinedtype, characterstringtype, binarylargeobjectstringtype {
12
13
14    public parenlength _Optparenlength0;
15    public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439221;
16    DataTypeDescriptor dataTypeDescriptor;
17
18    public void setDescriptor(_Descriptor dataTypeDescriptor) throws DException {
19       this.dataTypeDescriptor = (DataTypeDescriptor) dataTypeDescriptor;
20    }
21
22    public Object JavaDoc run(Object JavaDoc object) throws DException {
23       if (dataTypeDescriptor == null) {
24          throw new DException("DSE492", null);
25       }
26       String JavaDoc type = _SRESERVEDWORD12065439221.toString();
27       if (type.equalsIgnoreCase(SqlKeywords.CHAR)) {
28          dataTypeDescriptor.data_Type = SqlKeywords.CHAR;
29          setCharacterLength();
30       } else if (type.equalsIgnoreCase(SqlKeywords.CHARACTER)) {
31          dataTypeDescriptor.data_Type = SqlKeywords.CHARACTER;
32          setCharacterLength();
33       } else if (type.equalsIgnoreCase(SqlKeywords.NCHAR)) {
34          dataTypeDescriptor.data_Type = SqlKeywords.NCHAR;
35          setCharacterLength();
36       } else if (type.equalsIgnoreCase(SqlKeywords.BIT)) {
37          dataTypeDescriptor.data_Type = SqlKeywords.BIT;
38          setCharacterLength();
39       } else if (type.equalsIgnoreCase(SqlKeywords.BINARY)) {
40          dataTypeDescriptor.data_Type = SqlKeywords.BINARY;
41          setCharacterLength();
42       } else if (type.equalsIgnoreCase(SqlKeywords.FLOAT)) {
43          dataTypeDescriptor.data_Type = SqlKeywords.FLOAT;
44          setNumericPrecision();
45       } else if (type.equalsIgnoreCase(SqlKeywords.VARCHAR2)) {
46          dataTypeDescriptor.data_Type = SqlKeywords.VARCHAR;
47          setCharacterLength();
48       } else {
49          throw new DException("DSE1133", new Object JavaDoc[] {_SRESERVEDWORD12065439221});
50       }
51       return null;
52    }
53
54    private void setNumericPrecision() throws DException {
55       if (_Optparenlength0 == null) {
56          dataTypeDescriptor.numeric_precision = new Integer JavaDoc(dataTypeDescriptor.
57              implicit_maximum_float_precision);
58       } else {
59          int maximumPrecision = ( (Integer JavaDoc) _Optparenlength0.run(null)).intValue();
60          if (maximumPrecision >
61              dataTypeDescriptor.implicit_maximum_float_precision) {
62             throw new DException("DSE989",
63                                  new Object JavaDoc[] {new Integer JavaDoc(maximumPrecision),
64                                  new
65                                  Integer JavaDoc(dataTypeDescriptor.
66                                          implicit_maximum_float_precision)});
67          }
68          dataTypeDescriptor.numeric_precision = new Integer JavaDoc(maximumPrecision);
69       }
70       dataTypeDescriptor.numeric_precision_radix = new Integer JavaDoc(2);
71    }
72
73    private void setCharacterLength() throws DException {
74       if (_Optparenlength0 == null) {
75          dataTypeDescriptor.character_maximum_length = new Integer JavaDoc(1);
76       } else {
77          Integer JavaDoc maximumLength = ( (Integer JavaDoc) _Optparenlength0.run(null));
78          if (maximumLength.intValue() >
79              dataTypeDescriptor.implicit_maximum_character_length) {
80             throw new DException("DSE983", new Object JavaDoc[] {maximumLength,
81                                  new Integer JavaDoc(dataTypeDescriptor.
82                                              implicit_maximum_character_length)});
83          }
84          dataTypeDescriptor.character_maximum_length = maximumLength;
85       }
86       dataTypeDescriptor.character_octet_length = new Integer JavaDoc(0);
87    }
88
89    public AbstractRowValueExpression[] getChilds() {
90       AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] {};
91       return childs;
92
93    }
94
95    public String JavaDoc toString() {
96       StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
97       sb.append(" ");
98       sb.append(_SRESERVEDWORD12065439221);
99       sb.append(" ");
100       if (_Optparenlength0 != null) {
101          sb.append(_Optparenlength0);
102       }
103       return sb.toString();
104    }
105
106    public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
107       SRESERVEDWORD1206543922Optparenlength tempClass = new
108           SRESERVEDWORD1206543922Optparenlength();
109       if (_Optparenlength0 != null) {
110          tempClass._Optparenlength0 = (parenlength) _Optparenlength0.clone();
111       }
112       tempClass._SRESERVEDWORD12065439221 = (SRESERVEDWORD1206543922)
113           _SRESERVEDWORD12065439221.clone();
114       return tempClass;
115    }
116 }
117
Popular Tags