Re: [siesta-dev] prefixing tablenames?

[prev] [thread] [next] [lurker] [Date index for 2004/10/15]

From: Darren Chamberlain
Subject: Re: [siesta-dev] prefixing tablenames?
Date: 16:24 on 15 Oct 2004
--i7F3eY7HS/tUJxUd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Bowen Dwelle <bowen at dwelle.org> [2004/10/15 08:19]:
> Simon -- thanks for the pointers. I could certainly hack up Siesta with=
=20
> $prefix -- and I may, in the short run, but doing it via Class::DBI=20
> sounds like the right way. Unfortunately, that's _way_ beyond my level=20
> of expertise.

You might be able to do it like so:

  package My::Class::DBI;

  use base 'Class::DBI';
  My::Class::DBI->set_db(...);

  use constant TABLE_PREFIX =3D> 'my_';

  sub table {
      my ($class, $table_name)  =3D @_;
      __PACKAGE__->SUPER::table(TABLE_PREFIX . $table_name);
  }

And then in the subclasses:

  package My::Class::DBI::Foo;

  use base 'My::Class::DBI';
  My::Class::DBI::Foo->table('foo');
 =20
I haven't tested this or anything, of course, just brainstorming.

(darren)

--=20
Distrust any endeavor requiring an alarm clock.

--i7F3eY7HS/tUJxUd
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBb+u0zsinjrVhZaoRAo7WAJ9EQoJllbpasAOb602g8QHwqOZHIQCfVjth
PsDX9hxU9lftFWBTHciQsP8=
=aSBF
-----END PGP SIGNATURE-----

--i7F3eY7HS/tUJxUd--

Generated at 14:00 on 11 Nov 2004 by mariachi 0.52