Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Monday, March 19, 2012

Details of SubscriptionClass Class

I just have a question around the SubscriptionClass class. I'm not grasping why there would be multiple rules for a single SubscriptionClass. Can someone give me a good use case for it? It seems to me that since the primary use of Rules are to generate Notifications from Subscriptions. The only reason I can see then is if we used multiple Rules to generate different Notifications. However, then I would assume the Subscription class to be associated with the Subscriber and Notification, not the Subscriber and SubscriptionClass.

A much-related question is: Why is the SubscriptionEventRules (and the SubscriptionConditionEventRules, etc.) a collection? While maybe I could understand being able to choose from a SubscriptionEventRule and a SubscriptionConditionEventRule, I don't understand the multiple SubscriptionEventRules. (And even in the other case, the Subscription doesn't seem to specify a particular rule association).

One final thought is the possibility that the design is for the Subscriber to subscribe to a particular SubscriptionClass and receive all Notifications associated with the SubscriptionClass. Is that the case? If anyone could clarify this for me, it'd be much appreciated.

-Francis

Note that I did see the RuleName property of the Subscription class, but in the SDK it says it's for rules with condition actions.

Saturday, February 25, 2012

Designing a generic database API

Hi,

My current project requires me to convert a mysql based software to a more generic one. I started by designing separate db class files and separated the lower level connection queries from the business logic. By doing this, I now have mssql.class, mysql.class, sqllite.class etc..

But am not sure how to handle sql functions in queries. For instance, one of my queries need the use of a date function to add minutes to a db field.

In mysql, I accomplish this using

dbfield+interval '$arg' minute between date1 and date1

But in mssql I cannot use this type of query. It seems I'll have to use date_add() function. How do I handle this situation?

My frontend scripting language is php

Thanks d'advance
CeliaI would create a function in your PHP code that takes two arguments, a "date" and an "adder" to the date. That way you can "cook" them as needed for each database engine, while keeping the PHP quite generic.

-PatP