|Think about Loose Coupling|
Differences in SQL syntax when using DBI (are there any)? And help on publishing module on CPAN.by techcode (Hermit)
|on Jul 15, 2005 at 09:57 UTC||Need Help??|
techcode has asked for the
wisdom of the Perl Monks concerning the following question:
Hello fellow monks. I have so many questions at this point and since they are related - I posted them all. Of course if you can help on just some of them - great!
For my own needs I wrote a modules that is used as some sort of Database abstraction. Sort of, as it doesn't do all the bells and whistles that SQL::Abstract and DBIx::Abstract do. But on the other hand, it's much simpler and it does a little bit more in some areas.
It can generate following SQL statements:
It was all written with MySQL in mind. But I'm now thinking to get it "in shape" and publish it on CPAN - so naturally I want it done that way so that it can be use with other RDBMS's and not just MySQL ...
So finally we got to the question : When you use DBI - are queries like insert/update/select always the same, no matter what DB you are using? And what about things like describe query which I plan to use to get primary key field name ...
Because if it's not - I have a little extra work. My plan is to make a "sub-module", say Module::MyModule is base one, and then Module::MyModule::mysql would be for mysql specific.
A suggestion of name for the module is also welcome. I was thinking of DBIx::Handy?
O and any suggestion on how to ensure that you can easily make an extension in the future. First thing that comes to my mind is that it can return results of SQL query in a form that is suited for HTML::Template LOOP as I need that often. I know that I can write something like DBIx::Handy::HtmlTemplate that would 'use base qw(DBIx::Handy);' and just add such a method - but I don't know how can I ensure that it would be possible to have several of those "plug-ins" at the same time ...THANK YOU! PS. I already have the book : "Sam Tregar - Writing Perl Modules for CPAN"