1 24 25 package org.objectweb.cjdbc.common.sql; 26 27 38 public final class RequestType 39 { 40 42 public static final int CACHEABLE = 0; 43 44 45 public static final int UNCACHEABLE = 1; 46 47 51 public static final int UNIQUE_CACHEABLE = 2; 52 53 54 public static final int UNDEFINED = 0; 55 56 public static final int DELETE = 1; 57 58 public static final int INSERT = 2; 59 60 public static final int UPDATE = 3; 61 62 public static final int SELECT = 4; 63 64 67 68 public static final int STORED_PROCEDURE = 10; 69 70 73 74 public static final int CREATE = 20; 75 76 public static final int ALTER = 21; 77 78 public static final int DROP = 22; 79 80 92 static boolean isDDL(int requestType) 93 { 94 return RequestType.STORED_PROCEDURE <= requestType; 95 } 96 97 108 static boolean isDML(int requestType) 109 { 110 return RequestType.STORED_PROCEDURE >= requestType; 111 } 112 113 120 static boolean isDelete(int requestType) 121 { 122 return RequestType.DELETE == requestType; 123 } 124 125 132 static boolean isInsert(int requestType) 133 { 134 return RequestType.INSERT == requestType; 135 } 136 137 144 static boolean isUpdate(int requestType) 145 { 146 return RequestType.UPDATE == requestType; 147 } 148 149 156 static boolean isDrop(int requestType) 157 { 158 return RequestType.DROP == requestType; 159 } 160 161 168 static boolean isCreate(int requestType) 169 { 170 return RequestType.CREATE == requestType; 171 } 172 173 180 static boolean isAlter(int requestType) 181 { 182 return RequestType.ALTER == requestType; 183 } 184 185 192 static boolean isSelect(int requestType) 193 { 194 return RequestType.SELECT == requestType; 195 } 196 197 204 static boolean isStoredProcedure(int requestType) 205 { 206 return RequestType.STORED_PROCEDURE == requestType; 207 } 208 209 216 public static int getRequestType(AbstractRequest request) 217 { 218 return request.requestType; 219 } 220 221 225 static void setRequestType(AbstractRequest request, int type) 226 { 227 request.requestType = type; 228 } 229 230 236 public static String getInformation(int type) 237 { 238 switch (type) 239 { 240 case RequestType.CACHEABLE : 241 return "CACHEABLE"; 242 case RequestType.UNCACHEABLE : 243 return "UNCACHEABLE"; 244 case RequestType.UNIQUE_CACHEABLE : 245 return "UNIQUE_CACHEABLE"; 246 default : 247 return "Illegal request type"; 248 } 249 } 250 } 251 | Popular Tags |