Selecting the Final Component
56 SELECT TOP 1 57 @tid = pt.tab_navigation_id 58 FROM 59 products p, 60 product_tabs pt 61 WHERE 62 p.product_id = @prodid 63 and pt.product_type_id = p.product_type_id
In a much simpler join, we select the tab navigation ID by matching our product_id to the product_tabs table. The column in common is the product_type_id, which tells us whether we're looking at a book, an article, or perhaps a piece of training content.
64 SELECT @navid = @nid2 65 SELECT @tabid = @tid 66 GO
Last but hardly least, we return the values that we have so diligently dug from the database. StateDB.java passes the navigation_id and tab_navigation_id back to State.java in the form of a string array. State.java sets public variables with these values, which are accessed by State.asp. State.asp is called at the load of every single page on the site. Given the navigation_id and tab_navigation_id, another call is made to determine the unique state_id. The state_id is used to pull the properties of that state out of the database. One of those properties is the preformatted BTB HTML. The journey we began in the first article of this serious and continued in the second article is now complete. Good thing, toowe were almost out of rations.
BTB, Nicely Wrapped
There you have it, the tangled skein of the BTB. We have managed to successfully traverse the most integral features of the InformIT site: unique products, the taxonomy, and the state. It's a credit to the initial database design that these attributes can dovetail so well to create an almost infinitely extendable, hierarchical navigation structure for InformIT. Products, product types, and navigation levels can be added at any time. State gets rebuilt in the background, and the site motors on.
I hope that this trip through the BTB and the innards of InformIT has been useful, and, perhaps, not too rushed. Now you and I can kick back, have a Scooby snack and a BoC (Beverage of Choice), and take time to smell the roses for that briefest of instants before life intrudes again.