+(defun sql-add-product (product display &rest plist)
+ "Add support for a database product in `sql-mode'.
+
+Add PRODUCT to `sql-product-alist' which enables `sql-mode' to
+properly support syntax highlighting and interactive interaction.
+DISPLAY is the name of the SQL product that will appear in the
+menu bar and in messages. PLIST initializes the product
+configuration."
+
+ ;; Don't do anything if the product is already supported
+ (if (assoc product sql-product-alist)
+ (message "Product `%s' is already defined" product)
+
+ ;; Add product to the alist
+ (add-to-list 'sql-product-alist `((,product :name ,display . ,plist)))
+ ;; Add a menu item to the SQL->Product menu
+ (easy-menu-add-item sql-mode-menu '("Product")
+ ;; Each product is represented by a radio
+ ;; button with it's display name.
+ `[,display
+ (lambda () (interactive) (sql-set-product ',product))
+ :style radio
+ :selected (eq sql-product ',product)]
+ ;; Maintain the product list in
+ ;; (case-insensitive) alphabetic order of the
+ ;; display names. Loop thru each keymap item
+ ;; looking for an item whose display name is
+ ;; after this product's name.
+ (let ((next-item)
+ (down-display (downcase display)))
+ (map-keymap (lambda (k b)
+ (when (and (not next-item)
+ (string-lessp down-display
+ (downcase (cadr b))))
+ (setq next-item k)))
+ (easy-menu-get-map sql-mode-menu '("Product")))
+ next-item))
+ product))
+
+(defun sql-del-product (product)
+ "Remove support for PRODUCT in `sql-mode'."
+
+ ;; Remove the menu item based on the display name
+ (easy-menu-remove-item sql-mode-menu '("Product") (sql-get-product-feature product :name))
+ ;; Remove the product alist item
+ (setq sql-product-alist (assq-delete-all product sql-product-alist))
+ nil)
+
+(defun sql-set-product-feature (product feature newvalue)
+ "Set FEATURE of database PRODUCT to NEWVALUE.
+
+The PRODUCT must be a symbol which identifies the database
+product. The product must have already exist on the product
+list. See `sql-add-product' to add new products. The FEATURE
+argument must be a plist keyword accepted by
+`sql-product-alist'."