Database Reference
In-Depth Information
the same way as in p_get_class_conns , you can see that we handle m_connections as a BLOB by reference
to v_app_conn_registry.connections%TYPE .
Listing 10-36. Procedure to Set Values in Application Registry, p_set_class_conns
PROCEDURE p_set_class_conns(
m_class_name v_app_conn_registry.class_name%TYPE,
m_class_version v_app_conn_registry.class_version%TYPE,
m_class_instance v_app_conn_registry.class_instance%TYPE,
m_connections v_app_conn_registry.connections%TYPE )
IS
v_count INTEGER;
BEGIN
SELECT COUNT(*) INTO v_count
FROM v_app_conn_registry
WHERE class_name = m_class_name
AND class_version = m_class_version;
IF v_count = 0 THEN
INSERT INTO v_app_conn_registry ( class_name, class_version,
class_instance, connections ) VALUES
( m_class_name, m_class_version, m_class_instance, m_connections );
ELSE
UPDATE v_app_conn_registry SET class_instance = m_class_instance,
connections = m_connections, update_dt = SYSDATE
WHERE class_name = m_class_name
AND class_version = m_class_version;
END IF;
END p_set_class_conns;
Oracle Procedures to Get Entries from the Application Registry
We will look briefly at the Oracle stored procedures we use for getting data from v_app_conn_registry .
There are no surprises here. We have established these procedures so that we do not need to have any
dynamic SQL queries in our Java code.
Find if a Registry Entry Exists for this Application
p_count_class_conns returns an integer number that indicates how many records exist in
v_app_conn_registry with this specific class name and version number. Because records in that view are
keyed on those two columns, we expected the count to only be 0 or 1. The code is in Listing 10-37.
In review, we use this to determine whether we need to check the identity of a class provided by the
client against a registered class, or whether we can simply insert this as a new class. We don't have any
prejudice against new applications being registered, if the application class meets our standards.
 
Search WWH ::




Custom Search