Re: Database Preference? -- Manuel, Michael, Miles

From: Date: Thu, 30 Aug 2001 19:04:39 +0000
Subject: Re: Database Preference? -- Manuel, Michael, Miles
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-65363@lists.php.net to get a copy of this message
Hello, James wrote: > Regarding a database abstraction package: does Metabase handle all > "standard" SQL constructs (as opposed to vendor-specific SQL extensions)? > The GUI applications to be ported were built with JAM, which basically > provides an abstraction layer via its JPL language. JPL has not been > restrictive in terms of required functionality, nor was there any real > performance hits. Can the same be said of Metabase? Also, would Metabase > present a significant learning curve for experienced C and SQL programmers? > > I will download PostgreSQL and check it out. Metabase does much more than you probably may want. Basically you can just submit any queries to the database server. Metabase doesn't touch them. What it does is when you are composing your queries with constant values, it may convert the respective data type values from a database independent data type set to the target database data types. Let's say you have strings or date constant values. Each database may have different ways to escape strings or format dates. Metabase provides functions to do that translation if you want to use direct queries. I you want to use prefered queries, with placeholders ( ? ) in the queries that are replace with constant values when the queries are executed, the functions to set those values perform the translations for you. For retrieving result data returned by SELECT queries, Metabase also provides functions to translate the data to a database independent format, so in your applications you only have to handle one universal format that you do not need to adapt if you decide to switch to your database backend. That is not all. Metabase also provides unique features, that are very important for Web programming, all in a database independent way. One is the ability to create and access to database sequence objects. Sequences are objects that can generate sequential integer unique numbers. They are often used to generate id values for table primary keys. Sequence number generation is guaranteed to be atomic, so it is adequate for environments where many users access the database concurrently, like the Web. Sequences are implemented with real sequence objects in databases that support it like Oracle and Postgres, but others that don't support real sequence objects are emulated with tables with a single auto-incremented integer field. Another important feature is the ability for Web programming is the ability to limit the range of rows that are returned from a select query, like MySQL LIMIT clause, but in a way that is supported by all databases supported by Metabase. This is great to let you develop applications that display query results split in multiple pages if they have too many rows. Metabase is not also good for develop applications to access databases. It is also able to install databases for you creating tables, fields, indexes and sequence from a database independent schema description defined in a specific XML format. Also, if later you need to change your database schema, all you need to do is change the schema description XML file. Metabase manager is able to figure the differences between the new and the previously installed schema and then it just alters the database without affecting the data that was stored after the database was installed for the first time or changed for the last time. This saves you toons of hours and maintenance headache. Metabase is easy to learn. In the site there is a tutorial document that get you started real quick. If you need further help, you may join to the Metabase development mailing list that is listed in the Metabase page links sections. Look also in the database section of the PHP Classes site for components ready to use with Metabase. Regards, Manuel Lemos

« previous php.general (#65363) next »