1 28 29 package com.caucho.ejb.ql; 30 31 import com.caucho.bytecode.JMethod; 32 import com.caucho.config.ConfigException; 33 import com.caucho.ejb.cfg.EjbConfig; 34 import com.caucho.util.IntArray; 35 36 39 class Query { 40 final static int IDENTIFIER = 128; 41 final static int INTEGER = IDENTIFIER + 1; 42 final static int LONG = INTEGER + 1; 43 final static int DOUBLE = LONG + 1; 44 final static int STRING = DOUBLE + 1; 45 final static int TRUE = STRING + 1; 46 final static int FALSE = TRUE + 1; 47 final static int UNKNOWN = FALSE + 1; 48 final static int MEMBER = UNKNOWN + 1; 49 final static int OF = MEMBER + 1; 50 final static int EMPTY = OF + 1; 51 final static int NULL = EMPTY + 1; 52 53 final static int FROM = NULL + 1; 54 final static int IN = FROM + 1; 55 final static int SELECT = IN + 1; 56 final static int DISTINCT = SELECT + 1; 57 final static int WHERE = SELECT + 1; 58 final static int AS = WHERE + 1; 59 final static int ORDER = AS + 1; 60 final static int BY = ORDER + 1; 61 final static int ASC = BY + 1; 62 final static int DESC = ASC + 1; 63 final static int LIMIT = DESC + 1; 64 final static int OFFSET = LIMIT + 1; 65 66 final static int BETWEEN = OFFSET + 1; 67 final static int LIKE = BETWEEN + 1; 68 final static int ESCAPE = LIKE + 1; 69 final static int IS = ESCAPE + 1; 70 71 final static int EQ = IS + 1; 72 final static int NE = EQ + 1; 73 final static int LT = NE + 1; 74 final static int LE = LT + 1; 75 final static int GT = LE + 1; 76 final static int GE = GT + 1; 77 78 final static int AND = GE + 1; 79 final static int OR = AND + 1; 80 final static int NOT = OR + 1; 81 82 final static int EXTERNAL_DOT = NOT + 1; 83 84 final static int ARG = EXTERNAL_DOT + 1; 85 final static int THIS = ARG + 1; 86 87 private JMethod _method; 88 private EjbConfig _config; 89 90 private IntArray _argSize = new IntArray(); 91 92 JMethod getMethod() 93 { 94 return _method; 95 } 96 97 void setMethod(JMethod method) 98 { 99 _method = method; 100 } 101 102 void setConfig(EjbConfig config) 103 { 104 _config = config; 105 } 106 107 EjbConfig getConfig() 108 { 109 return _config; 110 } 111 112 115 public void setArgSize(int index, int size) 116 { 117 while (_argSize.size() < index) { 118 _argSize.add(0); 119 } 120 121 _argSize.set(index - 1, size); 122 } 123 124 127 public int getArgIndex(int index) 128 { 129 int size = 1; 130 131 for (int i = 0; i < index - 1; i++) { 132 size += _argSize.get(i); 133 } 134 135 return size; 136 } 137 138 141 public ConfigException error(String msg) 142 { 143 return new ConfigException(msg); 144 155 } 156 } 157 | Popular Tags |