ADODB LITE version 0.07

Recommended: You should delete the entire directory for the
older versions of ADOdb Lite when you are upgrading.  This
will remove any files that are nolonger needed by ADOdb Lite.
Leaving the unused files will not cause any problems but it
is best to remove them.

This version of ADOdb Lite finally implements the extend for
the ADOConnection class properly.  The method I was using on
earlier versions was a kludge.  The reason I was doing things
in that manner was because it saved memory.  Creating the
extend object after the main object was saving around 11k of
system ram but it caused some other problems.  Mainly that it
would be difficult to add on extra features as modules.

The one departure I am going to make from 100% compatibility
with ADOdb is in the Caching department.  The exact same commands
will be used but you will have to use a different database
type name.  Prefixing the curent database type name with 'c_'.

IE: 'mysql' would be 'c_mysql' for the caching version

This will use a completely different database driver specifically
optimized for caching.

I do not have a firm date for when this will be coming out because
I do not have a firm roadmap on how I will impliment the code
for database caching.  I have a number of ideas that I need to try
out first.

The maximum memory usage limit for caching will be set at 200k.
This is double the limit I have set for the normal ADOdb Lite.

If you are using ADOdb Lite on your website please use the 
thumbnail logo I have provided someone on your main page.

<a href="http://adodblite.sourceforge.net/"><img src="images/adodblite_thumb.jpg" alt="ADOdb Lite Web Site" width="100" height="46" border="0"></a>

We have been using ADODB for a number of our web sites for quite 
some time and decided to look into the memory requirements of the 
latest version.  We were quite frankly horrified to find out ADODB 
uses approximately 700k of ram for each page load.  On some of our 
sites this is 10-50 times larger than the pages of PHP code.  That 
is quite frankly unacceptable.  So we decided to come up with a 
very scaled back ADODB LITE that includes the most commonly used 
functions while being compact.  The current version only uses 
about 78k of ram.

We are only supporting a subset of the commands from ADODB but 
these are commands most people will be using.  We dropped all of 
the esoteric commands as their usefulness is minimal while they 
consume vast amounts of resources needlessly.

I really hope the ADODB team will finally decide to break down the 
main code into modules that are loaded ONLY when they are needed 
instead of doing the shotgun method of loading everything.  The 
100+k adodb.inc.php from ADODB compiles to a size of over 450k 
when it is executed.  If they went a totally modular route this 
would be drastically reduced.

One of the added benifits of ADODB LITE is speed.  It is virtually 
just as fast as using native PHP database commands.  This is a huge 
improvement in speed and also greatly lowers the CPU load.

Commands that are infrequently used for accessing the datase are
placed inside dynamically loaded files.  Some of these files may
be as small as one line of code.  This reduces the amount of memory
required for most operations.

The currently supported databases are a subset of the databases 
supported by ADODB.

fbsql (FrontBase)
maxdb
msql
mssql
mysql
mysqli
mysqlt
postgres
postgres7
postgres64
sqlite
sybase

ADODB LITE Initial Startup
--------------------------
require_once "adodb/adodb.inc.php"; 
$db = ADONewConnection("mysql");

$result = $db->Connect("$dbhost", "$dbuname", "$dbpass", "$dbname");

or persistent connection

$result = $db->PConnect("$dbhost", "$dbuname", "$dbpass", "$dbname");

or force a new connection

$result = $db->NConnect("$dbhost", "$dbuname", "$dbpass", "$dbname");


The availible command subset...

$ADODB_FETCH_MODE = 'ADODB_FETCH_DEFAULT'|'ADODB_FETCH_NUM'|'ADODB_FETCH_ASSOC'|'ADODB_FETCH_BOTH'

$db->Execute($sql)
$db->SelectLimit( $sql, [nrows], [offset] ) - Currently MySql/MySqli/MySqlt/SqLite/PostGres7/MsSql/MsSqlpo/Sybase supported
$db->Insert_ID()
$db->close()
$db->ErrorMsg()
$db->ErrorNo()
$db->Version()
$db->IsConnected()
$db->SetFetchMode($mode) - $mode = 'ADODB_FETCH_DEFAULT'|'ADODB_FETCH_NUM'|'ADODB_FETCH_ASSOC'|'ADODB_FETCH_BOTH'
$db->SelectDB($dbname)
$db->GetOne($sql)
$db->GetRow($sql)
$db->GetAll($sql)
$db->GetArray($sql)
$db->GetCol($sql)
$db->Affected_Rows()

$result->Fields([column])
$result->Fields
$result->RecordCount()
$result->FieldCount()
$result->MoveNext()
$result->MoveFirst()
$result->MoveLast()
$result->Move([row])
$result->EOF()
$result->EOF
$result->GetArray([nRows])
$result->GetRows([nRows])
$result->GetAll([nRows])
$result->close()

This is just a very small subset of the ADODB commands.  We will add 
others as they are needed in the future.  We created this mainly for 
our websites and Alien Assault Traders as we don't need all of the 
bells and whistles from ADODB.

Examples:

<?
include('adodb.inc.php');
$db = &ADONewConnection('access');
$db->Connect('mysql');
$result = $db->Execute('select * from table');
if (!$result) 
	print $db->ErrorMsg();
else
while (!$result->EOF) {
	print $result->fields[0].' '.$result->fields[1].'<BR>';
	$result->MoveNext();
}
$result->Close();
$db->Close();
?>

<?
include('adodb.inc.php');
$db = &ADONewConnection('access');
$db->Connect('mysql');
$db->SetFetchMode(ADODB_FETCH_NUM);
$result1 = $db->Execute('select * from table');
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$result2 = $db->Execute('select * from table');
print_r($result1->fields); # shows array([0]=>'v0',[1] =>'v1')
print_r($result2->fields); # shows array(['col1']=>'v0',['col2'] =>'v1')
?>

If you are not familier with ADOdb then I would suggest reading the ADOdb 
Manual located at http://phplens.com/lens/adodb/docs-adodb.htm


Testing your install of ADOdb Lite
----------------------------------

I have included a program called test_adodb_lite.php.  This program will 
test your install of ADOdb Lite by testing all of the functions/commands
that are provided by this package.  The test will perform over 20
different tests of all functions.

You will need to create a database or use an exiting database to perform
this test.  You will be asked for the database type, location, database
username, database password and database name.

If you are testing a database other than MySql, MySqli or MySqlt then
you will need to create a database table called 'adodb_lite_test'
with three fields.

Field 1 = id int(11) auto_increment
Field 2 = text longtext or text
Field 3 = dummy longtext or text

Here is what the MySql create table query looks like.

CREATE TABLE IF NOT EXISTS `adodb_lite_test` (
`id` int(11) NOT NULL auto_increment,
`text` longtext,
`dummy` longtext,
PRIMARY KEY (`id`)
) TYPE=MyISAM

If you are testing on MySql, MySqli or MySqlt the table will be created.
