- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:addons:addons_index

Index

# Unsupported Addons

These addon utilities are distributed as part of ADOdb, but are provided as-is, with no confirmation of compatibility with later versions of PHP or operating system, or of compatibility with a specific driver. Fixes and updates are always welcome.

##### Requires

    tohtml.inc.php

##### Syntax

    string rs2html (
        object $recordset,
        optional string $tableStyles=false,
        optional array $columnHeaders=false,
        optional bool $htmlspecialchars=true,
        optional bool $echo = true
        )

## rs2html

This addon provides a method of displaying a recordset in an html table. In its simplest implementation, it can be used just by passing a recordset. This is an easy way to display a retrieved recordset for debugging purposes.

### Parameters

#### $recordset

A handle to an ADOdb recordset, provided by an `execute()` or a `selectLimit()` statement.

#### $tableStyles

Historically this parameter was used for items like 'border' and 'width' but can also be used for modern attributes such as 'class' and 'style'. Double quotes in the statement should be escaped.

#### $columnHeaders

If provided, the numeric array is used for column headers instead of the field names. It must contain index entries for all columns.

#### $htmlSpecialChars

By default, the PHP function htmlSpecialChars is applied to all values. This parameter disables this functionality.

#### $echo

By default, the output is echoed directly to the screen. If the value is set to false, the output is collected in a string and returned from the function.

### Global Variables

THe following variables may be defined, and are globalized into the function

Variable | Description
--- | ---
$gSQLMaxRows | The maximum number of rows displayed in the table. This does not affect the number of rows retrieved
$gSQLBlockRows | The records returned are grouped into blocks of this number of records. Historically, this feature was used to improve rendering speed.
$ADODB_ROUND | The number of decimal places that floating point numbers are rounded to

### Usage

    /*
    * Connection to Access northwind database
    */
    include 'adodb/adodb.inc.php';
    include 'adodb/tohtml.inc.php';

    $db = newAdoConnection('access');

    $sql = 'select * from orders'
    $recordset = $db->execute($sql);

    $tableStyles = "class=\"rs2class\" style='border:1px dashed silver'";
    rs2html($recordset,$tableStyles);

## rs2csv & rs2tab

##### Requires

    toexport.inc.php

##### Syntax

    string rs2csv(
       obj $recordSet
       optional bool $addTitles=true
       )

    string rs2tab(
       obj $recordSet
       optional bool $addTitles=true
       )

### Description

The function `rs2csv()` takes a recordset object as an argument and returns the data as a string containing a CSV format file. If selected, the first row contains the column names. The rs2tab function returns the data as tab separated data

### Usage

    /*
    * Connection to Northwind Database
    */
    $sql = "SELECT * FROM orders";

    $recordset = $db->execute($sql);

    $csv = rs2csv($recordset);

String fields are not quoted or escaped per standard CSV format

## rs2csvfile & rs2tabfile

##### Requires

    toexport.inc.php

##### Syntax

    void rs2csvfile(
       obj $recordSet
       handle $filePointer
       optional bool $addTitles=true
       )

       void rs2tabfile(
       obj $recordSet
       handle $filePointer
       optional bool $addTitles=true
       )

### Description

The function `rs2csvfile()` takes a recordset object as an argument and outputs the data to a CSV file indicated by the file pointer $filePointer . If selected, the first row contains the column names. The `rs2tabfile()` function returns the data as tab-separated.

### Usage

    /*
    * Connection to Northwind Database
    */

    $filePointer = fopen('/tmp/products.csv','w');
    $sql = "SELECT * FROM products";

    $recordset = $db->execute($sql);

    $csv = rs2csv($recordset, $filePointer);

String fields are not quoted or escaped per standard CSV format

## rs2csvout & rs2tabout

##### Requires

    toexport.inc.php

##### Syntax

    string rs2csvout(
       obj $recordSet
       optional bool $addTitles=true
       )

     string rs2tabout(
       obj $recordSet
       optional bool $addTitles=true
       )

### Description

The function `rs2csvout()` takes a recordset object as an argument and sends the data as a string containing a CSV format file to the PHP STDOUT. If selected, the first row contains the column names. The function `rs2tabout()`. Returns the data in tab-separated format.

### Usage

    /*
    * Connection to Northwind Database
    */
    $sql = "SELECT * FROM products";

    $recordset = $db->execute($sql);

    $csv = rs2tabout($recordset);

String fields are not quoted or escaped per standard CSV format

## The xmlrpc library

This addon provides an interface between the adodb recordset and the php xmlrpc library. More Information.

v5/addons/addons_index.txt · Last modified: 2016/01/13 07:20 (external edit)

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top