Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

MySQL, MS SQL, PostgreSQL - Common interface

by cosmicperl (Chaplain)
on Jun 15, 2007 at 03:14 UTC ( #621393=perlquestion: print w/ replies, xml ) Need Help??
cosmicperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,
  For some time I've been planning a perl module that makes interacting with any of the above databases much easier. Basically it would give you a common SQL syntax to use and make the necessary syntax changes for you. I though as I had planned it, there was a good chance it's already been done, although I cannot find anything in CPAN. Anyone know of a module that does it?

Comment on MySQL, MS SQL, PostgreSQL - Common interface
Re: MySQL, MS SQL, PostgreSQL - Common interface
by andreas1234567 (Vicar) on Jun 15, 2007 at 05:32 UTC
    You mean besides DBI?

    The different database engines are exactly that: different. They implement basic features, such as DATE and TIME in the SQL standard differently. See this article.

    Furthermore, for better concurrency, many database engines require the use of a database specific programming language: PL/SQL (Oracle), SQL PL (IBM DB2), even MySQL has this ability as of version 5.0. While there's some similarities within these languages, they are highly incompatible. So I would say what you are trying to do is very difficult.

    Why is database independence so important?

    --
    print map{chr}unpack(q{A3}x24,q{074117115116032097110111116104101114032080101114108032104097099107101114})
Re: MySQL, MS SQL, PostgreSQL - Common interface
by Tomte (Priest) on Jun 15, 2007 at 10:01 UTC

    Well, I'd say if you're going to abstract from SQL up, abstract the whole way to an OO-View where you don't use SQL itself anymore - but if you are determined to write such a module - which could be very useful indeed - I suggest to take a look at the SQLFairy (SQL::Translator) - they have done such a thing already - you could use SQL::Translator on-the-fly, or at least prey upon it to reuse their effort.

    regards,
    tomte


    An intellectual is someone whose mind watches itself.
    -- Albert Camus

      I'd say if you're going to abstract from SQL up, abstract the whole way to an OO-View where you don't use SQL itself anymore ...

      I could never understand why would anyone want to do that, but that's just me.

Re: MySQL, MS SQL, PostgreSQL - Common interface
by DrHyde (Prior) on Jun 15, 2007 at 10:03 UTC
    Take a look at SQL::Statement and its friends and relations. No promises cos I've not used it myself, but at least the module names look like they might be right :-)
Re: MySQL, MS SQL, PostgreSQL - Common interface
by guinex (Sexton) on Jun 15, 2007 at 11:26 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://621393]
Approved by graff
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2014-07-12 15:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls