ADOdb Lite Commands

| ADOdb Lite Modules

ADOdb Lite Modules

With the release of ADOdb Lite Version 0.13 the addition of module support was added. ADOdb Lite Modules allow you to select what you would like loaded for ADOdb Lite. This will allow you greater control over the resources needed by ADOdb Lite. You nolonger have to load functions you will never use in your code. This makes ADOdb Lite incredably FAST, SMALL and HIGHLY EXPANDABLE.

Some modules come included with the ADOdb Lite package while others can be downloaded seperately and then easily added to ADOdb Lite. Below is a list of the currently offered modules for ADOdb Lite and the new features they offer.

If you would like to create new modules for use with ADOdb Lite be sure to check the Module Creation page for more information. I have created a Modules file area on Sourceforge for all user created modules. If you would like your module to be availible for download send me a copy and I will add it to the Module File Release Area. Make sure you have included a readme.txt or something similar with information about the code, yourself and any installation instructions.

The following modules are supported:

Module Designator | Module Function
pear | Adds generic Pear Database Functions
transaction | Adds transaction support for databases that support it
extend | Adds little used but important ADOdb functions
date | Adds all ADOdb Database Date Functions
object | Adds all ADOdb Database Object Functions
menu | Adds all ADOdb Database Menu Functions
adodblite | Adds functions designed specifically for ADOdb Lite
meta | Adds all ADOdb Database Meta Functions
perfmon | Adds support for the Performance Monitor

Pear Module Functions (module included with ADOdb Lite)

Pear functions have been moved to their own module. When creating a new ADO Connection you will need to add the "pear" flag if you wish to use any of these functions. The following is a list of Pear functions. The Pear Module will add approximately 17k to the libraries memory overhead. The following Pear functions are not supported: $db->Prepare(), $db->nextID and $db->GetAssoc()

Pear Database Functions

$db->Disconnect()
$db->ErrorNative()
$db->GetCol($sql)
$db->GetOne($sql)
$db->GetRow($sql)
$db->LimitQuery( $sql,[offset], [nrows], [$inputarray] )
$db->Query($sql, [$inputarray])
$db->Quote($string)
$db->SetFetchMode($mode) - $mode = 'ADODB_FETCH_DEFAULT' | 'ADODB_FETCH_NUM' | 'ADODB_FETCH_ASSOC' | 'ADODB_FETCH_BOTH'

Pear Resultset Functions

$result->FetchInto($array)
$result->FetchRow()
$result->Free()
$result->NumCols()
$result->NumRows()

Transaction Module Functions (module included with ADOdb Lite)

Transaction functions for the mssql, mssqlpo, mysqli, mysqlt, odbc, postgres, postgres64, postgres7, postgres8, sqlite, sqlitepo, sybase and sybase_ase Drivers. The Transaction Module will add 10-12k to the libraries memory overhead.

Transaction Database Functions

$db->StartTrans()
$db->BeginTrans()
$db->CompleteTrans($autoComplete)
$db->CommitTrans($ok)
$db->RollbackTrans()
$db->FailTrans()
$db->HasFailedTrans()
$db->RowLock($tables, $where)
$db->CommitLock($table)
$db->RollbackLock($table)

Extend Module Functions (module included with ADOdb Lite)

The Extend Module contains little used but important functions. The Extend Module will add 15-20k to the libraries memory overhead.

Extend Database Functions
$db->GetAssoc($sql, [$inputarray], [$force_array], [$first2cols]) $db->GenID($seqName = 'adodbseq', $startID=1) $db->CreateSequence($seqName = 'adodbseq',$startID=1) $db->DropSequence($seqName = 'adodbseq')

Extend Resultset Functions

$result->GetAssoc([$force_array])
$result->PO_RecordCount($table, $where)
$result->NextRecordSet()
$result->CurrentRow()
$result->AbsolutePosition()

Date Module Functions (module included with ADOdb Lite)

Date functions have been moved to their own module. When creating a new ADO Connection you will need to add the "date" flag if you wish to use any of these functions. The following is a list of Date functions. The Date Module will add approximately 240k to the libraries memory overhead. It is recommended that you do not load the date functions unless you absolutely need them because of the high overhead. When you have selected the Date Module it will also load the adodb-time.inc.php program in support of the date functions.

Date Database Functions

$db->DBDate($date)
$db->DBTimeStamp($timestamp)
$db->UnixDate($str)
$db->UnixTimeStamp($str)
$db->OffsetDate($dayFraction, $basedate=false) - Mysql/Postgres/MsSql based drivers only
$db->SQLDate($dateFormat, $basedate=false) - Mysql/Postgres/MsSql based drivers only
$db->UserDate($str, [$fmt])
$db->UserTimeStamp($str, [$fmt])

Date Resultset Functions
$result->UnixDate($str) $result->UnixTimeStamp($str) $result->UserDate($str, [$fmt]) $result->UserTimeStamp($str, [$fmt])

Object Module Functions (module included with ADOdb Lite)

Object Functions have been moved to their own module. When creating a new ADO Connection you will need to add the "object" flag if you wish to use any of these functions. The following is a list of Object functions.

Object Resultset Functions

$result->FetchObj()
$result->FetchObject($isupper=true)
$result->FetchNextObj()
$result->FetchNextObject($isupper=true)
$result->loadObjectList($key='')

Menu Module Functions (module included with ADOdb Lite)

Menu Functions have been moved to their own module. When creating a new ADO Connection you will need to add the "menu" flag if you wish to use any of these functions. The following is a list of the Menu functions.

Menu Resultset Functions

$result->GetMenu($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='', $compareFields0=true)
$result->GetMenu2($name, $defstr='', $blank1stItem=true, $multiple=false ,$size=0, $selectAttr='')
$result->GetMenu3($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='')

ADOdb Lite Module Functions (module included with ADOdb Lite)

These are functions that were created specifically for ADOdb Lite. When creating a new ADO Connection you will need to add the "adodblite" flag if you wish to use any of these functions. The following is a list of ADOdb Lite functions.

ADOdb Lite Database Functions
$db->GetToFieldArray($sql, $inputarr=false, $fieldname = false)

ADOdb Lite Resultset Functions
$result->GetToFieldArray($fieldname = false)

The GetToFieldArray is a specialized function that will allow you to populate an array will all data from the executed query with the key elements coming from the specified field in the table.

The following example uses a table called adodb_lite_test with the following fields: id, text, dummy.

id | text | dummy

1 | 296_count_1 | this
2 | 532_count_2 | stuff

$data = $db->GetToFieldArray( 'select * from adodb_lite_test', '', 'text' );

The above query will return an array using the data in the text field as the index for each element.

Example:
----------
echo $data['296_count_1']['id'] . "<br>";
echo $data['296_count_1']['dummy'] . "<br>";
echo "<br>";
echo $data['532_count_2']['id'] . "<br>";
echo $data['532_count_2']['dummy'] . "<br>";
Output:
--------
1
this
2
stuff

This may seem to duplicate the GetAssoc function but it allows you to specify the column or field name you would like to use to create the key elements from instead of it being the first element from the record set.

Meta Module Functions (module included with ADOdb Lite)

The Meta Module contains all of the ADOdb meta functions. You must also include the pear module.

Important: You must include the pear module for the meta module to function properly.

Meta Database Functions

$db->MetaError($err=false)
$db->MetaErrorMsg($errno)
$db->MetaPrimaryKeys($table, $owner=false)
$db->MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $associative = FALSE )
$db->MetaType($t,$len=-1,$fieldobj=false)
$db->MetaDatabases()
$db->MetaTables($ttype=false,$showSchema=false,$mask=false)
$db->MetaColumns($table)
$db->MetaIndexes($table, $primary = FALSE, $owner=false)
$db->MetaColumnNames($table, $numIndexes=false)
$db->MetaTransaction($mode,$db)

Meta Resultset Functions
$result->MetaType($t, $len=-1, $fieldobj=false)

Copyright ©2005, 2006 Mark Dickenson