Home arrow MySQL arrow Data Management Made Easy Using Nennius: Advanced Data Handling

Data Management Made Easy Using Nennius: Advanced Data Handling

Welcome to part three of this tutorial introducing application development for the Nennius engine. In this article, we will enhance the News Manager application from part two.

TABLE OF CONTENTS:
  1. Data Management Made Easy Using Nennius: Advanced Data Handling
  2. Advanced Application Configuration
  3. Expanding Our Application Menu
  4. Creating the User Comments Component
  5. Creating Component Dependencies
  6. Component Notes
  7. Help Files
  8. File Attachments
By: Brian Vaughn
Rating: starstarstarstarstar / 6
August 03, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

This article is part three of an introduction to application development for the Nennius engine. If you have not yet read part one or two, you should do so before continuing. We will be enhancing the News Manager application (http://nennius.sourceforge.net/nennius/webapps/news/) already discussed in the previous tutorial, so you will need a copy of the source code (http://nennius.sourceforge.net/nennius/webapps/news.zip) for that application if you want to work along.

Update Database

Before we can start, we will once again need to run a few SQL queries to populate the application's database with the appropriate information. These queries simply build on top of the database created in part two:

-- create table to hold news release file attachments (images in this case)

CREATE TABLE `news_attachments` (

        `id` INT( 4 ) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT ,

        `news_id` INT( 3 ) UNSIGNED ZEROFILL NOT NULL ,

        `filename` VARCHAR( 50 ) NOT NULL ,

        PRIMARY KEY ( `id` ) ,

        INDEX ( `news_id` )

);

-- create table to hold record history (& associate to users & news tables via foreign keys)

CREATE TABLE `news_history` (

        `id` INT( 4 ) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT ,

        `news_id` INT( 3 ) UNSIGNED ZEROFILL NOT NULL ,

        `user_id` INT( 2 ) UNSIGNED ZEROFILL NOT NULL ,

        `datetime` DATETIME NOT NULL ,

        `description` TEXT NOT NULL ,

        PRIMARY KEY ( `id` ) ,

        INDEX ( `news_id` , `user_id` )

);

-- create comments table to hold user comments

CREATE TABLE `comments` (

        `id` INT( 10 ) UNSIGNED ZEROFILL NOT NULL ,

        `news_id` INT( 3 ) UNSIGNED ZEROFILL NOT NULL ,

        `datetime` DATETIME NOT NULL ,

        `name` VARCHAR( 50 ) NOT NULL ,

        `subject` VARCHAR( 100 ) NOT NULL ,

        `comment` TEXT NOT NULL ,

        PRIMARY KEY ( `id` ) ,

        INDEX ( `news_id` )

);

-- create notes table for moderators store private messages regarding user comments in

CREATE TABLE `comment_notes` (

        `id` int(4) unsigned zerofill NOT NULL auto_increment,

        `news_id` int(3) unsigned zerofill NOT NULL default '000',

        `user_id` int(2) unsigned zerofill NOT NULL default '00',

        `datetime` datetime NOT NULL default '0000-00-0000:00:00',

        `description` text NOT NULL,

        PRIMARY KEY  (`id`),

        KEY `news_id` (`news_id`,`user_id`)

);

-- insert addition user record with threshold of USER for later use

INSERT INTO `users` ( `id` , `username` , `password` , `name` , `email` , `threshold_id` )

        VALUES ( '', 'user', 'user', '', 'user@corporatewebsite.com', '03' );

As you can see, we've created several additional SQL tables (which will be explained later in the article) as well as an additional user record; nothing too complex. Now we're ready to start modifying our application.



 
 
>>> More MySQL Articles          >>> More By Brian Vaughn
 

blog comments powered by Disqus
   

MYSQL ARTICLES

- Xeround Releases Free Version of MySQL Cloud...
- Oracle Announces New MySQL Specialization
- Constant Contact Chooses SkySQL for MySQL Su...
- Revoke Statement in MySQL
- The Grant Statement in MySQL
- SuccessBricks Announces ClearDB Availability...
- Building a PHP ORM: Deploying a Blog
- TROSYS Launches Free MySQL Manager and Admin...
- Building an ORM in PHP: Domain Modeling
- Building an ORM in PHP
- MySQL Leads Open Source Market, Gets Cluster...
- Oracle Announces Milestone Release for MySQL
- How to Stop SQL Injection Attacks
- New Defragmentation Solution for SQL Server
- Comparison of MyISAM and InnoDB MySQL Databa...


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap

Dev Shed Tutorial Topics: