OCILIB (C and C++ Driver for Oracle)
4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
|
OcilibCApiAdvancedQueuing
OCILIB supports Oracle 10gR2 feature Database Change Notifications (DCN) also named Continuous Query Notifications (CQN)
This features allows a client application to register notifications when some changes are made in a database :
This feature can be really useful in applications that hold a cache of data. Instead of refreshing data periodically by connecting to the server, the application could only refresh modified data when necessary or perform specific tasks depending on the events. It saves application time, network traffic and can help the design of the application logic.
The database status change notification is also interesting to be informed of instance startup / shutdown
Check Oracle documentation for more details about this feature
The client application can be notified of any database status change (single DB or multiple DB in a RAC environment).
The notifications of object changes are based on the registration of a query ('select' SQL statement).
Oracle server will notify of any changes of any object that is part of the statement result set.
Registering a statement will notify about any changes on its result set rows performed after the registration of the query.
The query can be a simple 'select * from table' or a complex query involving many tables and/or criteria in the where clause.
For Object changes, the notification can be at :
Functions | |
OCI_SYM_PUBLIC OCI_Subscription *OCI_API | OCI_SubscriptionRegister (OCI_Connection *con, const otext *name, unsigned int type, POCI_NOTIFY handler, unsigned int port, unsigned int timeout) |
Register a notification against the given database. | |
OCI_SYM_PUBLIC boolean OCI_API | OCI_SubscriptionUnregister (OCI_Subscription *sub) |
Unregister a previously registered notification. | |
OCI_SYM_PUBLIC boolean OCI_API | OCI_SubscriptionAddStatement (OCI_Subscription *sub, OCI_Statement *stmt) |
Add a statement to the notification to monitor. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_SubscriptionGetName (OCI_Subscription *sub) |
Return the name of the given registered subscription. | |
OCI_SYM_PUBLIC unsigned int OCI_API | OCI_SubscriptionGetPort (OCI_Subscription *sub) |
Return the port used by the notification. | |
OCI_SYM_PUBLIC unsigned int OCI_API | OCI_SubscriptionGetTimeout (OCI_Subscription *sub) |
Return the timeout of the given registered subscription. | |
OCI_SYM_PUBLIC OCI_Connection *OCI_API | OCI_SubscriptionGetConnection (OCI_Subscription *sub) |
Return the connection handle associated with a subscription handle. | |
OCI_SYM_PUBLIC unsigned int OCI_API | OCI_EventGetType (OCI_Event *event) |
Return the type of event reported by a notification. | |
OCI_SYM_PUBLIC unsigned int OCI_API | OCI_EventGetOperation (OCI_Event *event) |
Return the type of operation reported by a notification. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_EventGetDatabase (OCI_Event *event) |
Return the name of the database that generated the event. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_EventGetObject (OCI_Event *event) |
Return the name of the object that generated the event. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_EventGetRowid (OCI_Event *event) |
Return the rowid of the altered database object row. | |
OCI_SYM_PUBLIC OCI_Subscription *OCI_API | OCI_EventGetSubscription (OCI_Event *event) |
Return the subscription handle that generated this event. | |
OCI_SYM_PUBLIC OCI_Subscription *OCI_API OCI_SubscriptionRegister | ( | OCI_Connection * | con, |
const otext * | name, | ||
unsigned int | type, | ||
POCI_NOTIFY | handler, | ||
unsigned int | port, | ||
unsigned int | timeout | ||
) |
#include <api.h>
Register a notification against the given database.
con | - Connection handle |
name | - Notification name |
type | - Subscription type |
handler | - User handler callback |
port | - Port to use for notifications |
timeout | - notification timeout |
@
Referenced by ocilib::Subscription::Register().
OCI_SYM_PUBLIC boolean OCI_API OCI_SubscriptionUnregister | ( | OCI_Subscription * | sub | ) |
#include <api.h>
Unregister a previously registered notification.
sub | - Subscription handle |
OCI_SYM_PUBLIC boolean OCI_API OCI_SubscriptionAddStatement | ( | OCI_Subscription * | sub, |
OCI_Statement * | stmt | ||
) |
#include <api.h>
Add a statement to the notification to monitor.
sub | - Subscription handle |
stmt | - Statement handle |
Referenced by ocilib::Subscription::Watch().
OCI_SYM_PUBLIC const otext *OCI_API OCI_SubscriptionGetName | ( | OCI_Subscription * | sub | ) |
#include <api.h>
Return the name of the given registered subscription.
sub | - Subscription handle |
Referenced by ocilib::Subscription::GetName().
OCI_SYM_PUBLIC unsigned int OCI_API OCI_SubscriptionGetPort | ( | OCI_Subscription * | sub | ) |
#include <api.h>
Return the port used by the notification.
sub | - Subscription handle |
Referenced by ocilib::Subscription::GetPort().
OCI_SYM_PUBLIC unsigned int OCI_API OCI_SubscriptionGetTimeout | ( | OCI_Subscription * | sub | ) |
#include <api.h>
Return the timeout of the given registered subscription.
sub | - Subscription handle |
Referenced by ocilib::Subscription::GetTimeout().
OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_SubscriptionGetConnection | ( | OCI_Subscription * | sub | ) |
#include <api.h>
Return the connection handle associated with a subscription handle.
sub | - Subscription handle |
Referenced by ocilib::Subscription::GetConnection().
OCI_SYM_PUBLIC unsigned int OCI_API OCI_EventGetType | ( | OCI_Event * | event | ) |
#include <api.h>
Return the type of event reported by a notification.
event | - Event handle |
Referenced by ocilib::Event::GetType().
OCI_SYM_PUBLIC unsigned int OCI_API OCI_EventGetOperation | ( | OCI_Event * | event | ) |
#include <api.h>
Return the type of operation reported by a notification.
event | - Event handle |
Referenced by ocilib::Event::GetObjectEvent().
OCI_SYM_PUBLIC const otext *OCI_API OCI_EventGetDatabase | ( | OCI_Event * | event | ) |
#include <api.h>
Return the name of the database that generated the event.
event | - Event handle |
Referenced by ocilib::Event::GetDatabaseName().
OCI_SYM_PUBLIC const otext *OCI_API OCI_EventGetObject | ( | OCI_Event * | event | ) |
#include <api.h>
Return the name of the object that generated the event.
event | - Event handle |
Referenced by ocilib::Event::GetObjectName().
OCI_SYM_PUBLIC const otext *OCI_API OCI_EventGetRowid | ( | OCI_Event * | event | ) |
#include <api.h>
Return the rowid of the altered database object row.
event | - Event handle |
Referenced by ocilib::Event::GetRowID().
OCI_SYM_PUBLIC OCI_Subscription *OCI_API OCI_EventGetSubscription | ( | OCI_Event * | event | ) |
#include <api.h>
Return the subscription handle that generated this event.
event | - Event handle |
Referenced by ocilib::Event::GetSubscription().