static VariableStorageDBAdapter getAdapter(DBHandle dbHandle, OpenMode openMode,
			AddressMap addrMap, TaskMonitor monitor)
			throws VersionException, IOException, CancelledException {

		if (openMode == OpenMode.CREATE) {
			return new VariableStorageDBAdapterV2(dbHandle, true);
		}

		try {
			VariableStorageDBAdapter adapter = new VariableStorageDBAdapterV2(dbHandle, false);
			return adapter;
		}
		catch (VersionException e) {
			if (!e.isUpgradable() || openMode == OpenMode.UPDATE) {
				throw e;
			}
			VariableStorageDBAdapter adapter = findReadOnlyAdapter(dbHandle, addrMap);
			if (openMode == OpenMode.UPGRADE) {
				adapter = VariableStorageDBAdapterV2.upgrade(dbHandle, adapter, monitor);
			}
			return adapter;
		}
	}
Gets a new VariableDatabaseAdapter
@param dbHandle the database handle.
@param openMode the openmode
@param addrMap the address map
@param monitor the progress monitor.
@return variable storage table adapter
@throws VersionException if the database table does not match the adapter.
@throws CancelledException if the user cancels an upgrade.
@throws IOException if a database io error occurs.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/symbol/VariableStorageDBAdapter.java