1 package com.daffodilwoods.daffodildb.server.sessionsystem; 2 3 import java.sql.*; 4 import java.sql.Date ; 5 import java.util.*; 6 7 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*; 8 import com.daffodilwoods.daffodildb.server.datasystem.mergesystem.*; 9 import com.daffodilwoods.daffodildb.server.datasystem.utility.*; 10 import com.daffodilwoods.daffodildb.server.datasystem.utility._Record; 11 import com.daffodilwoods.daffodildb.server.serversystem.*; 12 import com.daffodilwoods.daffodildb.server.serversystem.dmlvalidation.constraintsystem.*; 13 import com.daffodilwoods.daffodildb.server.sessionsystem.sessioncondition.*; 14 import com.daffodilwoods.daffodildb.server.sessionsystem.sessionversioninfo.*; 15 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*; 16 import com.daffodilwoods.daffodildb.utils.*; 17 import com.daffodilwoods.database.general.*; 18 import com.daffodilwoods.database.resource.*; 19 20 21 27 public class Session extends ConditionProvider implements _Session { 28 29 public Object sessionConstant; 30 public SessionDatabase sessionDatabase; 31 int isolationLevel = -1; 32 private TreeMap sessionTableList = new TreeMap(String.CASE_INSENSITIVE_ORDER); 33 private Lock lock; 34 boolean constraintChecking = true; 35 private SessionSQL sessionSQL; 36 TreeMap immediateModeConstraints = new TreeMap(String.CASE_INSENSITIVE_ORDER); 37 private ConstraintInformation constraintInformation; 38 39 private ArrayList arr; 40 private ForUpdateTableHandler forUpdateTableHandler; 41 public _DataRetriever dataRetriever; 42 boolean autoCommit = false, isTransactionStarted; 43 44 public Session(Object sessionConstant, Object sessionId, Object transactionId, SessionDatabase sessionDatabase) throws DException { 45 super(sessionId, transactionId); 46 this.sessionDatabase = sessionDatabase; 47 this.sessionConstant = sessionConstant; 48 lock = new Lock(); 49 sessionSQL = new SessionSQL(); 50 SessionTransactionMode transactionMode = new SessionTransactionMode(); 51 transactionMode.setTransactionAccessMode("Read Write"); 52 sessionSQL.setTransactionMode(transactionMode); 53 constraintInformation = new ConstraintInformation(); 54 dataRetriever = new SessionSerializableDataRetriever(this); 55 } 56 57 64 65 public synchronized _SessionTable getSessionTable(QualifiedIdentifier tableName) throws DException { 66 _SessionTable sessionTable = (_SessionTable) sessionTableList.get(tableName.getIdentifier()); 67 if (sessionTable != null) 68 return sessionTable; 69 _DataDictionary dataDictionary = sessionDatabase.getDataDictionary(); 70 forUpdateTableHandler = sessionDatabase.getForUpdateTableHandler(tableName); 71 SessionVersionHandler sessionVersionHandler = ( (MergeDatabase) sessionDatabase.getMergeDatabase()).getSessionVersionHandler(); 72 sessionTable = new SessionTable(tableName, this, sessionDatabase.getMergeDatabase().getTable(tableName), sessionDatabase.getTableRowIdGetter(tableName), forUpdateTableHandler, sessionVersionHandler); 73 ( (SessionTable) sessionTable).setRowLocker(sessionDatabase.getRowLocker(tableName)); 74 sessionTableList.put(tableName.getIdentifier(), sessionTable); 75 return sessionTable; 76 } 77 78 public synchronized void commit(_StatementExecutionContext statementExecutionContext) throws DException { 79 throw new UnsupportedOperationException (" Method not should not be called "); 80 } 81 82 91 92 public synchronized void rollback(_StatementExecutionContext statementExecutionContext) throws DException { 93 Iterator sessionTablesIterator = sessionTableList.values().iterator(); 94 while (sessionTablesIterator.hasNext()) { 95 _SessionTable sessionTable = (_SessionTable) sessionTablesIterator.next(); 96 ( (SessionTable) sessionTable).removeSession(); 97 sessionTable.performRollBack(statementExecutionContext); 98 99 } 100 } 101 102 108 109 public TreeMap getSessionTableList() throws DException { 110 return sessionTableList; 111 } 112 113 public _ServerSession getGlobalSession() throws DException { 114 return sessionDatabase.getGlobalSession(); 115 } 116 117 public Lock getLock() throws DException { 118 return lock; 119 } 120 121 126 127 public Object getTransactionIdAtStart() throws DException { 128 return transactionId; 129 } 130 131 137 138 144 145 public boolean isEnabledAuthorizationIdentifier(String authorizationIdentifier) throws DException { 146 return sessionSQL.isEnabledAuthorizationIdentifier(authorizationIdentifier, sessionDatabase.getGlobalSession()); 147 } 148 149 public _SessionDatabase getSessionDatabase() throws DException { 150 return sessionDatabase; 151 } 152 153 158 159 public String getCurrentRole() throws DException { 160 return sessionSQL.getCurrentRole(); 161 } 162 163 168 169 public void setTransactionMode(SessionTransactionMode sessionTransactionMode) throws DException { 170 171 if (sessionTransactionMode.getIsolationLevel() != null) 172 setIsolationLevel(sessionTransactionMode.getIsolationLevel().toString()); 173 sessionSQL.setTransactionMode(sessionTransactionMode); 174 } 175 176 public Object getSessionId() throws DException { 177 return sessionId; 178 } 179 180 185 186 public Date getDate() throws DException { 187 return sessionSQL.getDate(); 188 } 189 190 public void setIsolationLevel(int level) throws DException { 191 if (isDataModified()) 192 throw new DException("DSE2052", null); 193 194 if (ReadUncommitted == level) { 195 sessionSQL.getTransactionMode().setTransactionAccessMode("Read Only"); 196 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics.READUNCOMMIT); 197 dataRetriever = new UncommittedDataRetriever(this); 198 } else if (ReadCommitted == level) { 199 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics. 200 READCOMMIT); 201 dataRetriever = new CommittedDataRetriever(this); 202 } else if (ReadRepeatable == level) { 203 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics. 204 REPEATABLEREAD); 205 dataRetriever = new RepeatableDataRetriever(this); 206 } else if (ReadTransactionSerializable == level) { 207 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics. 208 TRANSACTIONSERIALIZABLE); 209 dataRetriever = new TransactionSerializedDataRetriever(this); 210 } else if (ReadSessionSerializable == level) { 211 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics. 212 SESSIONSERIALIZABLE); 213 dataRetriever = new SessionSerializableDataRetriever(this); 214 } else if (ReadUnLokedCommitted == level) { 215 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics.UNLOCKEDCOMMITTED); 216 dataRetriever = new UnLockedCommittedDataRetriever(this); 217 } 218 this.isolationLevel = level; 219 } 220 221 public void setIsolationLevel(String level) throws DException { 222 boolean isAnyTableDirty = false; 223 for (Iterator iter = sessionTableList.keySet().iterator(); iter.hasNext(); ) { 224 if(((_SessionTable)sessionTableList.get(iter.next())).isDataModified() ){ 225 isAnyTableDirty = true; 226 break; 227 } 228 } 229 if(isAnyTableDirty) 230 throw new DException("DSE2052",null ); 231 if (level.equalsIgnoreCase((String )SessionCharacteristics.READUNCOMMIT )) { 232 sessionSQL.getTransactionMode().setTransactionAccessMode("Read Only"); 233 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics.READUNCOMMIT); 234 dataRetriever = new UncommittedDataRetriever(this); 235 this.isolationLevel = ReadUncommitted; 236 } else if (level.equalsIgnoreCase((String )SessionCharacteristics.READCOMMIT )) { 237 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics. 238 READCOMMIT); 239 dataRetriever = new CommittedDataRetriever(this); 240 this.isolationLevel = ReadCommitted; 241 } else if (level.equalsIgnoreCase((String )SessionCharacteristics.REPEATABLEREAD )) { 242 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics. 243 REPEATABLEREAD); 244 dataRetriever = new RepeatableDataRetriever(this); 245 this.isolationLevel = ReadRepeatable; 246 } else if (level.equalsIgnoreCase((String )SessionCharacteristics.TRANSACTIONSERIALIZABLE )|| 247 level.equalsIgnoreCase((String )SessionCharacteristics.SERIALIZABLE )) { 248 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics. 249 TRANSACTIONSERIALIZABLE); 250 dataRetriever = new TransactionSerializedDataRetriever(this); 251 this.isolationLevel = ReadTransactionSerializable; 252 } else if (level.equalsIgnoreCase((String )SessionCharacteristics.SESSIONSERIALIZABLE )) { 253 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics. 254 SESSIONSERIALIZABLE); 255 dataRetriever = new SessionSerializableDataRetriever(this); 256 this.isolationLevel = ReadSessionSerializable; 257 } else if (level.equalsIgnoreCase((String )SessionCharacteristics.UNLOCKEDCOMMITTED )) { 258 sessionSQL.getTransactionMode().setIsolationLevel(SessionCharacteristics.UNLOCKEDCOMMITTED); 259 dataRetriever = new UnLockedCommittedDataRetriever(this); 260 this.isolationLevel = ReadUnLokedCommitted; 261 } 262 } 263 264 269 270 public int getMonth() throws DException { 271 return sessionSQL.getMonth(); 272 } 273 274 public int getIsolationLevel() throws DException { 275 SessionTransactionMode transactionMode = sessionSQL.getTransactionMode(); 276 if (transactionMode == null) 277 return ReadSessionSerializable; 278 Object isolationLevel = transactionMode.getIsolationLevel(); 279 if (isolationLevel == null) 280 return ReadSessionSerializable; 281 if (isolationLevel.equals( (String ) SessionCharacteristics.READUNCOMMIT)) 282 return ReadUncommitted; 283 else if (isolationLevel.equals( (String ) SessionCharacteristics.READCOMMIT)) 284 return ReadCommitted; 285 else if (isolationLevel.equals( (String ) SessionCharacteristics.SERIALIZABLE) || isolationLevel.equals( (String ) SessionCharacteristics.TRANSACTIONSERIALIZABLE)) 286 return ReadTransactionSerializable; 287 else if (isolationLevel.equals( (String ) SessionCharacteristics.REPEATABLEREAD)) 288 return ReadRepeatable; 289 else if (isolationLevel.equals( (String ) SessionCharacteristics.UNLOCKEDCOMMITTED)) 290 return ReadUnLokedCommitted; 291 else 292 return ReadSessionSerializable; 293 } 294 295 300 301 public int getHour() throws DException { 302 return sessionSQL.getHour(); 303 } 304 305 310 311 public int getSeconds() throws DException { 312 return sessionSQL.getSeconds(); 313 } 314 315 public String getAuthorizationIdentifier() throws DException { 316 return sessionSQL.getAuthorizationIdentifier(); 317 } 318 319 324 325 public String getCurrentUser() throws DException { 326 return sessionSQL.getCurrentUser(); 327 } 328 329 334 335 public SessionTransactionMode getTransactionMode() throws DException { 336 return sessionSQL.getTransactionMode(); 337 } 338 339 public Time getTime() throws DException { 340 return sessionSQL.getTime(); 341 } 342 343 348 349 public boolean checkConstraint() throws DException { 350 return constraintChecking; 351 } 352 353 public int getYear() throws DException { 354 return sessionSQL.getYear(); 355 } 356 357 361 362 public void removeAllTables() throws DException { 363 sessionTableList.clear(); 364 } 365 366 public int getMinutes() throws DException { 367 return sessionSQL.getMinutes(); 368 } 369 370 375 376 public TimeZone getTimeZone() throws DException { 377 return sessionSQL.getTimeZone(); 378 } 379 380 389 390 public void setConstraintStatus(Object constraintName, String mode) throws DException { 391 constraintInformation.setConstraints(constraintName, mode); 392 } 393 394 400 401 public ArrayList getImmediateConstriants(QualifiedIdentifier tableName) throws DException { 402 return (ArrayList) immediateModeConstraints.get(tableName); 403 } 404 405 410 411 public TreeMap getImmediateConstriants() throws DException { 412 return immediateModeConstraints; 413 } 414 415 420 421 public void removeTable(QualifiedIdentifier tableName) throws DException { 422 Object obj = sessionTableList.remove(tableName.getIdentifier()); 423 constraintInformation.removeTable(tableName); 424 } 425 426 431 432 public java.sql.Timestamp getTimeStamp() throws DException { 433 return sessionSQL.getTimeStamp(); 434 } 435 436 441 442 public void pushAuthorizationIdentifier(AuthorizationIdentifier athrznIdntfr) throws DException { 443 sessionSQL.pushAuthorizationIdentifier(athrznIdntfr); 444 } 445 446 451 452 public Object getSessionConstant() throws DException { 453 return sessionConstant; 454 } 455 456 461 462 public SessionConditionInfo getSessionCondition() { 463 493 throw new UnsupportedOperationException (" Method not supported "); 494 } 495 496 501 502 503 507 508 public void stopConstraintChecking() throws DException { 509 constraintChecking = false; 510 } 511 512 517 518 public Object getTransactionAccessMode() throws DException { 519 return sessionSQL.getTransactionMode().getTransactionAccessMode(); 520 } 521 522 527 528 public void setAuthorizationIdentifier(String userName) throws DException { 529 AuthorizationIdentifier authorizationIdentifier = new AuthorizationIdentifier(); 530 authorizationIdentifier.setUser(userName); 531 sessionSQL.pushAuthorizationIdentifier(authorizationIdentifier); 532 } 533 534 535 public boolean getImmediateConstriantsForChecking() { 536 int status = getConstraintStatusOfCurrentSession(); 537 return status == ImmidiateConstraintChecking; 538 } 539 540 public boolean getDeferredConstriantsForChecking() { 541 int status = getConstraintStatusOfCurrentSession(); 542 return status == deferredConstraintChecking; 543 } 544 545 public void startSavePoint() throws DException { 546 Object childSessionId = sessionDatabase.getSystemFieldsValue().getNextSessionId(); 547 setSessionIdTransactionId(childSessionId, transactionId, getIsolationLevel()); 548 if (constraintCheckingStatusList != null) 549 maintainConstraintStatus(); 550 551 } 552 553 public void commitSavePoint(_StatementExecutionContext sec) throws DException { 554 checkForException(); 555 if (getDeferredConstriantsForChecking()) 556 checkConstraintsChild(sec); 557 Iterator sessionTablesIterator = getSessionTableList().values().iterator(); 558 sessionTablesIterator = getSessionTableList().values().iterator(); 559 while (sessionTablesIterator.hasNext()) { 560 _SessionTable sessionTable = (_SessionTable) sessionTablesIterator.next(); 561 sessionTable.performCommitInParent(getParentSessionId(), sec); 562 } 563 boolean childHasModifiedTheData = super.isDataModified(); releaseSession(getIsolationLevel()); 565 if (childHasModifiedTheData) 566 updateDataModifiedStatus(); 567 } 568 569 public void rollbackSavePoint(_StatementExecutionContext sec) throws DException { 570 checkForException(); 571 Iterator sessionTablesIterator = getSessionTableList().values().iterator(); 572 573 sessionTablesIterator = getSessionTableList().values().iterator(); 574 while (sessionTablesIterator.hasNext()) { 575 _SessionTable sessionTable = (_SessionTable) sessionTablesIterator.next(); 576 sessionTable.performRollBackWithChildSession(sec); 577 } 578 releaseSession(getIsolationLevel()); 579 } 580 581 public void releaseSavePoint(_StatementExecutionContext sec) throws DException { 582 commitSavePoint(sec); 583 } 584 585 public void checkConstraintsChild(_StatementExecutionContext statementExecutionContext) throws DException { 586 Iterator sessionTablesIterator = getSessionTableList().values().iterator(); 587 ArrayList tableList = new ArrayList(); 588 while (sessionTablesIterator.hasNext()) { 589 _SessionTable sessionTable = (_SessionTable) sessionTablesIterator.next(); 590 tableList.add(sessionTable); 591 } 592 arr = new ArrayList(); 593 for (int i = 0; i < tableList.size(); i++) { 594 _SessionTable sessionTable = (_SessionTable) tableList.get(i); 595 QualifiedIdentifier tableName = sessionTable.getTableName(); 596 597 _ConstraintTable constTable = ( (SessionDatabase) getSessionDatabase()).getConstraintTable(tableName); 598 if (sessionTable.isDataModified()) 599 fireSetConstraints( (SessionTable) sessionTable, constTable, statementExecutionContext); 600 601 } 602 lookForArrayListTables(statementExecutionContext); 603 } 604 605 private void lookForArrayListTables(_StatementExecutionContext sec) throws DException { 606 int sizeToLook = arr.size(); 607 while (arr.size() > 0) { 608 for (int i = 0; i < arr.size(); i++) { 609 try { 610 SessionTable sessTable = (SessionTable) arr.get(i); 611 _ConstraintTable cTable = ( (SessionDatabase) getSessionDatabase()).getConstraintTable(sessTable.getTableName()); 612 fireSetConstraints(sessTable, cTable, sec); 613 arr.remove(i); 614 i--; 615 } catch (DException e) { 616 e.printStackTrace(); 617 continue; 618 } 619 } 620 if (arr.size() >= sizeToLook) 621 throw new DException("DSE5536", (Object [])null); 622 sizeToLook = arr.size(); 623 } 624 } 625 626 public void fireSetConstraints(SessionTable sessTable, _ConstraintTable constraintTable, _StatementExecutionContext statementExecutionContext) throws DException { 627 _Iterator iterator = sessTable.getUncommitedRecordsIterator(); 628 boolean isFirst = iterator.first(); 629 if (isFirst) { 630 _Record oldRecord = iterator.getRecord(); 631 Object oldRecordRowId = oldRecord.getObject(SystemFields.rowId); 632 boolean isNext = iterator.next(); 633 if (!isNext) { 634 iterator.previous(); 635 insertOrDelete(oldRecord, statementExecutionContext, constraintTable); 636 return; 637 } 638 639 while (isNext) { 640 _Record newRecord = iterator.getRecord(); 641 int[] columnIndexes = null; 642 if (oldRecordRowId.equals(newRecord.getObject(SystemFields.rowId))) { 643 if (SystemFields.maxIntegerValue.equals(newRecord.getObject(SystemFields.invalidSessionId))) { 644 if (SystemFields.maxIntegerValue.equals(oldRecord.getObject(SystemFields.transactionId)) 645 && oldRecord.getObject(SystemFields.invalidSessionId).equals(getSessionId()) 646 && oldRecord.getObject(SystemFields.sessionId).equals(getSessionId()) 647 && newRecord.getObject(SystemFields.sessionId).equals(getSessionId())) { 648 columnIndexes = SystemFieldsCharacteristics.getUserColumnIndexes(newRecord); 649 RecordVersion recordVersion = new RecordVersion(newRecord); 650 statementExecutionContext.setRecordVersion(recordVersion); 651 constraintTable.checkInsertConstraints(getGlobalSession(), statementExecutionContext, columnIndexes); 652 } else { 653 RecordVersion recordVersion = new RecordVersion(oldRecord); 654 columnIndexes = getDifference(newRecord, oldRecord); 655 Object [] obj = getValuesOfRecordAtIndexes(columnIndexes, newRecord); 656 if (obj != null) 657 recordVersion.update(columnIndexes, obj); 658 statementExecutionContext.setRecordVersion(recordVersion); 659 constraintTable.checkUpdateConstraints(getGlobalSession(), statementExecutionContext, columnIndexes); 660 } 661 } else { 662 if (SystemFields.maxIntegerValue.equals(newRecord.getObject(SystemFields.transactionId)) 663 && newRecord.getObject(SystemFields.invalidSessionId).equals(getSessionId()) 664 && newRecord.getObject(SystemFields.sessionId).equals(getSessionId()) 665 && oldRecord.getObject(SystemFields.sessionId).equals(getSessionId())) { 666 columnIndexes = SystemFieldsCharacteristics.getUserColumnIndexes(newRecord); 667 RecordVersion recordVersion = new RecordVersion(oldRecord); 668 statementExecutionContext.setRecordVersion(recordVersion); 669 constraintTable.checkInsertConstraints(getGlobalSession(), statementExecutionContext, columnIndexes); 670 } else { 671 RecordVersion recordVersion = new RecordVersion(newRecord); 672 columnIndexes = getDifference(oldRecord, newRecord); 673 Object [] obj = getValuesOfRecordAtIndexes(columnIndexes, oldRecord); 674 if (obj != null) 675 recordVersion.update(columnIndexes, obj); 676 statementExecutionContext.setRecordVersion(recordVersion); 677 constraintTable.checkUpdateConstraints(getGlobalSession(), statementExecutionContext, columnIndexes); 678 } 679 } 680 681 if (iterator.next()) { 682 oldRecord = iterator.getRecord(); 683 oldRecordRowId = oldRecord.getObject(SystemFields.rowId); 684 isNext = iterator.next(); 685 if (!isNext) { 686 iterator.previous(); 687 insertOrDelete(oldRecord, statementExecutionContext, constraintTable); 688 } 689 } else 690 isNext = false; 691 692 } else { 693 insertOrDelete(oldRecord, statementExecutionContext, constraintTable); 694 oldRecord = newRecord; 695 oldRecordRowId = oldRecord.getObject(SystemFields.rowId); 696 isNext = iterator.next(); 697 if (!isNext) { 698 iterator.previous(); 699 insertOrDelete(oldRecord, statementExecutionContext, constraintTable); 700 } 701 } 702 } 703 } 704 } 705 706 private int[] getDifference(_Record currentRecord, _Record oldRecord) throws DException { 707 ArrayList indexes = new ArrayList(1); 708 for (int i = SystemFieldsCharacteristics.getSystemColumnCount(); i < currentRecord.getColumnCount(); i++) { 709 Object currentValue = currentRecord.getObject(i); 710 Object oldValue = oldRecord.getObject(i); 711 if (currentValue == null) 712 if (oldValue == null) 713 continue; 714 else 715 indexes.add(new Integer (i)); 716 else 717 if (!currentValue.equals(oldValue)) { 718 indexes.add(new Integer (i)); 719 } 720 } 721 int[] uncommonColumns = new int[indexes.size()]; 722 for (int i = 0; i < indexes.size(); i++) 723 uncommonColumns[i] = ( (Integer ) indexes.get(i)).intValue(); 724 return uncommonColumns; 725 726 } 727 728 private void insertOrDelete(_Record rec, _StatementExecutionContext sec, _ConstraintTable constraintTable) throws DException { 729 RecordVersion recordVersion = new RecordVersion(rec); 730 sec.setRecordVersion(recordVersion); 731 if (SystemFields.maxIntegerValue.equals(rec.getObject(SystemFields.invalidSessionId))) { 732 int[] columnIndexes = SystemFieldsCharacteristics.getUserColumnIndexes(rec); 733 constraintTable.checkInsertConstraints(getGlobalSession(), sec, columnIndexes); 734 } else 735 constraintTable.checkDeleteConstraints(getGlobalSession(), sec); 736 } 737 738 private Object [] getValuesOfRecordAtIndexes(int[] indexes, _Record rec) throws DException { 739 if (indexes != null) { 740 ArrayList arr = new ArrayList(); 741 for (int i = 0; i < indexes.length; i++) 742 arr.add(rec.getObject(indexes[i])); 743 return arr.toArray(); 744 } 745 return null; 746 } 747 748 public void ignoreParallelSavePoint() throws DException { 749 super.ignoreParallelSavePoint(getIsolationLevel()); 750 } 751 752 public void allowParallelSavePoint() throws DException { 753 super.allowParallelSavePoint(); 754 } 755 756 public ConstraintInformation getConstraintInformation() throws DException { 757 return constraintInformation; 758 } 759 760 public void setRole(String roleName) throws DException { 761 sessionSQL.setRole(roleName); 762 } 763 764 765 public _DataRetriever getDataRetriever() { 766 return dataRetriever; 767 } 768 769 public boolean prepare(_StatementExecutionContext statementExecutionContext) throws DException { 770 throw new UnsupportedOperationException (" method prepare not supported"); 771 } 772 773 public boolean makePersistent(_StatementExecutionContext statementExecutionContext) throws DException { 774 throw new UnsupportedOperationException (" method makePersistent not supported"); 775 } 776 777 public void resetTransactionDate() { 778 sessionSQL.resetTransactionDate(); 779 } 780 781 public ArrayList getSessionIdList() throws DException { 782 return sessionIdList; 783 } 784 785 public void resetTime() throws DException { 786 sessionSQL.resetTransactionDate(); 787 } 788 789 public void setAutoCommit(boolean autoCommit0) { 790 autoCommit = autoCommit0; 791 } 792 793 public boolean getAutoCommit() { 794 return autoCommit; 795 } 796 797 public void addTableInChangedTableList(QualifiedIdentifier tableName) { 798 throw new UnsupportedOperationException (" method addTableInChangedTableList not supported"); 799 } 800 801 public void startTransaction() throws DException { 802 if ((getIsolationLevel() == ReadTransactionSerializable || getIsolationLevel() == ReadRepeatable) && !isTransactionStarted) { 803 isTransactionStarted = true; 804 SystemFieldsValue systemFieldsValue = sessionDatabase.getSystemFieldsValue(); 805 setTransactionId(systemFieldsValue.getLastTransactionId(), ReadTransactionSerializable); 806 TransactionIsolationLevelHandler tih = sessionDatabase.getTransactionIsolationLevelHandler(); 807 tih.transactionStarted(sessionId, isolationLevel); 808 } 809 810 } 811 812 824 public boolean isDataModified() throws DException{ 825 for (Iterator iter = sessionTableList.keySet().iterator(); iter.hasNext(); ) { 826 if ( ( (_SessionTable) sessionTableList.get(iter.next())).isDataModified()) { 827 return true; 828 } 829 } 830 return false; 831 832 } 833 } 834 | Popular Tags |