A minimal implementation would consist of the following:
Tables:
Feeds
ID : int (auto incrementing)
FeedName : varchar(256)
FeedURI : varchar(256)
IsActive : boolean
Stored Procedures:
UpdateFeed - manages feed records in the database
ID : int { 0 if this is a new feed, otherwise the number of the feed to update }
FeedName : varchar(256) { name to use to label the feed },
FeedURI : varchar(256) { pointer to the RSS feed },
IsActive : boolean { false will hide the feed from searches }
PseudoSQL :
IF NOT EXISTS ( SELECT ID FROM FEEDS WHERE ID = @ID )
SET @ID = 0
IF @ID=0
INSERT INTO Feeds
(FeedName, FeedURI, IsActive)
VALUES (@FeedName, @FeedURI, True)
ELSE
UPDATE Feeds SET
FeedName = CASE WHEN ISNOTNULL(@FeedName) THEN @FeedName ELSE FeedName END,
FeedURI = CASE WHEN ISNOTNULL(@FeedURI) THEN @FeedURI ELSE FeedURI END,
IsActive = CASE WHEN ISNOTNULL(@IsActive) THEN @IsActive ELSE IsActive END
FindFeed - retrieves a set of feed records from the database
Filter : varchar(50) nullable { if not null then used as a search pattern }
PseudoSQL:
SELECT FeedName, FeedURI
FROM Feeds
WHERE
(IsActive = True) AND
((ISNOTNULL(@Filter)) AND (FeedName LIKE '%' & @Filter & '%'))
Subscribe to:
Post Comments (Atom)

3 comments:
ok, so that's a rough cut of the database from a mostly MS-SQL perspective - I haven't really used mySQL, but it should support enough of the SQL-92 standard to allow me to carry on.
I don't usually let users destroy data - there is always the risk that it was an accident and it's a pain in the neck to have to keep resoring from back-ups - instead I hide stuff - storage is generally cheaper than support.
The www.mysql.com site seems to be on the fritz, so I've had to poke around for some reference material - found a [tutorial on the way mySQL specs stored procedures.
Definitely prefer T-SQL
Post a Comment