1 24 25 package com.mckoi.database; 26 27 33 34 final class SystemQueryContext extends AbstractQueryContext { 35 36 39 private TransactionSystem system; 40 41 44 private SimpleTransaction transaction; 45 46 49 private String current_schema; 50 51 52 53 56 SystemQueryContext(SimpleTransaction transaction, 57 String current_schema) { 58 this.transaction = transaction; 59 this.system = transaction.getSystem(); 60 this.current_schema = current_schema; 61 } 62 63 67 public TransactionSystem getSystem() { 68 return system; 69 } 70 71 74 public FunctionLookup getFunctionLookup() { 75 return getSystem().getFunctionLookup(); 76 } 77 78 81 public long nextSequenceValue(String name) { 82 TableName tn = transaction.resolveToTableName(current_schema, name, 83 system.ignoreIdentifierCase()); 84 return transaction.nextSequenceValue(tn); 85 } 86 87 92 public long currentSequenceValue(String name) { 93 TableName tn = transaction.resolveToTableName(current_schema, name, 94 system.ignoreIdentifierCase()); 95 return transaction.lastSequenceValue(tn); 96 } 97 98 101 public void setSequenceValue(String name, long value) { 102 TableName tn = transaction.resolveToTableName(current_schema, name, 103 system.ignoreIdentifierCase()); 104 transaction.setSequenceValue(tn, value); 105 } 106 107 110 public long nextUniqueID(String table_name) { 111 TableName tname = TableName.resolve(current_schema, table_name); 112 return transaction.nextUniqueID(tname); 113 } 114 115 118 public String getUserName() { 119 return "@SYSTEM"; 120 } 121 122 } 123 | Popular Tags |