Re: pretty(ish) pictures...

[prev] [thread] [next] [Date index for 2005/07/13]

From: stelf
Subject: Re: pretty(ish) pictures...
Date: 17:57 on 13 Jul 2005
   the thing that quite surprises me is that you just grabbed that old
mysql and produced nice code. congrats, really. reminds me of a 19yrs
girl that showed up with absolutely marvelous network traffic analyzer
which she wrote as her first real perl project (homework-exam|) for
the 'practical perl programming' course we're organizing at sofia
university.

    stelf

On 7/13/05, Caroline Johnston <johnston@xxxxxxxxxxxx.xxx.xx.xx> wrote:
> Hi again
>=20
> Thanks for the feedback.
>=20
> > On 7/13/05, Ron Savage <ron@xxxxxx.xxx.xx> wrote:
> > > On Wed, 13 Jul 2005 08:24:08 +0300, stelf wrote:
> > > Have you looked at GraphViz::DBI?
>=20
> Thanks - I'll have a look. I'm not sure this will work in my case - I've
> got an old MySQL DB and it doesn't do foreign keys (at least, I don't
> think it does?) so all my relationship info is in my CDBI classes.
>=20
> > Also thanks Caroline, that looks quite useful.. I didn't think that an
> > ascii description of schema would be useful and that has changed my
> > mind - do you mind If I use some of your C:DBI and ASCII fu in Autodia
> > (which currently generates schema from source code, sql and databases
> > into XMI, XML, HTML, Dia, Graphviz, Umbrello, etc)
>=20
> Help yourself ;)  I've been faffing about with it though. You can now cal=
l
> it as a class method to get the table description and as an object method
> to get the contents of that object. I've been using it with
> Class::DBI::Loader (example below) and it seems quite handy for debugging=
,
> if nothing else ;)
>=20
> I'll stick it on CPAN when I figure out how. In the meantime, you can
> svn checkout http://cassj.co.uk/svn/cdwp/trunk/Class-DBI-WithPictures-Asc=
ii
>=20
> I haven't tried it with anything but MySQL. Let me know if it works with
> others.
>=20
> Cheers,
>=20
> Cxx
>=20
>=20
> Class::DBI::Loader example:
>=20
> ############################
> package CDBI::Test;
>=20
> use strict;
> use warnings;
>=20
> use Class::DBI::Loader;
>=20
> my $loader  =3D Class::DBI::Loader->new(
>                                       dsn       =3D> 'dbi:mysql:test',
>                                       user      =3D> 'lpctools',
>                                       password  =3D> 'lpctools',
>                                       namespace =3D> 'Test::DBI',
>                                       additional_classes =3D>
> [qw/Class::DBI::WithPictures::Ascii/],
>                                      ) ;
> Test::DBI::Widget->has_a(thingy =3D> 'Test::DBI::Thingy');
> Test::DBI::Thingy->has_many(widgets =3D> 'Test::DBI::Widget');
>=20
> sub ascii
> {
>   foreach ($loader->classes){print $_->ascii->table}
> }
>=20
>=20
> ###############################
> then you can get all your tables, like:
>=20
>  use CDBI::Test;
>  print CDBI::Test->ascii'
> +----------+
> | thingy   |
> +----------+
> | *id      |
> | comment  |
> | notes    |
> +----------+
>=20
> +---------+
> | widget  |
> +---------+
> | *id     |
> | thingy  |-> thingy
> +---------+
>=20
> or an individual table like:
>=20
>  use CDBI::Test;
>  print Test::DBI::Widget->ascii->table;
>=20
> +---------+
> | widget  |
> +---------+
> | *id     |
> | thingy  |-> thingy
> +---------+
>=20
> or the values in  an individual object, like:
>=20
>  use CDBI::Test;
>  $obj =3D Test::DBI::Thingy->retrieve('1');
>  print $obj->ascii->table;
>=20
> +---------------------------+
> | thingy                    |
> +---------------------------+
> | *id      | 1              |
> | comment  | this is a test |
> | notes    | NULL           |
> +---------------------------+
>=20
>  (you still get the ->wherever for FKs, just this table doesn't have any)
> #########################################
>=20
>=20
>=20
>=20


--=20
    jr`

pretty(ish) pictures...
Caroline Johnston 16:40 on 12 Jul 2005

Re: pretty(ish) pictures...
stelf 05:24 on 13 Jul 2005

Re: pretty(ish) pictures...
Ron Savage 05:37 on 13 Jul 2005

Re: pretty(ish) pictures...
Aaron Trevena 13:51 on 13 Jul 2005

Re: pretty(ish) pictures...
Caroline Johnston 15:02 on 13 Jul 2005

Re: pretty(ish) pictures...
stelf 17:57 on 13 Jul 2005

Generated at 16:36 on 28 Jul 2005 by mariachi v0.52