private TableSnapshot getTableSnapshot(Table tbl, Long writeId) throws LockException {
    TableSnapshot tableSnapshot = null;
    if ((writeId != null) && (writeId > 0)) {
      ValidWriteIdList writeIds = AcidUtils.getTableValidWriteIdListWithTxnList(
              conf, tbl.getDbName(), tbl.getTableName());
      tableSnapshot = new TableSnapshot(writeId, writeIds.writeToString());
    } else {
      // Make sure we pass in the names, so we can get the correct snapshot for rename table.
      tableSnapshot = AcidUtils.getTableSnapshot(conf, tbl, tbl.getDbName(), tbl.getTableName(),
                                                  true);
    }
    return tableSnapshot;
  }
Get the Database object for current database
@return a Database object if this database exists, null otherwise.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java