Chapter 7. SQL Remote Design for AdaptiveSer verAnywhere
Thefollowing is a single-article publication sending relevant order
informationto Samuel Singer, a sales rep:
CREATE PUBLICATION pub_orders_samuel_singer (
TABLE sales_order WHERE sales_rep = 856
)
Formore information, see the “CREATE PUBLICATION statement”
[ASASQL Reference, page 385].
SUBSCRIBEBY
The create publication statement also allows a SUBSCRIBE BY clause.
This clause can also be used to selectively publish rowsin SQL Remote.
However,it is ignored during MobiLink synchronization.
Publishing only some rows using a subscription expression
Youcan specify a subscription expression to include a different set of rows
indifferent subscriptions to publications containing the article.
Forexample, in a mobile workforce situation, a sales publication may be
wantedwhere each sales rep subscribes to their own sales orders, enabling
themto update their sales orders locally and replicate the sales to the
consolidateddatabase.
Usingthe WHERE clause model, a separate publication for each sales rep
wouldbe needed: thefollowing publication is for sales rep Samuel Singer:
eachof the other sales reps would need a similar publication.
CREATE PUBLICATION pub_orders_samuel_singer (
TABLE sales_order
WHERE sales_rep = 856
)
Toaddress the needs of setups requiring large numbers of different
subscriptions,SQL Remote allowsa subscription expression to be
associatedwith an article. Subscriptionsreceive rows depending on the
valueof a supplied expression.
Benefitsof subscr iption
expressions Publicationsusing a subscription expression are more compact, easier to
understand,and provide better performance than maintaining several
WHEREclause publications. Thedatabase server must add information to
thetransaction log, and scan the transaction log to send messages, in direct
proportionto the number of publications. Thesubscription expression
allowsmany different subscriptions to be associated with a single
publication,whereas the WHERE clause does not.
97