Class DB_dbase

Description

The methods PEAR DB uses to interact with PHP's dbase extension for interacting with dBase databases

These methods overload the ones declared in DB_common.

Located in /web/lib/external/pear-db/DB/dbase.php (line 47)

PEAR
   |
   --DB_common
      |
      --DB_dbase
Variable Summary
 resource $connection
 string $dbsyntax
 array $dsn
 array $features
 string $phptype
 integer $result
 array $res_row
 array $types
Method Summary
 void DB_dbase ()
 int connect (array $dsn, [bool $persistent = false])
 bool disconnect ()
 mixed fetchInto (resource $result,  &$arr, int $fetchmode, [int $rownum = null], array $arr)
 bool freeResult (resource $result)
 int numCols ( $foo, resource $result)
 int numRows ( $foo, resource $result)
 void &query ([ $query = null])
 string quoteBoolean (boolean $boolean)
 array tableInfo ([mixed $result = null], [int $mode = null])
Variables
resource $connection (line 97)

The raw database connection created by PHP

string $dbsyntax = 'dbase' (line 61)

The database syntax variant to be used (db2, access, etc.), if any

array $dsn = array() (line 103)

The DSN information for connecting to a database

array $errorcode_map = array(
)
(line 90)

A mapping of native error codes to DB error codes

array $features = array(
'limit' => false,
'new_link' => false,
'numrows' => true,
'pconnect' => false,
'prepare' => false,
'ssl' => false,
'transactions' => false,
)
(line 76)

The capabilities of this DB implementation

The 'new_link' element contains the PHP version that first provided new_link support for this DBMS. Contains false if it's unsupported.

Meaning of the 'limit' element:

  • 'emulate' = emulate with fetch row by number
  • 'alter' = alter the query
  • false = skip rows

string $phptype = 'dbase' (line 55)

The DB driver type (mysql, oci8, odbc, etc.)

integer $result = 0 (line 119)

The quantity of results so far

For emulating result resources.

array $res_row = array() (line 110)

A means of emulating result resources

array $types = array(
'C' => 'character',
'D' => 'date',
'L' => 'boolean',
'M' => 'memo',
'N' => 'number',
)
(line 130)

Maps dbase data type id's to human readable strings

The human readable values are based on the output of PHP's dbase_get_header_info() function.

  • since: Property available since Release 1.7.0

Inherited Variables

Inherited from DB_common

DB_common::$fetchmode
DB_common::$fetchmode_object_class
DB_common::$last_parameters
DB_common::$last_query
DB_common::$options
DB_common::$prepared_queries
DB_common::$prepare_tokens
DB_common::$prepare_types
DB_common::$was_connected
DB_common::$_last_query_manip
DB_common::$_next_query_manip
Methods
Constructor DB_dbase (line 147)

This constructor calls $this->DB_common()

void DB_dbase ()
connect (line 202)

Connect to the database and create it if it doesn't exist

Don't call this method directly. Use DB::connect() instead.

PEAR DB's dbase driver supports the following extra DSN options:

  • mode An integer specifying the read/write mode to use (0 = read only, 1 = write only, 2 = read/write). Available since PEAR DB 1.7.0.
  • fields An array of arrays that PHP's dbase_create() function needs to create a new database. This information is used if the dBase file specified in the "database" segment of the DSN does not exist. For more info, see the PHP manual's dbase_create() page. Available since PEAR DB 1.7.0.
Example of how to connect and establish a new dBase file if necessary:
  1.  require_once 'DB.php';
  2.  
  3.  $dsn array(
  4.      'phptype'  => 'dbase',
  5.      'database' => '/path/and/name/of/dbase/file',
  6.      'mode'     => 2,
  7.      'fields'   => array(
  8.          array('a''N'50),
  9.          array('b''C'40),
  10.          array('c''C'255),
  11.          array('d''C'20),
  12.      ),
  13.  );
  14.  $options array(
  15.      'debug'       => 2,
  16.      'portability' => DB_PORTABILITY_ALL,
  17.  );
  18.  
  19.  $db DB::connect($dsn$options);
  20.  if (PEAR::isError($db)) {
  21.      die($db->getMessage());
  22.  }

  • return: DB_OK on success. A DB_Error object on failure.
int connect (array $dsn, [bool $persistent = false])
  • array $dsn: the data source name
  • bool $persistent: should the connection be persistent?
disconnect (line 262)

Disconnects from the database server

  • return: TRUE on success, FALSE on failure
bool disconnect ()
fetchInto (line 303)

Places a row from the result set into the given array

Formating of the array and the data therein are configurable. See DB_result::fetchInto() for more information.

This method is not meant to be called directly. Use DB_result::fetchInto() instead. It can't be declared "protected" because DB_result is a separate object.

  • return: DB_OK on success, NULL when the end of a result set is reached or on failure
  • see: DB_result::fetchInto()
mixed fetchInto (resource $result,  &$arr, int $fetchmode, [int $rownum = null], array $arr)
  • resource $result: the query result resource
  • array $arr: the referenced array to put the data in
  • int $fetchmode: how the resulting array should be indexed
  • int $rownum: the row number to fetch (0 = first row)
  • &$arr
freeResult (line 343)

Deletes the result set and frees the memory occupied by the result set.

This method is a no-op for dbase, as there aren't result resources in the same sense as most other database backends.

bool freeResult (resource $result)
  • resource $result: PHP's query result resource
numCols (line 364)

Gets the number of columns in a result set

This method is not meant to be called directly. Use DB_result::numCols() instead. It can't be declared "protected" because DB_result is a separate object.

int numCols ( $foo, resource $result)
  • resource $result: PHP's query result resource
  • $foo
numRows (line 385)

Gets the number of rows in a result set

This method is not meant to be called directly. Use DB_result::numRows() instead. It can't be declared "protected" because DB_result is a separate object.

int numRows ( $foo, resource $result)
  • resource $result: PHP's query result resource
  • $foo

Redefinition of:
DB_common::numRows()
Determines the number of rows in a query result
query (line 272)
void &query ([ $query = null])
  • $query

Redefinition of:
DB_common::query()
Sends a query to the database server
quoteBoolean (line 402)

Formats a boolean value for use within a query in a locale-independent manner.

string quoteBoolean (boolean $boolean)
  • boolean $boolean: the boolean value to be quoted.

Redefinition of:
DB_common::quoteBoolean()
Formats a boolean value for use within a query in a locale-independent manner.
tableInfo (line 422)

Returns information about the current database

  • return: an associative array with the information requested. A DB_Error object on failure.
  • see: DB_common::tableInfo()
  • since: Method available since Release 1.7.0
array tableInfo ([mixed $result = null], [int $mode = null])
  • mixed $result: THIS IS UNUSED IN DBASE. The current database is examined regardless of what is provided here.
  • int $mode: a valid tableInfo mode

Redefinition of:
DB_common::tableInfo()
Returns information about a table or a result set

Inherited Methods

Inherited From DB_common

 DB_common::DB_common()
 DB_common::affectedRows()
 DB_common::autoCommit()
 DB_common::autoExecute()
 DB_common::autoPrepare()
 DB_common::buildManipSQL()
 DB_common::commit()
 DB_common::createSequence()
 DB_common::dropSequence()
 DB_common::errorCode()
 DB_common::errorMessage()
 DB_common::errorNative()
 DB_common::escapeSimple()
 DB_common::execute()
 DB_common::executeEmulateQuery()
 DB_common::executeMultiple()
 DB_common::freePrepared()
 DB_common::getAll()
 DB_common::getAssoc()
 DB_common::getCol()
 DB_common::getListOf()
 DB_common::getOne()
 DB_common::getOption()
 DB_common::getRow()
 DB_common::getSequenceName()
 DB_common::getSpecialQuery()
 DB_common::getTables()
 DB_common::limitQuery()
 DB_common::modifyLimitQuery()
 DB_common::modifyQuery()
 DB_common::nextId()
 DB_common::nextQueryIsManip()
 DB_common::numRows()
 DB_common::prepare()
 DB_common::provides()
 DB_common::query()
 DB_common::quote()
 DB_common::quoteBoolean()
 DB_common::quoteFloat()
 DB_common::quoteIdentifier()
 DB_common::quoteSmart()
 DB_common::quoteString()
 DB_common::raiseError()
 DB_common::rollback()
 DB_common::setFetchMode()
 DB_common::setOption()
 DB_common::tableInfo()
 DB_common::toString()
 DB_common::_checkManip()
 DB_common::_convertNullArrayValuesToEmpty()
 DB_common::_rtrimArrayValues()
 DB_common::__sleep()
 DB_common::__toString()
 DB_common::__wakeup()

Inherited From PEAR

 PEAR::PEAR()
 PEAR::delExpect()
 PEAR::expectError()
 PEAR::getStaticProperty()
 PEAR::isError()
 PEAR::loadExtension()
 PEAR::popErrorHandling()
 PEAR::popExpect()
 PEAR::pushErrorHandling()
 PEAR::raiseError()
 PEAR::registerShutdownFunc()
 PEAR::setErrorHandling()
 PEAR::staticPopErrorHandling()
 PEAR::staticPushErrorHandling()
 PEAR::throwError()
 PEAR::_PEAR()

Documentation generated on Wed, 09 Feb 2011 08:59:23 +0700 by phpDocumentor 1.4.2