Hello All,

Monty has a series of proposed changes and updates to the MySQL extension
(along with a few ideas of mine that we have discussed) that I would like to
present to the dev list for feedback and review.

Synopsis of Proposed Changes
============================
Update the PHP built-in MySQL library to support MySQL 4.0.1


Extend mysql_connect()/mysql_pconnect() to allow the optional selection 
of a default database, a MySQL config file and a group within the selected
config file.

The default database parameter will allow the default database to be
selected at connection time, instead of requiring a separate call.

The other parameters will allow the connection to use the client connect 
options set in the config file (such as passwords, connection timeouts, 
etc.) This will allow passwords to be stored outside of the PHP script.


Allow persistent connections to be closed and 'pruned'. Possible ways to
implement this include adding mysql_pclose(), which would close a 
persistent connection and remove it from the connection cache.

...or add a function that flags persistent connections as removeable. Calls
to mysql_close() made on a flagged connection would close it and remove it
from the connection cache. i.e. mysql_trim_pconnections (); An optional
argument could allow the connections to be pruned down to a certain number.


Create an OO-based wrapper for the MySQL extension. The wrapper would 
provide the user with access to all of a database's information without 
requiring explicit queries or functions calls to retrieve the data. The 
user would not need to call call mysql_db_name, mysql_field_*, 
mysql_list_fields, etc. The wrapper would also encompass the rest of the 
MySQL extension's functionality.

The major benefits of the wrapper would be:
  - Small and simple API. The number of functions would drop from 41 to
     around 12.
  - Full information on the server, databases, tables and fields could
    easily be viewed with one call to var_dump()
  - Connection handles, etc. would all be managed by the object
  - Error messages, last insert id, etc. would be stored as object 
    properties.

The library would work something like the following:
   // Connect to MySQL and select database
   $mysql = new oo_mysql ('localhost', 'user', 'password', 'db');

   // Accessing the tables property triggers a SHOW TABLES query
   var_dump ($mysql->tables);

Notes: The wrapper would not retrieve the information until the 
corresponding property was requested. This will keep the size of the object 
down.

As always, feedback is welcome! :)


Thanks!

--zak

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to