Re: [PHP-DB] Which Database Abstraction Layer ?

2004-09-03 Thread Lester Caine
Hans Lellelid wrote:
You definitely should do your own benchmarks.  Bear in mind that the 
ADOdb benchmarks test a certain type of behavior -- namely repeated 
select statements.  Also bear in mind that the speeds of the different 
layers are going to be inversely proportional to how well they actually 
/abstract/ stuff.  For example, ADOdb would completely fail to be 
portable accross databases where the case of the column names in result 
array changes (e.g. postgres always returns lowercase col names, Oracle 
always uppercase, MySQL returns mixed case, SQLite is configurable). 
This is one example of why some layers (like PEAR::[M]DB) may be slower.
So you start with ADOdb datadict and build the database from that - 
works well when adding any supported engine. Reserved words which differ 
between engines are another problem area though.

Database abstraction is a really tricky thing.  None of these layers 
provide 100% abstraction; that can only really be achieved with a 
DAO/object persistence layer (e.g. see DB_DataObject in PEAR, or Propel 
http://propel.phpdb.org).
Usual problem is adjusting non-standard MySQL SQL back to SQL99 or 2003, 
but each engine has it's own 'style' :)

I would also suggest you also add Creole (http://creole.phpdb.org) to 
your test list if you are considering abstraction layers for PHP5.
Doesn't do Firebird yet ;) - but it looks interesting. As long as it has 
not made the mistake of using MySQL as the SQL standard. Many other 
packages are simply MySQL wrappers with cobbled support for a couple of 
other engines.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: Newbie Questions

2004-09-03 Thread Pete Holsberg
On Thu, 2 Sep 2004, Torsten Roehr wrote:

  I think I need just a little push in the right
  direction. After I send the above SELECT command, how
  do I get the result to appear on a web page?
 
 mysql_query() will return a result set. There are
 different functions to extract the rows from it. I would
 recommend mysql_fetch_assoc() - it returns an associative
 array of the current row/record set where the field names
 of your table become the keys of the array. So if you
 select firstname, lastname you will get an array like
 this:
 
 array('firstname' = 'My firstname', 'lastname' = 'My lastname')
 
 Just loop through your result set to output/process the data. Try this:
 
 $result = mysql_query('SELECT firstname, lastname FROM table');
 
 while ($row = mysql_fetch_assoc($result)) {
 
 echo $row['firstname'] . ' ' . $row['lastname'];
 }
 

I want to display the sorted database. Which makes more
sense: sorting the database table itself (either by address
or by name), or sorting the array?

Thanks.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Re: Newbie Questions

2004-09-03 Thread Hutchins, Richard
Coming in late on this topic, but...

Database.

SELECT firstname, lastname, address FROM TABLENAME ORDER BY lastname ASC;

Use ASC or DESC to order your query results. When you iterate over the
result as Torsten indicated, everything will be in the order you specify.
Check out the MySQL docs for all the information you'll ever need on sorting
and/or grouping results from a query.

Rich



 -Original Message-
 From: Pete Holsberg [mailto:[EMAIL PROTECTED]
 Sent: Friday, September 03, 2004 11:59 AM
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Re: Newbie Questions
 
 
 On Thu, 2 Sep 2004, Torsten Roehr wrote:
 
   I think I need just a little push in the right
   direction. After I send the above SELECT command, how
   do I get the result to appear on a web page?
  
  mysql_query() will return a result set. There are
  different functions to extract the rows from it. I would
  recommend mysql_fetch_assoc() - it returns an associative
  array of the current row/record set where the field names
  of your table become the keys of the array. So if you
  select firstname, lastname you will get an array like
  this:
  
  array('firstname' = 'My firstname', 'lastname' = 'My lastname')
  
  Just loop through your result set to output/process the 
 data. Try this:
  
  $result = mysql_query('SELECT firstname, lastname FROM table');
  
  while ($row = mysql_fetch_assoc($result)) {
  
  echo $row['firstname'] . ' ' . $row['lastname'];
  }
  
 
 I want to display the sorted database. Which makes more
 sense: sorting the database table itself (either by address
 or by name), or sorting the array?
 
 Thanks.
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Which Database Abstraction Layer ?

2004-09-03 Thread Lester Caine
Jeffrey Moss wrote:
Doesn't do Firebird yet ;) - but it looks interesting. As long as it has
not made the mistake of using MySQL as the SQL standard. Many other
packages are simply MySQL wrappers with cobbled support for a couple of
other engines.
I was curious about Firebird as I've heard it mentioned a lot lately.
What's so great about it in your opinion, in comparison to MySQL and
Postgress? (currently I use both of these)
Firebird is the open source version of Interbase, which is itself 20 
years old this week.
Firebird has had triggers, stored procedures, User defined functions, 
events, and runs on a large number of OS's for many years.
Current 'records' for database size exceed 200Gb and there are many 
systems running with over 10Gb databases in real time.
Firebird should be compared to Oracle rather than MySQL and to a lesser 
extent PostgreSQL. Both of the later are some way off providing all of 
the currently available Firebird facilities. And all of those facilities 
are licence free in Firebird - no looking over you shoulder at MySQL 
licences ( not sure about PostgreSQL -  it would not run on Windows when 
I last looked at it ;) )
Firebird installs and runs 24/7 without DBA's or manual intervention.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] An old question...

2004-09-03 Thread Lic. Daniel Alfredo Betancourt Reboso
Hi everyone!!

Certainly it is an old question. How can I start learning PHP?. I need to use it
with MySQL. Any suggestions?

I´m a none English speaker.

Thank´s
Daniel..




INFOSOL Webmail
http://webmail.gtm.sld.cu/imp/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Which Database Abstraction Layer ?

2004-09-03 Thread Hans Lellelid
Lester Caine wrote:
snip
So you start with ADOdb datadict and build the database from that - 
works well when adding any supported engine. Reserved words which differ 
between engines are another problem area though.
Yeah, but not just reserved words -- but even what is allowable in a 
query.  MySQL is notorious, of course, for not only the f'd up types 
(ENUM, proprietary TIMESTAMP format) but also for being rather lax about 
using aggregate functions w/o specifying columns in GROUP BY clause, etc.

There's other behavior that differs too:  e.g. in MySQL (and others) 
LIKE performs case-insensitive search.  In PostgreSQL we have instead 
ILIKE for insensitive searching and LIKE for case-sensitive searching.

Of course when you bring Oracle into the picture the differences are 
compounded many fold again (and at that point I no longer can keep up).

I would also suggest you also add Creole (http://creole.phpdb.org) to 
your test list if you are considering abstraction layers for PHP5.

Doesn't do Firebird yet ;) - but it looks interesting. As long as it has 
not made the mistake of using MySQL as the SQL standard. Many other 
packages are simply MySQL wrappers with cobbled support for a couple of 
other engines.
No, that's true; no Firebird yet.  Drivers needed :)  It's basically a 
slightly modified version of the JDBC API for PHP.  It does not use 
MySQL as an authority on SQL ;)  I use it primarily with PostgreSQL -- 
and to a lesser extent SQLite and MySQL.

Cheers,
Hans
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php