1 package com.daffodilwoods.daffodildb.server.sql99.common; 2 3 import java.lang.reflect.Array ; 4 import java.math.*; 5 import java.sql.*; 6 7 import com.daffodilwoods.daffodildb.client.*; 8 import com.daffodilwoods.database.resource.*; 9 10 public class Check implements Datatypes { 11 12 19 public final static int getObject(Object result1, Object result2) throws 20 DException { 21 if (result1 == null) { 22 return -2; 23 } else if (result2 == null) { 24 return 2; 25 } else { 26 int type1 = getDataType(result1); 27 int type2 = getDataType(result2); 28 outerloop:switch (type1) { 29 case BYTE: 30 switch (type2) { 31 case BYTE: 32 int gg1 = ( (Comparable ) result1).compareTo(result2); 33 return gg1 < 0 ? -1 : gg1 == 0 ? 0 : 1; 34 case SHORT: 35 int gg2 = ( (Byte ) result1).shortValue() - 36 ( (Short ) result2).shortValue(); 37 return gg2 < 0 ? -1 : gg2 == 0 ? 0 : 1; 38 case INTEGER: 39 int gg3 = ( (Byte ) result1).intValue() - 40 ( (Integer ) result2).intValue(); 41 return gg3 < 0 ? -1 : gg3 == 0 ? 0 : 1; 42 case LONG: 43 long gg4 = ( (Byte ) result1).longValue() - 44 ( (Long ) result2).longValue(); 45 return gg4 < 0 ? -1 : gg4 == 0 ? 0 : 1; 46 case FLOAT: 47 float gg5 = ( (Byte ) result1).floatValue() - 48 ( (Float ) result2).floatValue(); 49 return gg5 < 0 ? -1 : gg5 == 0 ? 0 : 1; 50 case DOUBLE: 51 double gg6 = ( (Byte ) result1).doubleValue() - 52 ( (Double ) result2).doubleValue(); 53 return gg6 < 0 ? -1 : gg6 == 0 ? 0 : 1; 54 case BIGDECIMAL: 55 double gg7 = ( (Byte ) result1).doubleValue() - 56 ( (BigDecimal) result2).doubleValue(); 57 return gg7 < 0 ? -1 : gg7 == 0 ? 0 : 1; 58 case ARRAY: 59 Object [] array22 = (Object []) result2; 60 for (int i = 0; i < array22.length; ++i) { 61 int cmp = getObject(result1, array22[i]); 62 if (cmp == 0) { 63 return cmp; 64 } 65 } 66 return -1; 67 case TWODARRAY: 68 Object [][] array2D22 = (Object [][]) result2; 69 for (int i = 0; i < array2D22.length; ++i) { 70 int compare = getObject(result1, array2D22[i]); 71 if (compare == 0) { 72 return compare; 73 } 74 } 75 return -1; 76 case BOOLEAN: 77 boolean first = ( (Byte ) result1).byteValue() > 0; 78 boolean second = ( (Boolean ) result2).booleanValue(); 79 return first ^ second ? first ? 1 : -1 : 0; 80 default: 81 break; 82 } 83 break; 84 case SHORT: 85 switch (type2) { 86 case BYTE: 87 int mn = ( (Short ) result1).shortValue() - 88 ( (Byte ) result2).byteValue(); 89 return mn < 0 ? -1 : mn == 0 ? 0 : 1; 90 case SHORT: 91 int e = ( (Short ) result1).shortValue() - 92 ( (Short ) result2).shortValue(); 93 return e < 0 ? -1 : e == 0 ? 0 : 1; 94 case INTEGER: 95 int e1 = ( (Short ) result1).shortValue() - 96 ( (Integer ) result2).intValue(); 97 return e1 < 0 ? -1 : e1 == 0 ? 0 : 1; 98 case LONG: 99 long e2 = ( (Short ) result1).shortValue() - 100 ( (Long ) result2).longValue(); 101 return e2 < 0 ? -1 : e2 == 0 ? 0 : 1; 102 case FLOAT: 103 float e3 = ( (Short ) result1).shortValue() - 104 ( (Float ) result2).floatValue(); 105 return e3 < 0 ? -1 : e3 == 0 ? 0 : 1; 106 case DOUBLE: 107 double e4 = ( (Short ) result1).shortValue() - 108 ( (Double ) result2).doubleValue(); 109 return e4 < 0 ? -1 : e4 == 0 ? 0 : 1; 110 case BIGDECIMAL: 111 double bb = ( (Short ) result1).doubleValue() - 112 ( (BigDecimal) result2).doubleValue(); 113 return bb < 0 ? -1 : bb == 0 ? 0 : 1; 114 case ARRAY: 115 Object [] array = (Object []) result2; 116 for (int i = 0; i < array.length; ++i) { 117 int cmp = getObject(result1, array[i]); if (cmp == 0) { 119 return cmp; 120 } 121 } 122 return -1; 123 case TWODARRAY: 124 Object [][] array2D = (Object [][]) result2; 125 for (int i = 0; i < array2D.length; ++i) { 126 int compare = getObject(result1, array2D[i]); 127 if (compare == 0) { 128 return compare; 129 } 130 } 131 return -1; 132 case BOOLEAN: 133 boolean first = ( (Short ) result1).shortValue() > 0; 134 boolean second = ( (Boolean ) result2).booleanValue(); 135 return first ^ second ? first ? 1 : -1 : 0; 136 default: 137 break; 138 } 139 break; 140 141 case INTEGER: 142 switch (type2) { 143 case BYTE: 144 int mn1 = ( (Integer ) result1).intValue() - 145 ( (Byte ) result2).byteValue(); 146 return mn1 < 0 ? -1 : mn1 == 0 ? 0 : 1; 147 case SHORT: 148 int c4 = ( (Integer ) result1).intValue() - 149 ( (Short ) result2).shortValue(); 150 return c4 < 0 ? -1 : c4 == 0 ? 0 : 1; 151 case INTEGER: 152 153 int c = ( (Integer ) result1).intValue() - 154 ( (Integer ) result2).intValue(); 155 return c < 0 ? -1 : c == 0 ? 0 : 1; 156 case LONG: 157 long c1 = ( (Integer ) result1).intValue() - 158 ( (Long ) result2).longValue(); 159 return c1 < 0 ? -1 : c1 == 0 ? 0 : 1; 160 case FLOAT: 161 float c2 = ( (Integer ) result1).intValue() - 162 ( (Float ) result2).floatValue(); 163 return c2 < 0 ? -1 : c2 == 0 ? 0 : 1; 164 case DOUBLE: 165 double c3 = ( (Integer ) result1).intValue() - 166 ( (Double ) result2).doubleValue(); 167 return c3 < 0 ? -1 : c3 == 0 ? 0 : 1; 168 case BIGDECIMAL: 169 double bb1 = ( (Integer ) result1).doubleValue() - 170 ( (BigDecimal) result2).doubleValue(); 171 return bb1 < 0 ? -1 : bb1 == 0 ? 0 : 1; 172 case ARRAY: 173 174 Object [] array1 = (Object []) result2; 175 for (int i = 0; i < array1.length; ++i) { 176 int cmp1 = getObject(result1, array1[i]); if (cmp1 == 0) { 178 return cmp1; 179 } 180 } 181 return -1; 182 case TWODARRAY: 183 Object [][] array2D1 = (Object [][]) result2; 184 for (int i = 0; i < array2D1.length; ++i) { 185 int compare1 = getObject(result1, array2D1[i]); 186 if (compare1 == 0) { 187 return compare1; 188 } 189 } 190 return -1; 191 case BOOLEAN: 192 boolean first = ( (Integer ) result1).intValue() > 0; 193 boolean second = ( (Boolean ) result2).booleanValue(); 194 return first ^ second ? first ? 1 : -1 : 0; 195 default: 196 break; 197 } 198 break; 199 200 case BOOLEAN: 201 switch (type2) { 202 case BOOLEAN: 203 boolean f1 = ( (Boolean ) result1).booleanValue(); 204 boolean f2 = ( (Boolean ) result2).booleanValue(); 205 return f1 ^ f2 ? f1 ? 1 : -1 : 0; 206 case BYTE: 207 boolean firs1 = ( (Boolean ) result1).booleanValue(); 208 boolean secon1 = ( (Byte ) result2).byteValue() > 0; 209 return firs1 ^ secon1 ? firs1 ? 1 : -1 : 0; 210 case INTEGER: 211 boolean first = ( (Boolean ) result1).booleanValue(); 212 boolean second = ( (Integer ) result2).intValue() > 0; 213 return first ^ second ? first ? 1 : -1 : 0; 214 case BIGDECIMAL: 215 boolean first1 = ( (Boolean ) result1).booleanValue(); 216 boolean second1 = ( (BigDecimal) result2).intValue() > 0; 217 return first1 ^ second1 ? first1 ? 1 : -1 : 0; 218 case SHORT: 219 boolean first2 = ( (Boolean ) result1).booleanValue(); 220 boolean second2 = ( (Short ) result2).shortValue() > 0; 221 return first2 ^ second2 ? first2 ? 1 : -1 : 0; 222 case LONG: 223 boolean first3 = ( (Boolean ) result1).booleanValue(); 224 boolean second3 = ( (Long ) result2).longValue() > 0; 225 return first3 ^ second3 ? first3 ? 1 : -1 : 0; 226 case FLOAT: 227 boolean first4 = ( (Boolean ) result1).booleanValue(); 228 boolean second4 = ( (Float ) result2).floatValue() > 0; 229 return first4 ^ second4 ? first4 ? 1 : -1 : 0; 230 case DOUBLE: 231 boolean first5 = ( (Boolean ) result1).booleanValue(); 232 boolean second5 = ( (Double ) result2).doubleValue() > 0; 233 return first5 ^ second5 ? first5 ? 1 : -1 : 0; 234 case ARRAY: 235 Object [] array1 = (Object []) result2; 236 for (int i = 0; i < array1.length; ++i) { 237 int cmp1 = getObject(result1, array1[i]); if (cmp1 == 0) { 239 return cmp1; 240 } 241 } 242 return -1; 243 case TWODARRAY: 244 Object [][] array2D1 = (Object [][]) result2; 245 for (int i = 0; i < array2D1.length; ++i) { 246 int compare1 = getObject(result1, array2D1[i]); 247 if (compare1 == 0) { 248 return compare1; 249 } 250 } 251 return -1; 252 default: 253 break; 254 } 255 break; 256 case LONG: 257 switch (type2) { 258 case BYTE: 259 long mn2 = ( (Long ) result1).longValue() - 260 ( (Byte ) result2).byteValue(); 261 return mn2 < 0 ? -1 : mn2 == 0 ? 0 : 1; 262 case SHORT: 263 long c9 = ( (Long ) result1).longValue() - 264 ( (Short ) result2).shortValue(); 265 return c9 < 0 ? -1 : c9 == 0 ? 0 : 1; 266 case INTEGER: 267 long c5 = ( (Long ) result1).longValue() - 268 ( (Integer ) result2).intValue(); 269 return c5 < 0 ? -1 : c5 == 0 ? 0 : 1; 270 case LONG: 271 long c6 = ( (Long ) result1).longValue() - 272 ( (Long ) result2).longValue(); 273 return c6 < 0 ? -1 : c6 == 0 ? 0 : 1; 274 case FLOAT: 275 float c7 = ( (Long ) result1).longValue() - 276 ( (Float ) result2).floatValue(); 277 return c7 < 0 ? -1 : c7 == 0 ? 0 : 1; 278 case DOUBLE: 279 double c8 = ( (Long ) result1).longValue() - 280 ( (Double ) result2).doubleValue(); 281 return c8 < 0 ? -1 : c8 == 0 ? 0 : 1; 282 case BIGDECIMAL: 283 double bb2 = ( (Long ) result1).doubleValue() - 284 ( (BigDecimal) result2).doubleValue(); 285 return bb2 < 0 ? -1 : bb2 == 0 ? 0 : 1; 286 case ARRAY: 287 Object [] array2 = (Object []) result2; 288 for (int i = 0; i < array2.length; ++i) { 289 int cmp2 = getObject(result1, array2[i]); 290 if (cmp2 == 0) { 291 return cmp2; 292 } 293 } 294 return -1; 295 case TWODARRAY: 296 Object [][] array2D2 = (Object [][]) result2; 297 for (int i = 0; i < array2D2.length; ++i) { 298 int compare2 = getObject(result1, array2D2[i]); 299 if (compare2 == 0) { 300 return compare2; 301 } 302 } 303 return -1; 304 case BOOLEAN: 305 boolean first3 = ( (Long ) result1).longValue() > 0; 306 boolean second3 = ( (Boolean ) result2).booleanValue(); 307 return first3 ^ second3 ? first3 ? 1 : -1 : 0; 308 default: 309 break; 310 } 311 break; 312 case BIGDECIMAL: 313 switch (type2) { 314 case BYTE: 315 double mn3 = ( (BigDecimal) result1).doubleValue() - 316 ( (Byte ) result2).doubleValue(); 317 return mn3 < 0 ? -1 : mn3 == 0 ? 0 : 1; 318 case BOOLEAN: 319 boolean first3 = ( (BigDecimal) result1).longValue() > 0; 320 boolean second3 = ( (Boolean ) result2).booleanValue(); 321 return first3 ^ second3 ? first3 ? 1 : -1 : 0; 322 case SHORT: 323 double c9 = ( (BigDecimal) result1).doubleValue() - 324 ( (Short ) result2).doubleValue(); 325 return c9 < 0 ? -1 : c9 == 0 ? 0 : 1; 326 case INTEGER: 327 double c5 = ( (BigDecimal) result1).doubleValue() - 328 ( (Integer ) result2).doubleValue(); 329 return c5 < 0 ? -1 : c5 == 0 ? 0 : 1; 330 case LONG: 331 double c6 = ( (BigDecimal) result1).doubleValue() - 332 ( (Long ) result2).doubleValue(); 333 return c6 < 0 ? -1 : c6 == 0 ? 0 : 1; 334 case FLOAT: 335 double c7 = ( (BigDecimal) result1).doubleValue() - 336 ( (Float ) result2).doubleValue(); 337 return c7 < 0 ? -1 : c7 == 0 ? 0 : 1; 338 case DOUBLE: 339 int c8 = ( (BigDecimal) result1).compareTo(new BigDecimal( ( ( 340 Double ) result2).doubleValue())); 341 return c8 < 0 ? -1 : c8 == 0 ? 0 : 1; 342 case BIGDECIMAL: 343 int cmp1 = ( (Comparable ) result1).compareTo( (Comparable ) 344 result2); 345 346 return cmp1 < 0 ? -1 : cmp1 == 0 ? 0 : 1; 347 case ARRAY: 348 Object [] arr2 = (Object []) result2; 349 for (int i = 0; i < arr2.length; ++i) { 350 int cmp22 = getObject(result1, arr2[i]); 351 if (cmp22 == 0) { 352 return cmp22; 353 } 354 } 355 return -1; 356 default: 357 break; 358 } 359 break; 360 case FLOAT: 361 switch (type2) { 362 case BYTE: 363 float mn4 = ( (Float ) result1).floatValue() - 364 ( (Byte ) result2).byteValue(); 365 return mn4 < 0 ? -1 : mn4 == 0 ? 0 : 1; 366 case SHORT: 367 float d = ( (Float ) result1).floatValue() - 368 ( (Short ) result2).shortValue(); 369 return d < 0 ? -1 : d == 0 ? 0 : 1; 370 case INTEGER: 371 float d1 = ( (Float ) result1).floatValue() - 372 ( (Integer ) result2).intValue(); 373 return d1 < 0 ? -1 : d1 == 0 ? 0 : 1; 374 case LONG: 375 float d2 = ( (Float ) result1).floatValue() - 376 ( (Long ) result2).longValue(); 377 return d2 < 0 ? -1 : d2 == 0 ? 0 : 1; 378 case FLOAT: 379 float d3 = ( (Float ) result1).floatValue() - 380 ( (Float ) result2).floatValue(); 381 return d3 < 0 ? -1 : d3 == 0 ? 0 : 1; 382 case DOUBLE: 383 double d4 = ( (Float ) result1).floatValue() - 384 ( (Double ) result2).floatValue(); 385 return d4 < 0 ? -1 : d4 == 0 ? 0 : 1; 386 case BIGDECIMAL: 387 double bb3 = ( (Float ) result1).doubleValue() - 388 ( (BigDecimal) result2).doubleValue(); 389 return bb3 < 0 ? -1 : bb3 == 0 ? 0 : 1; 390 case ARRAY: 391 Object [] array3 = (Object []) result2; 392 for (int i = 0; i < array3.length; ++i) { 393 int cmp3 = getObject(result1, array3[i]); if (cmp3 == 0) { 395 return cmp3; 396 } 397 } 398 return -1; 399 case TWODARRAY: 400 Object [][] array2D3 = (Object [][]) result2; 401 for (int i = 0; i < array2D3.length; ++i) { 402 int compare3 = getObject(result1, array2D3[i]); 403 if (compare3 == 0) { 404 return compare3; 405 } 406 } 407 return -1; 408 case BOOLEAN: 409 boolean first3 = ( (Float ) result1).floatValue() > 0; 410 boolean second3 = ( (Boolean ) result2).booleanValue(); 411 return first3 ^ second3 ? first3 ? 1 : -1 : 0; 412 default: 413 break; 414 } 415 break; 416 case DOUBLE: 417 switch (type2) { 418 case BYTE: 419 double mn5 = ( (Double ) result1).doubleValue() - 420 ( (Byte ) result2).byteValue(); 421 return mn5 < 0 ? -1 : mn5 == 0 ? 0 : 1; 422 case SHORT: 423 double d5 = ( (Double ) result1).doubleValue() - 424 ( (Short ) result2).shortValue(); 425 return d5 < 0 ? -1 : d5 == 0 ? 0 : 1; 426 case INTEGER: 427 double d6 = ( (Double ) result1).doubleValue() - 428 ( (Integer ) result2).intValue(); 429 return d6 < 0 ? -1 : d6 == 0 ? 0 : 1; 430 case LONG: 431 double d7 = ( (Double ) result1).doubleValue() - 432 ( (Long ) result2).longValue(); 433 return d7 < 0 ? -1 : d7 == 0 ? 0 : 1; 434 case FLOAT: 435 double d8 = ( (Double ) result1).floatValue() - 436 ( (Float ) result2).floatValue(); 437 return d8 < 0 ? -1 : d8 == 0 ? 0 : 1; 438 case DOUBLE: 439 double d9 = ( (Double ) result1).doubleValue() - 440 ( (Double ) result2).doubleValue(); 441 return d9 < 0 ? -1 : d9 == 0 ? 0 : 1; 442 case BIGDECIMAL: 443 int bb4 = new BigDecimal( ( (Double ) result1).doubleValue()). 444 compareTo(result2); 445 return bb4 < 0 ? -1 : bb4 == 0 ? 0 : 1; 446 case ARRAY: 447 Object [] array4 = (Object []) result2; 448 for (int i = 0; i < array4.length; ++i) { 449 int cmp4 = ( (Comparable ) result1).compareTo( (Comparable ) 450 array4[i]); 451 if (cmp4 == 0) { 452 return cmp4; 453 } 454 } 455 return -1; 456 case TWODARRAY: 457 Object [][] array2D4 = (Object [][]) result2; 458 for (int i = 0; i < array2D4.length; ++i) { 459 int compare4 = getObject(result1, array2D4[i]); 460 if (compare4 == 0) { 461 return compare4; 462 } 463 } 464 return -1; 465 case BOOLEAN: 466 boolean first3 = ( (Double ) result1).doubleValue() > 0; 467 boolean second3 = ( (Boolean ) result2).booleanValue(); 468 return first3 ^ second3 ? first3 ? 1 : -1 : 0; 469 default: 470 break; 471 472 } 473 break; 474 case CHARACTER: 475 switch (type2) { 476 case CHARACTER: 477 int cmp = String.CASE_INSENSITIVE_ORDER.compare(result1, result2); 478 479 return cmp < 0 ? -1 : cmp == 0 ? 0 : 1; 480 case ARRAY: 481 Object [] array5 = (Object []) result2; 482 int cmp5 = 0; 483 for (int i = 0; i < array5.length; ++i) { 484 cmp5 = array5[i] == null ? -1 : 485 String.CASE_INSENSITIVE_ORDER.compare(result1, array5[i]); if (cmp5 == 0) { 487 return cmp5; 488 } 489 } 490 return -1; case TWODARRAY: 492 Object [][] array2D5 = (Object [][]) result2; 493 for (int i = 0; i < array2D5.length; ++i) { 494 int compare5 = getObject(result1, array2D5[i]); 495 if (compare5 == 0) { 496 return compare5; 497 } 498 } 499 return -1; 500 default: 501 break; 502 } 503 break; 504 case ARRAY: 505 switch (type2) { 506 case INTEGER: 507 Object [] array111 = (Object []) result1; 508 for (int i = 0; i < array111.length; ++i) { 509 int cmp111 = getObject(array111[i], result2); 510 if (cmp111 == 0) { 511 return cmp111; 512 } 513 } 514 return -1; 515 case BIGDECIMAL: 516 Object [] bd2 = (Object []) result1; 517 int cmpbd2 = 0; 518 for (int i = 0; i < bd2.length; ++i) { 519 cmpbd2 = getObject(bd2[i], result2); 520 if (cmpbd2 == 0) { 521 return cmpbd2; 522 } 523 } 524 return cmpbd2; 525 case CHARACTER: 526 bd2 = (Object []) result1; 527 cmpbd2 = 0; 528 for (int i = 0; i < bd2.length; ++i) { 529 cmpbd2 = getObject(bd2[i], result2); 530 if (cmpbd2 == 0) { 531 return cmpbd2; 532 } 533 } 534 return cmpbd2; 535 case ARRAY: 536 Object [] arraysource = (Object []) result1; 537 Object [] array6 = (Object []) result2; 538 for (int i = 0; i < array6.length; ++i) { 539 int cmp6 = getObject(arraysource[i], array6[i]); 540 if (cmp6 != 0) { 541 return cmp6 < 0 ? -1 : 1; 542 } 543 } 544 return 0; 545 case TWODARRAY: 546 Object [][] array2D6 = (Object [][]) result2; 547 for (int i = 0; i < array2D6.length; ++i) { 548 int compare6 = getObject(result1, array2D6[i]); 549 if (compare6 == 0) { 550 return compare6; 551 } 552 } 553 return -1; 554 } 555 case DATE: 556 switch (type2) { 557 case DATE: 558 java.sql.Date date1 = (java.sql.Date ) result1; 559 java.sql.Date date2 = (java.sql.Date ) result2; 560 int compareResult1 = ( (Comparable ) date1).compareTo( (Comparable ) 561 date2); 562 return compareResult1 < 0 ? -1 : compareResult1 == 0 ? 0 : 1; 563 } 564 case TIME: 565 switch (type2) { 566 case TIME: 567 int compareResult4 = ( (Comparable ) (Time) result1).compareTo( ( 568 Comparable ) (Time) result2); 569 return compareResult4 < 0 ? -1 : compareResult4 == 0 ? 0 : 1; 570 } 571 572 case TIMESTAMP: 573 switch (type2) { 574 case TIMESTAMP: 575 int compareResult6 = ( (Comparable ) (Timestamp) result1). 576 compareTo( (Comparable ) (Timestamp) result2); 577 return compareResult6 < 0 ? -1 : compareResult6 == 0 ? 0 : 1; 578 } 579 } 580 throw new DException("DSE35", 581 new Object [] {StaticClass.getDataTypeName(type1), 582 StaticClass.getDataTypeName(type2)}); 583 } 584 } 585 586 595 596 public static void checkForDatatype(int type1, int type2) throws DException { 597 if (type1 == -1 || type2 == -1) { 598 return; 599 } 600 outerloop:switch (type1) { 601 case SHORT: 602 case BYTE: 603 case TINYINT: 604 switch (type2) { 605 case BOOLEAN: 606 throw new DException("DSE0", 607 new Object [] {"Illegal Comparison of " + 608 StaticClass.getDataTypeName(type1) + " With " + 609 StaticClass.getDataTypeName(type2)}); 610 case DATE: 611 case TIME: 612 case TIMESTAMP: 613 case TIME_WITH_TIMEZONE: 614 case TIMESTAMP_WITH_TIMEZONE: 615 case CHARACTER: 616 case CLOB: 617 case CHARACTERLARGEOBJECT: 618 case CHAR: 619 case CHARLARGEOBJECT: 620 case VARCHAR: 621 case LONGVARCHAR: 622 case ARRAY: 623 case BLOB: 624 case BINARYLARGEOBJECT: 625 case LONGVARBINARY: 626 case BINARY: 627 case VARBINARY: 628 case REF: 629 case STRUCT: 630 case BIT: 631 case BITVARYING: 632 throw new DException("DSE87", 633 new Object [] {StaticClass. 634 getDataTypeName(type2), 635 StaticClass.getDataTypeName(type1)}); 636 default: 637 break; 638 } 639 break; 640 case INTEGER: 641 case INT: 642 switch (type2) { 643 case BOOLEAN: 644 throw new DException("DSE0", 645 new Object [] {"Illegal Comparison of " + 646 StaticClass.getDataTypeName(type1) + " With " + 647 StaticClass.getDataTypeName(type2)}); 648 case DATE: 649 case TIME: 650 case TIMESTAMP: 651 case CHARACTER: 652 case CLOB: 653 case CHARACTERLARGEOBJECT: 654 case CHARLARGEOBJECT: 655 case VARCHAR: 656 case CHAR: 657 case LONGVARCHAR: 658 case ARRAY: 659 case BLOB: 660 case BINARYLARGEOBJECT: 661 case LONGVARBINARY: 662 case BINARY: 663 case VARBINARY: 664 case REF: 665 case STRUCT: 666 case BIT: 667 case BITVARYING: 668 throw new DException("DSE87", 669 new Object [] {StaticClass. 670 getDataTypeName(type2), 671 StaticClass.getDataTypeName(type1)}); 672 default: 673 break; 674 } 675 break; 676 case LONG: 677 case BIGINT: 678 switch (type2) { 679 case BOOLEAN: 680 throw new DException("DSE0", 681 new Object [] {"Illegal Comparison of " + 682 StaticClass.getDataTypeName(type1) + " With " + 683 StaticClass.getDataTypeName(type2)}); 684 case DATE: 685 case TIME: 686 case TIMESTAMP: 687 case CHARACTER: 688 case CLOB: 689 case CHAR: 690 case CHARACTERLARGEOBJECT: 691 case CHARLARGEOBJECT: 692 case VARCHAR: 693 case LONGVARCHAR: 694 case ARRAY: 695 case BLOB: 696 case BINARYLARGEOBJECT: 697 case LONGVARBINARY: 698 case BINARY: 699 case VARBINARY: 700 case REF: 701 case STRUCT: 702 case BIT: 703 case BITVARYING: 704 throw new DException("DSE87", 705 new Object [] {StaticClass. 706 getDataTypeName(type2), 707 StaticClass.getDataTypeName(type1)}); 708 default: 709 break; 710 } 711 break; 712 case FLOAT: 713 case DOUBLE: 714 case DOUBLEPRECISION: 715 switch (type2) { 716 case BOOLEAN: 717 throw new DException("DSE0", 718 new Object [] {"Illegal Comparison of " + 719 StaticClass.getDataTypeName(type1) + " With " + 720 StaticClass.getDataTypeName(type2)}); 721 case DATE: 722 case TIME: 723 case TIMESTAMP: 724 case CHARACTER: 725 case CLOB: 726 case CHARACTERLARGEOBJECT: 727 case CHARLARGEOBJECT: 728 case CHAR: 729 case VARCHAR: 730 case LONGVARCHAR: 731 case ARRAY: 732 case BLOB: 733 case BINARYLARGEOBJECT: 734 case LONGVARBINARY: 735 case BINARY: 736 case VARBINARY: 737 case REF: 738 case STRUCT: 739 case BIT: 740 case BITVARYING: 741 throw new DException("DSE87", 742 new Object [] {StaticClass. 743 getDataTypeName(type2), 744 StaticClass.getDataTypeName(type1)}); 745 default: 746 break; 747 } 748 break; 749 case BIGDECIMAL: 750 case DEC: 751 case DECIMAL: 752 case NUMERIC: 753 switch (type2) { 754 case BOOLEAN: 755 throw new DException("DSE0", 756 new Object [] {"Illegal Comparison of " + 757 StaticClass.getDataTypeName(type1) + " With " + 758 StaticClass.getDataTypeName(type2)}); 759 case DATE: 760 case TIME: 761 case TIMESTAMP: 762 case CHARACTER: 763 case CLOB: 764 case CHARACTERLARGEOBJECT: 765 case CHAR: 766 case CHARLARGEOBJECT: 767 case VARCHAR: 768 case LONGVARCHAR: 769 case ARRAY: 770 case BLOB: 771 case BINARYLARGEOBJECT: 772 case LONGVARBINARY: 773 case BINARY: 774 case VARBINARY: 775 case REF: 776 case STRUCT: 777 case BIT: 778 case BITVARYING: 779 throw new DException("DSE87", 780 new Object [] {StaticClass. 781 getDataTypeName(type2), 782 StaticClass.getDataTypeName(type1)}); 783 default: 784 break; 785 } 786 break; 787 case CHARACTER: 788 case VARCHAR: 789 case LONGVARCHAR: 790 case CHAR: 791 switch (type2) { 792 case CHARACTER: 793 case VARCHAR: 794 case LONGVARCHAR: 795 case CHAR: 796 return; 797 default: 798 throw new DException("DSE87", 799 new Object [] {StaticClass. 800 getDataTypeName(type2), 801 StaticClass.getDataTypeName(type1)}); 802 } 803 case CLOB: 804 case CHARACTERLARGEOBJECT: 805 case CHARLARGEOBJECT: 806 switch (type2) { 807 case CLOB: 808 case CHARACTERLARGEOBJECT: 809 case CHARLARGEOBJECT: 811 throw new DException("DSE6001", 812 new Object [] {StaticClass. 813 getDataTypeName(type1)}); 814 default: 815 throw new DException("DSE4114", null); 816 } 817 case BLOB: 818 case BINARYLARGEOBJECT: 819 case LONGVARBINARY: 820 switch (type2) { 821 case BLOB: 822 case BINARYLARGEOBJECT: 823 case LONGVARBINARY: 825 throw new DException("DSE6001", 826 new Object [] {StaticClass. 827 getDataTypeName(type1)}); default: 829 throw new DException("DSE4114", null); 830 } 831 case BINARY: 832 case VARBINARY: 833 throw new DException("DSE6001", 834 new Object [] {StaticClass.getDataTypeName(type1)}); 835 case REF: 836 case STRUCT: 837 throw new DException("DSE514", 838 new Object [] {StaticClass.getDataTypeName(type1)}); 839 case BIT: 840 case BITVARYING: 841 throw new DException("DSE6001", 842 new Object [] {StaticClass.getDataTypeName(type1)}); 843 case BOOLEAN: 844 switch (type2) { 845 case BOOLEAN: 846 return; 847 case SHORT: 848 case BYTE: 849 case TINYINT: 850 case INTEGER: 851 case INT: 852 case LONG: 853 case BIGINT: 854 case FLOAT: 855 case DOUBLE: 856 case DOUBLEPRECISION: 857 case BIGDECIMAL: 858 case DEC: 859 case DECIMAL: 860 case NUMERIC: 861 throw new DException("DSE0", 862 new Object [] {"Illegal Comparison of " + 863 StaticClass.getDataTypeName(type1) + " With " + 864 StaticClass.getDataTypeName(type2)}); 865 default: 866 throw new DException("DSE87", 867 new Object [] {StaticClass. 868 getDataTypeName(type2), 869 StaticClass.getDataTypeName(type1)}); 870 } 871 case ARRAY: 872 switch (type2) { 873 case ARRAY: 874 return; 875 default: 876 throw new DException("DSE87", 877 new Object [] {StaticClass. 878 getDataTypeName(type2), 879 StaticClass.getDataTypeName(type1)}); 880 } 881 case DATE: 882 switch (type2) { 883 case DATE: 884 return; 885 default: 886 throw new DException("DSE87", 887 new Object [] {StaticClass. 888 getDataTypeName(type2), 889 StaticClass.getDataTypeName(type1)}); 890 } 891 case TIME: 892 switch (type2) { 893 case TIME: 894 return; 895 default: 896 throw new DException("DSE87", 897 new Object [] {StaticClass. 898 getDataTypeName(type2), 899 StaticClass.getDataTypeName(type1)}); 900 } 901 case TIME_WITH_TIMEZONE: 902 switch (type2) { 903 case TIME_WITH_TIMEZONE: 904 return; 905 default: 906 throw new DException("DSE87", 907 new Object [] {StaticClass. 908 getDataTypeName(type2), 909 StaticClass.getDataTypeName(type1)}); 910 } 911 case TIMESTAMP: 912 switch (type2) { 913 case TIMESTAMP: 914 return; 915 default: 916 throw new DException("DSE87", 917 new Object [] {StaticClass. 918 getDataTypeName(type2), 919 StaticClass.getDataTypeName(type1)}); 920 } 921 case TIMESTAMP_WITH_TIMEZONE: 922 switch (type2) { 923 case TIMESTAMP_WITH_TIMEZONE: 924 return; 925 default: 926 throw new DException("DSE87", 927 new Object [] {StaticClass. 928 getDataTypeName(type2), 929 StaticClass.getDataTypeName(type1)}); 930 } 931 } 932 } 933 934 943 944 public static void checkForDatatypeForArthmeticOperations(int type1, 945 int type2) throws DException { 946 if (type1 == -1 || type2 == -1) { 947 return; 948 } 949 switch (type1) { 950 case SHORT: 951 case BYTE: 952 case TINYINT: 953 switch (type2) { 954 case BOOLEAN: 955 case TIME: 956 case TIME_WITH_TIMEZONE: 957 case TIMESTAMP_WITH_TIMEZONE: 958 case CHARACTER: 959 case CLOB: 960 case CHARACTERLARGEOBJECT: 961 case CHAR: 962 case CHARLARGEOBJECT: 963 case VARCHAR: 964 case LONGVARCHAR: 965 case ARRAY: 966 case BLOB: 967 case BINARYLARGEOBJECT: 968 case LONGVARBINARY: 969 case BINARY: 970 case VARBINARY: 971 case REF: 972 case STRUCT: 973 case BIT: 974 case BITVARYING: 975 throw new DException("DSE87", 976 new Object [] {StaticClass. 977 getDataTypeName(type2), 978 StaticClass.getDataTypeName(type1)}); 979 default: 980 break; 981 } 982 break; 983 case INTEGER: 984 case INT: 985 switch (type2) { 986 case BOOLEAN: 987 case TIME: 988 case TIME_WITH_TIMEZONE: 989 case TIMESTAMP_WITH_TIMEZONE: 990 case CHARACTER: 991 case CLOB: 992 case CHARACTERLARGEOBJECT: 993 case CHAR: 994 case CHARLARGEOBJECT: 995 case VARCHAR: 996 case LONGVARCHAR: 997 case ARRAY: 998 case BLOB: 999 case BINARYLARGEOBJECT: 1000 case LONGVARBINARY: 1001 case BINARY: 1002 case VARBINARY: 1003 case REF: 1004 case STRUCT: 1005 case BIT: 1006 case BITVARYING: 1007 throw new DException("DSE87", 1008 new Object [] {StaticClass. 1009 getDataTypeName(type2), 1010 StaticClass.getDataTypeName(type1)}); 1011 default: 1012 break; 1013 } 1014 break; 1015 case LONG: 1016 case BIGINT: 1017 switch (type2) { 1018 case BOOLEAN: 1019 case TIME: 1020 case TIME_WITH_TIMEZONE: 1021 case TIMESTAMP_WITH_TIMEZONE: 1022 case CHARACTER: 1023 case CLOB: 1024 case CHARACTERLARGEOBJECT: 1025 case CHAR: 1026 case CHARLARGEOBJECT: 1027 case VARCHAR: 1028 case LONGVARCHAR: 1029 case ARRAY: 1030 case BLOB: 1031 case BINARYLARGEOBJECT: 1032 case LONGVARBINARY: 1033 case BINARY: 1034 case VARBINARY: 1035 case REF: 1036 case STRUCT: 1037 case BIT: 1038 case BITVARYING: 1039 throw new DException("DSE87", 1040 new Object [] {StaticClass. 1041 getDataTypeName(type2), 1042 StaticClass.getDataTypeName(type1)}); 1043 default: 1044 break; 1045 } 1046 break; 1047 case FLOAT: 1048 case DOUBLE: 1049 case DOUBLEPRECISION: 1050 switch (type2) { 1051 case BOOLEAN: 1052 case TIME: 1053 case TIME_WITH_TIMEZONE: 1054 case TIMESTAMP_WITH_TIMEZONE: 1055 case CHARACTER: 1056 case CLOB: 1057 case CHARACTERLARGEOBJECT: 1058 case CHAR: 1059 case CHARLARGEOBJECT: 1060 case VARCHAR: 1061 case LONGVARCHAR: 1062 case ARRAY: 1063 case BLOB: 1064 case BINARYLARGEOBJECT: 1065 case LONGVARBINARY: 1066 case BINARY: 1067 case VARBINARY: 1068 case REF: 1069 case STRUCT: 1070 case BIT: 1071 case BITVARYING: 1072 throw new DException("DSE87", 1073 new Object [] {StaticClass. 1074 getDataTypeName(type2), 1075 StaticClass.getDataTypeName(type1)}); 1076 default: 1077 break; 1078 } 1079 break; 1080 case BIGDECIMAL: 1081 case DEC: 1082 case DECIMAL: 1083 case NUMERIC: 1084 switch (type2) { 1085 case BOOLEAN: 1086 case TIME: 1087 case TIME_WITH_TIMEZONE: 1088 case TIMESTAMP_WITH_TIMEZONE: 1089 case CHARACTER: 1090 case CLOB: 1091 case CHARACTERLARGEOBJECT: 1092 case CHAR: 1093 case CHARLARGEOBJECT: 1094 case VARCHAR: 1095 case LONGVARCHAR: 1096 case ARRAY: 1097 case BLOB: 1098 case BINARYLARGEOBJECT: 1099 case LONGVARBINARY: 1100 case BINARY: 1101 case VARBINARY: 1102 case REF: 1103 case STRUCT: 1104 case BIT: 1105 case BITVARYING: 1106 throw new DException("DSE87", 1107 new Object [] {StaticClass. 1108 getDataTypeName(type2), 1109 StaticClass.getDataTypeName(type1)}); 1110 default: 1111 break; 1112 } 1113 break; 1114 case CHARACTER: 1115 case VARCHAR: 1116 case LONGVARCHAR: 1117 case CHAR: 1118 switch (type2) { 1119 case CHARACTER: 1120 case VARCHAR: 1121 case LONGVARCHAR: 1122 case CHAR: 1123 1124 1125 throw new DException("DSE87", 1126 new Object [] {StaticClass. 1127 getDataTypeName(type2), 1128 StaticClass.getDataTypeName(type1)}); 1129 default: 1130 throw new DException("DSE87", 1131 new Object [] {StaticClass. 1132 getDataTypeName(type2), 1133 StaticClass.getDataTypeName(type1)}); 1134 } 1135 1136 1137 case DATE: 1138 1139 switch (type2) { 1140 case CHARACTER: 1141 case VARCHAR: 1142 case LONGVARCHAR: 1143 case CHAR: 1144 case TIMESTAMP: 1145 case TIME_WITH_TIMEZONE: 1146 case TIMESTAMP_WITH_TIMEZONE: 1147 throw new DException("DSE87", 1148 new Object [] {StaticClass. 1149 getDataTypeName(type2), 1150 StaticClass.getDataTypeName(type1)}); 1151 1152 default: 1153 break; 1154 } 1155 break; 1156 1157 case TIMESTAMP: 1158 switch (type2) { 1159 case CHARACTER: 1160 case VARCHAR: 1161 case LONGVARCHAR: 1162 case CHAR: 1163 case DATE: 1164 case TIME_WITH_TIMEZONE: 1165 case TIMESTAMP_WITH_TIMEZONE: 1166 throw new DException("DSE87", 1167 new Object [] {StaticClass. 1168 getDataTypeName(type2), 1169 StaticClass.getDataTypeName(type1)}); 1170 1171 default: 1172 break; 1173 } 1174 break; 1175 case CLOB: 1176 case CHARACTERLARGEOBJECT: 1177 case CHARLARGEOBJECT: 1178 case BLOB: 1179 case BINARYLARGEOBJECT: 1180 case LONGVARBINARY: 1181 case BINARY: 1182 case VARBINARY: 1183 case REF: 1184 case STRUCT: 1185 case BIT: 1186 case BITVARYING: 1187 case BOOLEAN: 1188 case ARRAY: 1189 case TIME: 1190 case TIME_WITH_TIMEZONE: 1191 case TIMESTAMP_WITH_TIMEZONE: 1192 throw new DException("DSE87", 1193 new Object [] {StaticClass.getDataTypeName(type2), 1194 StaticClass.getDataTypeName(type1)}); 1195 1196 } 1197 } 1198 1199 1206 public static void checkForDataTypes(int[] dt1, int[] dt2) throws DException { 1207 int length = dt1.length; 1208 for (int i = 0; i < length; i++) { 1209 try { 1210 checkForDatatype(dt1[i], dt2[i]); 1211 } catch (DException ex) { 1212 if (!ex.getDseCode().equals("DSE0")) { 1213 throw ex; 1214 } 1215 } 1216 } 1217 } 1218 1219 public static void checkForAllowedDatatype(int type1) throws DException { 1220 switch (type1) { 1221 case BLOB: 1222 case CLOB: 1223 throw new DException("DSE4114", null); 1224 } 1225 } 1226 1227 private final static int getDataType(Object object) throws DException { 1228 if (object instanceof Integer ) { 1229 return INTEGER; 1230 } 1231 if (object instanceof Float ) { 1232 return FLOAT; 1233 } 1234 if (object instanceof Double ) { 1235 return DOUBLE; 1236 } 1237 if (object instanceof Long ) { 1238 return LONG; 1239 } 1240 if (object instanceof String ) { 1241 return CHARACTER; 1242 } 1243 if (object instanceof Short ) { 1244 return SHORT; 1245 } 1246 if (object instanceof BigDecimal) { 1247 return BIGDECIMAL; 1248 } 1249 if (object instanceof Boolean ) { 1250 return BOOLEAN; 1251 } 1252 if (object instanceof java.sql.Time ) { 1253 return TIME; 1254 } 1255 if (object instanceof java.sql.Timestamp ) { 1256 return TIMESTAMP; 1257 } 1258 if (object instanceof java.sql.Date ) { 1259 return DATE; 1260 } 1261 if (object instanceof Object [][]) { 1262 return TWODARRAY; 1263 } 1264 if (object instanceof Object []) { 1265 return ARRAY; 1266 } 1267 if (object instanceof Byte ) { 1268 return BYTE; 1269 } 1270 throw new DException("DSE4114", null); 1271 } 1272 1273 public final static Object negate(Object object) throws DException { 1274 if (object == null) { 1275 return object; 1276 } 1277 if (object instanceof BigDecimal) { 1278 return new java.math.BigDecimal ("-" + object); 1279 } 1280 if (object instanceof Integer ) { 1281 return new Integer (0 - ( (Integer ) object).intValue()); 1282 } 1283 if (object instanceof Long ) { 1284 return new Long (0 - ( (Long ) object).longValue()); 1285 } 1286 if (object instanceof Float ) { 1287 return new Float (0 - ( (Float ) object).floatValue()); 1288 } 1289 if (object instanceof Double ) { 1290 return new Double (0 - ( (Double ) object).doubleValue()); 1291 } 1292 if (object instanceof Short ) { 1293 return new Short ( (short) (0 - ( (Short ) object).shortValue())); 1294 } 1295 if (object instanceof Byte ) { 1296 return new Byte ( (byte) (0 - ( (Byte ) object).byteValue())); 1297 } 1298 if (object instanceof String ) { 1299 throw new DException("DSE529", new Object [] {"String"}); 1300 } 1301 if (object instanceof Boolean ) { 1302 throw new DException("DSE529", new Object [] {"Boolean"}); 1303 } 1304 if (object instanceof IgnoreValue) { 1305 throw new DException("DSE529", new Object [] {"IGNOREVALUE"}); 1306 } 1307 if (object instanceof java.sql.Time ) { 1308 throw new DException("DSE529", new Object [] {"Time"}); 1309 } 1310 if (object instanceof java.sql.Timestamp ) { 1311 throw new DException("DSE529", new Object [] {"TimeStamp"}); 1312 } 1313 if (object instanceof java.sql.Date ) { 1314 throw new DException("DSE529", new Object [] {"Date"}); 1315 } 1316 if (object instanceof Object [][]) { 1317 throw new DException("DSE529", new Object [] {"Array"}); 1318 } 1319 if (object instanceof Object []) { 1320 throw new DException("DSE529", new Object [] {"Array"}); 1321 } 1322 throw new DException("DSE416", new Object [] {object.getClass().getName()}); 1323 } 1324 1325 public static String print(Object array) { 1326 if (array == null) { 1327 return "[null]"; 1328 } 1329 int length = Array.getLength(array); 1330 String line = ""; 1331 for (int i = 0; i < length; i++) { 1332 Object obj = Array.get(array, i); 1333 line += "[" + (check(obj) ? print(obj) : ("" + obj)) + "]"; 1334 } 1335 return line; 1336 } 1337 1338 private static boolean check(Object array) { 1339 if (array == null) { 1340 return false; 1341 } 1342 try { 1343 Array.getLength(array); 1344 return true; 1345 } catch (IllegalArgumentException ia) { 1346 return false; 1347 } 1348 } 1349 1350 public static boolean checkForComparable(int dataType1, int dataType2) throws 1351 DException { 1352 switch (dataType1) { 1353 case DATE: 1354 switch (dataType2) { 1355 case DATE: 1356 return true; 1357 default: 1358 throw new DException("DSE514", 1359 new Object [] {StaticClass. 1360 getDataTypeName(dataType2)}); 1361 } 1362 case TIME: 1363 switch (dataType2) { 1364 case TIME: 1365 return true; 1366 default: 1367 throw new DException("DSE514", 1368 new Object [] {StaticClass. 1369 getDataTypeName(dataType2)}); 1370 } 1371 case TIMESTAMP: 1372 switch (dataType2) { 1373 case TIMESTAMP: 1374 return true; 1375 default: 1376 throw new DException("DSE514", 1377 new Object [] {StaticClass. 1378 getDataTypeName(dataType2)}); 1379 } 1380 case BOOLEAN: 1381 switch (dataType2) { 1382 case BOOLEAN: 1383 return true; 1384 default: 1385 throw new DException("DSE514", 1386 new Object [] {StaticClass. 1387 getDataTypeName(dataType2)}); 1388 } 1389 case CHARACTER: 1390 case VARCHAR: 1391 case LONGVARCHAR: 1392 case CHAR: 1393 switch (dataType2) { 1394 case CHARACTER: 1395 case VARCHAR: 1396 case LONGVARCHAR: 1397 case CHAR: 1398 return true; 1399 default: 1400 throw new DException("DSE514", 1401 new Object [] {StaticClass. 1402 getDataTypeName(dataType2)}); 1403 } 1404 case BIGDECIMAL: 1405 case DEC: 1406 case DECIMAL: 1407 case NUMERIC: 1408 switch (dataType2) { 1409 case BIGDECIMAL: 1410 case DEC: 1411 case DECIMAL: 1412 case NUMERIC: 1413 return true; 1414 default: 1415 return false; 1416 } 1417 case LONG: 1418 case BIGINT: 1419 1420 switch (dataType2) { 1421 case LONG: 1422 case BIGINT: 1423 1424 return true; 1425 default: 1426 return false; 1427 } 1428 case TINYINT: 1429 case BYTE: 1430 switch (dataType2) { 1431 case TINYINT: 1432 case BYTE: 1433 return true; 1434 default: 1435 return false; 1436 } 1437 case BINARY: 1438 case VARBINARY: 1439 switch (dataType2) { 1440 case BINARY: 1441 case VARBINARY: 1442 return true; 1443 default: 1444 return false; 1445 } 1446 case BIT: 1447 case BITVARYING: 1448 switch (dataType2) { 1449 case BIT: 1450 case BITVARYING: 1451 return true; 1452 default: 1453 return false; 1454 } 1455 case DOUBLE: 1456 case DOUBLEPRECISION: 1457 case FLOAT: 1458 switch (dataType2) { 1459 case DOUBLE: 1460 case DOUBLEPRECISION: 1461 case FLOAT: 1462 return true; 1463 default: 1464 return false; 1465 } 1466 case INT: 1467 case INTEGER: 1468 switch (dataType2) { 1469 case INT: 1470 case INTEGER: 1471 return true; 1472 default: 1473 return false; 1474 } 1475 case REAL: 1476 switch (dataType2) { 1477 case REAL: 1478 return true; 1479 default: 1480 return false; 1481 } 1482 case SHORT: 1483 case SMALLINT: 1484 switch (dataType2) { 1485 case SHORT: 1486 case SMALLINT: 1487 return true; 1488 default: 1489 return false; 1490 } 1491 } 1492 throw new DException("DSE35", 1493 new Object [] {StaticClass.getDataTypeName(dataType1), 1494 StaticClass.getDataTypeName(dataType2)}); 1495 } 1496 1497 public static void checkForUserDefinedFunctionDatatype(int returnClauseDataType, int returnStatementDataType) throws DException { 1498 if (returnClauseDataType == -1 || returnStatementDataType == -1) { 1499 return; 1500 } 1501 outerloop:switch (returnClauseDataType) { 1502 case SHORT: 1503 case BYTE: 1504 case TINYINT: 1505 switch (returnStatementDataType) { 1506 case BOOLEAN: 1507 throw new DException("DSE0", 1508 new Object [] {"Illegal Comparison of " + 1509 StaticClass.getDataTypeName(returnClauseDataType) + " With " + 1510 StaticClass.getDataTypeName(returnStatementDataType)}); 1511 case DATE: 1512 case TIME: 1513 case TIMESTAMP: 1514 case TIME_WITH_TIMEZONE: 1515 case TIMESTAMP_WITH_TIMEZONE: 1516 case CHARACTER: 1517 case CLOB: 1518 case CHARACTERLARGEOBJECT: 1519 case CHAR: 1520 case CHARLARGEOBJECT: 1521 case VARCHAR: 1522 case LONGVARCHAR: 1523 case ARRAY: 1524 case BLOB: 1525 case BINARYLARGEOBJECT: 1526 case LONGVARBINARY: 1527 case BINARY: 1528 case VARBINARY: 1529 case REF: 1530 case STRUCT: 1531 case BIT: 1532 case BITVARYING: 1533 case INTEGER: 1534 case INT: 1535 case LONG: 1536 case BIGINT: 1537 case FLOAT: 1538 case DOUBLE: 1539 case DOUBLEPRECISION: 1540 case BIGDECIMAL: 1541 case DEC: 1542 case DECIMAL: 1543 case NUMERIC: 1544 throw new DException("DSE87", 1545 new Object [] {StaticClass. 1546 getDataTypeName(returnStatementDataType), 1547 StaticClass.getDataTypeName(returnClauseDataType)}); 1548 default: 1549 break; 1550 } 1551 break; 1552 case INTEGER: 1553 case INT: 1554 switch (returnStatementDataType) { 1555 case BOOLEAN: 1556 throw new DException("DSE0", 1557 new Object [] {"Illegal Comparison of " + 1558 StaticClass.getDataTypeName(returnClauseDataType) + " With " + 1559 StaticClass.getDataTypeName(returnStatementDataType)}); 1560 case DATE: 1561 case TIME: 1562 case TIMESTAMP: 1563 case CHARACTER: 1564 case CLOB: 1565 case CHARACTERLARGEOBJECT: 1566 case CHARLARGEOBJECT: 1567 case VARCHAR: 1568 case CHAR: 1569 case LONGVARCHAR: 1570 case ARRAY: 1571 case BLOB: 1572 case BINARYLARGEOBJECT: 1573 case LONGVARBINARY: 1574 case BINARY: 1575 case VARBINARY: 1576 case REF: 1577 case STRUCT: 1578 case BIT: 1579 case BITVARYING: 1580 case LONG: 1581 case BIGINT: 1582 case FLOAT: 1583 case DOUBLE: 1584 case DOUBLEPRECISION: 1585 case BIGDECIMAL: 1586 case DEC: 1587 case DECIMAL: 1588 case NUMERIC: 1589 throw new DException("DSE87", 1590 new Object [] {StaticClass. 1591 getDataTypeName(returnStatementDataType), 1592 StaticClass.getDataTypeName(returnClauseDataType)}); 1593 default: 1594 break; 1595 } 1596 break; 1597 case LONG: 1598 case BIGINT: 1599 switch (returnStatementDataType) { 1600 case BOOLEAN: 1601 throw new DException("DSE0", 1602 new Object [] {"Illegal Comparison of " + 1603 StaticClass.getDataTypeName(returnClauseDataType) + " With " + 1604 StaticClass.getDataTypeName(returnStatementDataType)}); 1605 case DATE: 1606 case TIME: 1607 case TIMESTAMP: 1608 case CHARACTER: 1609 case CLOB: 1610 case CHAR: 1611 case CHARACTERLARGEOBJECT: 1612 case CHARLARGEOBJECT: 1613 case VARCHAR: 1614 case LONGVARCHAR: 1615 case ARRAY: 1616 case BLOB: 1617 case BINARYLARGEOBJECT: 1618 case LONGVARBINARY: 1619 case BINARY: 1620 case VARBINARY: 1621 case REF: 1622 case STRUCT: 1623 case BIT: 1624 case BITVARYING: 1625 case BIGDECIMAL: 1626 case DEC: 1627 case DECIMAL: 1628 case NUMERIC: 1629 throw new DException("DSE87", 1630 new Object [] {StaticClass. 1631 getDataTypeName(returnStatementDataType), 1632 StaticClass.getDataTypeName(returnClauseDataType)}); 1633 default: 1634 break; 1635 } 1636 break; 1637 case FLOAT: 1638 case DOUBLE: 1639 case DOUBLEPRECISION: 1640 switch (returnStatementDataType) { 1641 case BOOLEAN: 1642 throw new DException("DSE0", 1643 new Object [] {"Illegal Comparison of " + 1644 StaticClass.getDataTypeName(returnClauseDataType) + " With " + 1645 StaticClass.getDataTypeName(returnStatementDataType)}); 1646 case DATE: 1647 case TIME: 1648 case TIMESTAMP: 1649 case CHARACTER: 1650 case CLOB: 1651 case CHARACTERLARGEOBJECT: 1652 case CHARLARGEOBJECT: 1653 case CHAR: 1654 case VARCHAR: 1655 case LONGVARCHAR: 1656 case ARRAY: 1657 case BLOB: 1658 case BINARYLARGEOBJECT: 1659 case LONGVARBINARY: 1660 case BINARY: 1661 case VARBINARY: 1662 case REF: 1663 case STRUCT: 1664 case BIT: 1665 case BITVARYING: 1666 throw new DException("DSE87", 1667 new Object [] {StaticClass. 1668 getDataTypeName(returnStatementDataType), 1669 StaticClass.getDataTypeName(returnClauseDataType)}); 1670 default: 1671 break; 1672 } 1673 break; 1674 case BIGDECIMAL: 1675 case DEC: 1676 case DECIMAL: 1677 case NUMERIC: 1678 switch (returnStatementDataType) { 1679 case BOOLEAN: 1680 throw new DException("DSE0", 1681 new Object [] {"Illegal Comparison of " + 1682 StaticClass.getDataTypeName(returnClauseDataType) + " With " + 1683 StaticClass.getDataTypeName(returnStatementDataType)}); 1684 case DATE: 1685 case TIME: 1686 case TIMESTAMP: 1687 case CHARACTER: 1688 case CLOB: 1689 case CHARACTERLARGEOBJECT: 1690 case CHAR: 1691 case CHARLARGEOBJECT: 1692 case VARCHAR: 1693 case LONGVARCHAR: 1694 case ARRAY: 1695 case BLOB: 1696 case BINARYLARGEOBJECT: 1697 case LONGVARBINARY: 1698 case BINARY: 1699 case VARBINARY: 1700 case REF: 1701 case STRUCT: 1702 case BIT: 1703 case BITVARYING: 1704 throw new DException("DSE87", 1705 new Object [] {StaticClass. 1706 getDataTypeName(returnStatementDataType), 1707 StaticClass.getDataTypeName(returnClauseDataType)}); 1708 default: 1709 break; 1710 } 1711 break; 1712 case CHARACTER: 1713 case VARCHAR: 1714 case LONGVARCHAR: 1715 case CHAR: 1716 switch (returnStatementDataType) { 1717 case CHARACTER: 1718 case VARCHAR: 1719 case LONGVARCHAR: 1720 case CHAR: 1721 return; 1722 default: 1723 throw new DException("DSE87", 1724 new Object [] {StaticClass. 1725 getDataTypeName(returnStatementDataType), 1726 StaticClass.getDataTypeName(returnClauseDataType)}); 1727 } 1728 case CLOB: 1729 case CHARACTERLARGEOBJECT: 1730 case CHARLARGEOBJECT: 1731 switch (returnStatementDataType) { 1732 case CLOB: 1733 case CHARACTERLARGEOBJECT: 1734 case CHARLARGEOBJECT: 1736 throw new DException("DSE6001", 1737 new Object [] {StaticClass. 1738 getDataTypeName(returnClauseDataType)}); 1739 default: 1740 throw new DException("DSE4114", null); 1741 } 1742 case BLOB: 1743 case BINARYLARGEOBJECT: 1744 case LONGVARBINARY: 1745 switch (returnStatementDataType) { 1746 case BLOB: 1747 case BINARYLARGEOBJECT: 1748 case LONGVARBINARY: 1750 throw new DException("DSE6001", 1751 new Object [] {StaticClass. 1752 getDataTypeName(returnClauseDataType)}); default: 1754 throw new DException("DSE4114", null); 1755 } 1756 case BINARY: 1757 case VARBINARY: 1758 throw new DException("DSE6001", 1759 new Object [] {StaticClass.getDataTypeName(returnClauseDataType)}); 1760 case REF: 1761 case STRUCT: 1762 throw new DException("DSE514", 1763 new Object [] {StaticClass.getDataTypeName(returnClauseDataType)}); 1764 case BIT: 1765 case BITVARYING: 1766 throw new DException("DSE6001", 1767 new Object [] {StaticClass.getDataTypeName(returnClauseDataType)}); 1768 case BOOLEAN: 1769 switch (returnStatementDataType) { 1770 case BOOLEAN: 1771 return; 1772 case SHORT: 1773 case BYTE: 1774 case TINYINT: 1775 case INTEGER: 1776 case INT: 1777 case LONG: 1778 case BIGINT: 1779 case FLOAT: 1780 case DOUBLE: 1781 case DOUBLEPRECISION: 1782 case BIGDECIMAL: 1783 case DEC: 1784 case DECIMAL: 1785 case NUMERIC: 1786 throw new DException("DSE0", 1787 new Object [] {"Illegal Comparison of " + 1788 StaticClass.getDataTypeName(returnClauseDataType) + " With " + 1789 StaticClass.getDataTypeName(returnStatementDataType)}); 1790 default: 1791 throw new DException("DSE87", 1792 new Object [] {StaticClass. 1793 getDataTypeName(returnStatementDataType), 1794 StaticClass.getDataTypeName(returnClauseDataType)}); 1795 } 1796 case DATE: 1797 switch (returnStatementDataType) { 1798 case DATE: 1799 return; 1800 default: 1801 throw new DException("DSE87", 1802 new Object [] {StaticClass. 1803 getDataTypeName(returnStatementDataType), 1804 StaticClass.getDataTypeName(returnClauseDataType)}); 1805 } 1806 case TIME: 1807 switch (returnStatementDataType) { 1808 case TIME: 1809 return; 1810 default: 1811 throw new DException("DSE87", 1812 new Object [] {StaticClass. 1813 getDataTypeName(returnStatementDataType), 1814 StaticClass.getDataTypeName(returnClauseDataType)}); 1815 } 1816 case TIME_WITH_TIMEZONE: 1817 switch (returnStatementDataType) { 1818 case TIME_WITH_TIMEZONE: 1819 return; 1820 default: 1821 throw new DException("DSE87", 1822 new Object [] {StaticClass. 1823 getDataTypeName(returnStatementDataType), 1824 StaticClass.getDataTypeName(returnClauseDataType)}); 1825 } 1826 case TIMESTAMP: 1827 switch (returnStatementDataType) { 1828 case TIMESTAMP: 1829 return; 1830 default: 1831 throw new DException("DSE87", 1832 new Object [] {StaticClass. 1833 getDataTypeName(returnStatementDataType), 1834 StaticClass.getDataTypeName(returnClauseDataType)}); 1835 } 1836 case TIMESTAMP_WITH_TIMEZONE: 1837 switch (returnStatementDataType) { 1838 case TIMESTAMP_WITH_TIMEZONE: 1839 return; 1840 default: 1841 throw new DException("DSE87", 1842 new Object [] {StaticClass. 1843 getDataTypeName(returnStatementDataType), 1844 StaticClass.getDataTypeName(returnClauseDataType)}); 1845 } 1846 } 1847 } 1848} 1849 | Popular Tags |