P-dd

P-dd is a PHP library for creating dynamic relational database documentation, in a number of forms, for an arbitrary database.

Tuesday, March 27, 2007

[p-dd commit] r77 - in trunk: . Classes Tests

Author: bobalicious.bob
Date: Tue Mar 27 14:19:35 2007
New Revision: 77

Added:
trunk/Tests/Test_Filter_Not.php
Modified:
trunk/Classes/FileHandler.php
trunk/TestSuite.php
trunk/Tests/Test_Filter_And.php
trunk/Tests/Test_Filter_Or.php

Log:
Finished tests for the filter gates
Generate the list of tests in the test suite

Saturday, March 24, 2007

[p-dd commit] r76 - in trunk: . Classes/Datasources/Filters Tests

Author: bobalicious.bob
Date: Sat Mar 24 11:34:55 2007
New Revision: 76

Added:
trunk/Tests/Test_Filter_And.php
trunk/Tests/Test_Filter_Or.php
trunk/Tests/Test_Filter_TableEndsWith.php
trunk/Tests/Test_Filter_TableStartsWith.php
Modified:
trunk/Classes/Datasources/Filters/Filter_TableEndsWith.php
trunk/Classes/Datasources/Filters/Filter_TableStartsWith.php
trunk/TestSuite.php

Log:
Added tests for some of the Filters / Gates
(Really it's just a way of learning the Mock Object usage properly... ;-) )

Sunday, January 28, 2007

[p-dd commit] r75 - in trunk: . Classes/Xml Tests

Author: bobalicious.bob
Date: Sun Jan 28 10:46:30 2007
New Revision: 75

Added:
trunk/Tests/Test_XmlDocument.php
trunk/Tests/Test_XmlParser.php
Modified:
trunk/Classes/Xml/XmlElement.php
trunk/Classes/Xml/XmlParser.php
trunk/TestSuite.php
trunk/Tests/Test_XmlElement.php

Log:
Completed unit test for XmlElement, and added unit tests for XmlDocument and XmlParser

[p-dd commit] r74 - in trunk: . Classes/Xml Tests

Author: bobalicious.bob
Date: Sun Jan 28 06:08:20 2007
New Revision: 74

Added:
trunk/Tests/Test_XmlElement.php
Modified:
trunk/Classes/Xml/XmlElement.php
trunk/TestSuite.php

Log:
Started to produce unit test for XmlElement

Friday, January 05, 2007

P-dd 0.1.1 released

Version 0.1.1 of P-dd has been released.

This version contains a minor bug fix to remove a 'Runtime call by reference' notice.

More importantly it marks the dawning of the 'download' entry on Google code for the source-code :-)

You can download this version here: P-dd 0.1.1

Technorati Tags: , , , , , , , , , , , , ,

Labels:

Simple ER Diagram Example

Being able to simply create an ER diagram is one of the main reasons I had for starting this project, and with that in mind I figure I should show just how simple it is to do so.

In order to run this you would need to have Graphviz's Neato installed on the web server... though once that's done, this is the sum total of the code you need to use the TestDatasource and produce a full ER diagram like that shown below:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>P-dd: A simple example outputting the default DOT generated diagram using the TestDatasource</title>
</head>
<body>
<?php

require_once( 'include_package.php' );

include_package( 'Datasources' );
include_package( 'DatabaseModel' );
include_package( 'Renderers', true );

$oFactory = new DatabaseFactory( new TestDatasource() );
$oDatabase = $oFactory->ConstructDatabase();

$oImageGenerator = new DotImageGenerator( DotDatabaseRenderer::Render( new DotRendererConfiguration(), $oDatabase ) );
$oImageGenerator->GenerateImageFile( 'Gif', 'ExampleImage.gif' );

echo( HtmlTag::Image( 'ExampleImage.gif', 'Dot generated diagram (using NEATO)') );

?>
</body>
</html>


ExampleImage

Technorati Tags: , , , , , , , , , , , , ,

Labels:

Viewer Screenshot

Whilst the primary purpose of the project is to create a library, rather than an application, there is an application in the P-dd source code.

P-dd Viewer Example screenshot

Able to connect to an Oracle database and produce an interface for navigating through the schema, it should be seen as an example of how easy it is to create applications using the library.

The app consists of a single HTML / CSS / PHP file of around 300 lines (including comments).


Technorati Tags: , , , , , , , , , , , , ,

Labels:

Sunday, December 31, 2006

P-dd 0.1 finally released

Hi all,

Welcome to the world of P-dd - The PHP Database Documentor.

So what is it?

Put simply, it's a library of PHP classes that allow for the easy generation of documentation from a set of database sources.

Put even more simply, it's yet another open source project...

What is the project aim?

  • To make it easy to dynamically create documentation on the structure of relational database based systems regardless of the number of, flavour and capabilities of those systems or the type of documentation required


How does the architecture of the library allow for that?

The library is split into three main components:

  • The Datasources

  • The Database model

  • The Renderers



The Datasources are those components concerned with the collection of raw data from the actual datasources. For example, and OracleDatasource class exists that is aware of how to interrogate an Oracle database for its structure. An XmlDatasource exists that can interpret an XML document that contains a relational database specification. All datasources conform to the same interface (currently described by the TestDatasource) making them interchangeable.

The Database Model is a class based representation of the Table / Column / Key structures that are ubiquitous within the relational database model. A factory exists that can take any of the datasources and produce a complete database model.

The Renderers are capable of taking a formed Database Model and rendering it in that renderer's chosen form.

The structure is such that it is easy to add new datasources, as long as they support the minimum structure required of the model. It is also simple to produce new renderers, as they require only knowledge of the generic database model, and no knowledge of the sources themselves.

So what's available in this version?


  • A database model that consists of:

    • Tables

    • Columns

    • Primary Keys

    • Foreign Keys



  • The database model can be created from the following sources:

    • Oracle

    • XML File



  • The model can be rendered into the following formats:




There are also lots of other little goodies in there such as datasource independant filters, a datasource caching system that limits the round trips to the database and a plethora of examples showing how components can be used as well as a simple Oracle database viewer application to show off what can be possible with just a small amount of work.

And what's the plan for the future

The idea is that, over time, database sources will be added that will allow for the collection of meta-data from all the major database players (Oracle / MySql / Postgres / etc) and produce documentation in most of the popular forms (HTML / XML / RTF / PDF / etc) including ER diagrams.

It is also recognised that in the future it is desirable to take the library into a more analysis role. For example - inferring foreign keys that are not explicitly stated, either by examining the table structures or the data within those tables. Though that is very much a longer term plan.

OK, so where is it?

The source code can be found on Google Code here: http://code.google.com/p/p-dd/ the current release tag being P-dd-0-1-0
More information of the plans for the project can be found on Backpack here: http://bobalicious.backpackit.com/page/800325

So what now?
Well, I hope that some of you people will pick it up and start providing feedback... please do so. But regardless, this remains a little bit of a vanity project anyway so I'm going to keep going with it and see where it takes me even if no-one uses it. Isn't that the life of most open source projects anyway ;-)


Technorati Tags: , , , , , , , , , , , , ,

Labels: ,