Thread: [cx-oracle-users] 11g Continuous Qurey Notification
Brought to you by:
atuining
From: Ulherr, C. <chr...@te...> - 2011-04-01 21:14:35
|
I've noticed cx_Oracle has support for Database Change Notification (aka object change notification in 11g), but not new 11g features like Query Result Change Notification (similar, but not the same as DCN/OCN). Are there any plans to implement this in cx_Oracle? |
From: Anthony T. <ant...@gm...> - 2011-04-02 02:07:34
|
Hi, as far as I know in 11g Release 2 the same interface in cx_Oracle is only able to use query change notification. It seems impossible to use object change notification -- but perhaps I don't understand how to switch between the two. In any case, I believe if you register a query you will get what you are expecting. If not, let me know what you are hoping to do and I'll see what I can do to help. Anthony On Fri, Apr 1, 2011 at 3:16 PM, Ulherr, Chris <chr...@te...> wrote: > I've noticed cx_Oracle has support for Database Change Notification (aka > object change notification in 11g), but not new 11g features like Query > Result Change Notification (similar, but not the same as DCN/OCN). > > > > Are there any plans to implement this in cx_Oracle? > > ------------------------------------------------------------------------------ > Create and publish websites with WebMatrix > Use the most popular FREE web apps or write code yourself; > WebMatrix provides all the features you need to develop and > publish your website. http://p.sf.net/sfu/ms-webmatrix-sf > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |
From: Ulherr, C. <chr...@te...> - 2011-04-02 15:43:27
|
Hi, thanks for the feedback. Let me explain a little further the new functionality available in 11g, and how that differs from what cx_Oracle currently offers. In 10g, we have something called DCN / OCN (Database Change Notification / Object Change Notification). For the purposes of this discussion, we will consider these two terms synonymous. This is what cx_Oracle currently implements. You resister a query against an object, and then get notified when that object is modified. For example, if we had: create table t (x int); You could register queries like: select * from t select * from t where x > 10 select * from t where x < 3 For DCN, all of the above registrations produce the same result. The predicate is basically irrelevant in this case. Even if we register with "where x > 10", and then the value 1 is inserted into t, we will still get notified. In 11g, we have an enhancement to DCN whereby we can ask to be notified only if the *result set* of the query changes. This functionality is named Query Result Change Notification (QRCN). In this case, the predicates matter. If we register "select * from t where > 10", then we do not expect to get notifications if the values 1, 2 or 3 are inserted into t, but do expect to get notified if the value 15 is inserted, for example. At a deeper level, here's how it's implemented in OCI: If you look at the source code of cx_Oracle, in the file Subscription.c, you will see a lot of OCIAttrSet() calls on OCI_HTYPE_SUBSCRIPTION, like: status = OCIAttrSet(self->handle, OCI_HTYPE_SUBSCRIPTION, (dvoid*) &self->namespace, sizeof(ub4), OCI_ATTR_SUBSCR_NAMESPACE, env->errorHandle); For QRCN, there is a new attribute named OCI_ATTR_SUBSCR_CQ_QOSFLAGS that can be set in a similar manner to indicate "we would like to be notified when the result-set changes, instead of at the object level". For example, from Oracle's 11.2 documentation: checker(errhp, OCIAttrSet (subscrhp, OCI_HTYPE_SUBSCRIPTION, (dvoid *)&qosflags, sizeof(ub4), OCI_ATTR_SUBSCR_CQ_QOSFLAGS, errhp)); The qosflags would be set to OCI_SUBSCR_CQ_QOS_QUERY, and optionally or'ed with OCI_SUBSCR_CQ_QOS_BEST_EFFORT (described further in the Oracle documentation). From a Python perspective, this would likely be an added option to the existing subscribe() method (much like the current rowids = True option, you could have a qrcn = True option to specify this behavior at subscription time). I'm not sure how straightforward this would be to add to cx_Oracle. This new attribute is only available in 11g, so it would seem some conditional compilation would be necessary (i.e. if compiling against 10g OCI headers, skip this part). Hope this helps to clear things up. -----Original Message----- From: Anthony Tuininga [mailto:ant...@gm...] Sent: Friday, April 01, 2011 9:07 PM To: cx-...@li... Subject: Re: [cx-oracle-users] 11g Continuous Qurey Notification Hi, as far as I know in 11g Release 2 the same interface in cx_Oracle is only able to use query change notification. It seems impossible to use object change notification -- but perhaps I don't understand how to switch between the two. In any case, I believe if you register a query you will get what you are expecting. If not, let me know what you are hoping to do and I'll see what I can do to help. Anthony On Fri, Apr 1, 2011 at 3:16 PM, Ulherr, Chris <chr...@te...> wrote: > I've noticed cx_Oracle has support for Database Change Notification > (aka object change notification in 11g), but not new 11g features like > Query Result Change Notification (similar, but not the same as DCN/OCN). > > > > Are there any plans to implement this in cx_Oracle? > > ---------------------------------------------------------------------- > -------- Create and publish websites with WebMatrix Use the most > popular FREE web apps or write code yourself; WebMatrix provides all > the features you need to develop and publish your website. > http://p.sf.net/sfu/ms-webmatrix-sf > > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |