[Phpwm] Database Diagram from SQL definition

Peter Graham Peter.Graham at tcat.ac.uk
Tue Mar 7 14:15:45 GMT 2006


You could use an ODBC driver to connect to the database using MS Access
and produce some sort of diagram within access.
 
I have not used access to create DB diagrams before but am presuming it
has some form of inbuilt GUI facility.
 
Pete

________________________________

From: phpwm-bounces at mailman.lug.org.uk
[mailto:phpwm-bounces at mailman.lug.org.uk] On Behalf Of Ian Munday
Sent: 07 March 2006 12:35
To: phpwm at mailman.lug.org.uk
Subject: [Phpwm] Database Diagram from SQL definition


I apologise for being slightly off topic, but I need to produce a
database diagram (of a type suitable to present to a client) from a
manually written SQL definition file of the following format: 

----------

CREATE TABLE tbl_Divisions (
  ID int(11) NOT NULL auto_increment,
  Name varchar(100) NOT NULL default '',
  ...
  PRIMARY KEY  (ID),
  UNIQUE KEY Name (Name)
) TYPE=InnoDB;

CREATE TABLE tbl_Departments (
  ID int(11) NOT NULL auto_increment,
  DivisionID int(11) NOT NULL default '0',
  Name varchar(100) NOT NULL default '',
  ...
  PRIMARY KEY  (ID),
  UNIQUE KEY DivisionID (DivisionID,Name),
  KEY IX_tbl_Departments_DivisionID (DivisionID),
  CONSTRAINT `tbl_Departments__ibfk1` FOREIGN KEY (`DivisionID`)
REFERENCES `tbl_Divisions` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
) TYPE=InnoDB;

...


---------- 

Ideally it would be of the form that you would see in SQL Server.

I thought of writing a quick script in PHP to parse table definitions
and display them in formatted tables on a web page, but I can't believe
I wouldn't be reinventing the wheel.

Anybody needed to do this in the past?

Many thanks,

Ian

####################################################################################################
This email is confidential and intended solely for the use of the individual to whom it is addressed.
Any views or opinions presented are solely those of the author and do not necessarily represent those 
of Telford College of Arts & Technology.
If you are not the intended recipient, be advised that you have received this email in error and that
any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited.

If you have received this email in error please notify the Telford 
College of Arts & Technology I.T. Helpdesk by telephone on 44 (0)1952 
642284.

Any files attached to this e-mail will have been checked with virus 
software before transmission.  However, you should carry out your own 
virus check before opening any attachment.  Telford College of Arts & 
Technology accepts no liability for any loss or damage, which may be caused by software
viruses.
####################################################################################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/phpwm/attachments/20060307/3d9b90ef/attachment-0001.html


More information about the Phpwm mailing list