Re: Connecting website with SQL-database.....

From: "Manuel Lemos" <mlemos(at)acm(dot)org>
To: "Thomas Good" <tomg(at)admin(dot)nrnet(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Connecting website with SQL-database.....
Date: 2000-04-18 17:39:54
Message-ID: 3758.143T2716T9396025mlemos@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces pgsql-sql

Hello Thomas,

On 18-Apr-00 09:42:25, you wrote:

>> For a good discussion of some of the alternatives (centered around but
>> not limited to AOLserver) you can visit photo.net/wtr/, the Web/db
>> bulletin board.
>>
>> Not that I recommend anything in particular for your specific situation,
>> but it's always a good idea to get an idea of what's out there.

>I use Perl DBI::DBD with the "singing, dancing" CGI module. I'm happy with
>it. If you'd like, visit my site: www.opensystems.org and the links will
>assist you in downloading the various perl modules. There are samples there
>too.
>(DBI and CGI).

I may be mistaken, but the last time that I looked at Perl DBI, it didn't
seem to a complete database abstraction layer than it is needed. For
instance, you want retrieve data from date fields the results come
formatted in a database dependent way. This means that your DBI
applications can't really be that much database independent as you still
have to handle datatype differences in the application code.

With this Metabase package in PHP date fields are always returned formatted
in the industry standard ISO 3166 (YYYY-MM-DD HH:MI:SS). Then you do
whatever processing you want with dates formatted this way, but it's always
DBMS independent.

Another thing that seems to be lacking in DBI and other database abstraction
layers is support for DBMS independent schema installation. I mean if you
want to install a given database schema (tables, fields, indexes,
sequences) you still have to hand code database dependent SQL commands to
create them.

As I explained before, with this Metabase PHP package you only need to
describe the database schema in a custom XML format that looks like this:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>

<name>test</name>
<create>1</create>

<table>
<name>users</name>
<declaration>
<field> <name>user_id</name> <type>integer</type> <default>0</default> <notnull>1</notnull> </field>
<field> <name>user_name</name> <type>text</type> </field>
<field> <name>password</name> <type>text</type> </field>
<field> <name>reminder</name> <type>text</type> </field>
<field> <name>name</name> <type>text</type> </field>
<field> <name>email</name> <type>text</type> </field>
<index>
<name>users_id_index</name>
<unique>1</unique>
<field> <name>user_id</name> </field>
</index>
</declaration>
</table>

<sequence>
<name>user_id</name>
<start>1</start>
<on> <table>users</table> <field>user_id</field> </on>
</sequence>

</database>

Metabase will install this schema description on any SQL based database.
Furthermore, if you change the schema later you may tell Metabase to apply
the changes without affected any data that was added to the database
afterwards.

There are other neat features like support for requesting just a range of
rows of a SELECT query. In some DBMS it would be as simple as specifying
the LIMIT clause, but it is not that simple in many others. Metabase
abstracts all that for you because those are desirable features that all
database abstraction layers should provide.

As I mentioned before, you may find more information about it here:

http://phpclasses.UpperDesign.com/browse.html/package/20

Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?user=mlemos(at)acm(dot)org
--
E-mail: mlemos(at)acm(dot)org
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Rousse 2000-04-18 17:46:48 Re: psql & java
Previous Message Lamar Owen 2000-04-18 17:33:04 Re: [HACKERS] Struggles with RC1 and RPMS

Browse pgsql-interfaces by date

  From Date Subject
Next Message Guillaume Rousse 2000-04-18 17:46:48 Re: psql & java
Previous Message Peter Mount 2000-04-18 17:18:49 Re: psql & java

Browse pgsql-sql by date

  From Date Subject
Next Message Guillaume Rousse 2000-04-18 17:46:48 Re: psql & java
Previous Message Peter Mount 2000-04-18 17:18:49 Re: psql & java