apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: DB_mysql

Source Location: /DB-1.4.0/DB/mysql.php

Class Overview

PEAR
   |
   --DB_common
      |
      --DB_mysql



Variables

Methods


Inherited Variables

Inherited Methods

Class: DB_common

DB_common::DB_common()
Constructor
DB_common::affectedRows()
returns the affected rows of a query
DB_common::autoCommit()
enable automatic Commit
DB_common::autoExecute()
Make automaticaly an insert or update query and call prepare() and execute() with it
DB_common::autoPrepare()
Make automaticaly an insert or update query and call prepare() with it
DB_common::buildManipSQL()
Make automaticaly an sql query for prepare()
DB_common::commit()
starts a Commit
DB_common::createSequence()
creates a new sequence
DB_common::dropSequence()
deletes a sequence
DB_common::errorCode()
Map native error codes to DB's portable ones. Requires that the DB implementation's constructor fills in the $errorcode_map property.
DB_common::errorMessage()
Map a DB error code to a textual message. This is actually just a wrapper for DB::errorMessage().
DB_common::errorNative()
returns an errormessage, provides by the database
DB_common::execute()
Executes a prepared SQL query
DB_common::executeMultiple()
This function does several execute() calls on the same statement handle. $data must be an array indexed numerically from 0, one execute call is done for every "row" in the array.
DB_common::getAll()
Fetch all the rows returned from a query.
DB_common::getAssoc()
Fetch the entire result set of a query and return it as an associative array using the first column as the key.
DB_common::getCol()
Fetch a single column from a result set and return it as an indexed array.
DB_common::getListOf()
list internal DB info valid values for $type are db dependent, often: databases, users, view, functions
DB_common::getOne()
Fetch the first column of the first row of data returned from a query. Takes care of doing the query and freeing the results when finished.
DB_common::getOption()
returns the value of an option
DB_common::getRow()
Fetch the first row of data returned from a query. Takes care of doing the query and freeing the results when finished.
DB_common::getSequenceName()
DB_common::getTables()
DB_common::limitQuery()
Generates a limited query
DB_common::nextId()
returns the next free id of a sequence
DB_common::numRows()
returns the number of rows in a result object
DB_common::prepare()
Prepares a query for multiple execution with execute().
DB_common::provides()
Tell whether a DB implementation or its backend extension supports a given feature.
DB_common::query()
Send a query to the database and return any results with a DB_result object.
DB_common::quote()
Quotes a string so it can be safely used in a query. It will return the string with single quotes around. Other backend quote styles should override this method.
DB_common::quoteString()
Quotes a string so it can be safely used within string delimiters in a query (preserved for compatibility issues, quote() is preffered).
DB_common::raiseError()
This method is used to communicate an error and invoke error callbacks etc. Basically a wrapper for PEAR::raiseError without the message string.
DB_common::rollback()
starts a rollback
DB_common::setFetchMode()
Sets which fetch mode should be used by default on queries on this connection.
DB_common::setOption()
set the option for the db class
DB_common::tableInfo()
returns meta data about the result set

Class Details

[line 34]


[ Top ]


Class Variables

$autocommit =  true

[line 44]


Type:   mixed


[ Top ]

$connection =

[line 38]


Type:   mixed


[ Top ]

$dbsyntax =

[line 39]


Type:   mixed


[ Top ]

$fetchmode =  DB_FETCHMODE_ORDERED

[line 45]


Type:   mixed
Overrides:   Array


[ Top ]

$num_rows = array()

[line 42]


Type:   mixed


[ Top ]

$phptype =

[line 39]


Type:   mixed


[ Top ]

$prepare_tokens = array()

[line 40]


Type:   mixed
Overrides:   Array


[ Top ]

$prepare_types = array()

[line 41]


Type:   mixed
Overrides:   Array


[ Top ]

$transaction_opcount =  0

[line 43]


Type:   mixed


[ Top ]



Method Detail

DB_mysql (Constructor)   [line 57]

DB_mysql DB_mysql( )

DB_mysql constructor.
  • Access: public

[ Top ]

affectedRows   [line 460]

number affectedRows( )

Gets the number of rows affected by the data manipulation query. For other queries, this function returns 0.
  • Return: of rows affected by the last query

Overrides DB_common::affectedRows() (returns the affected rows of a query)
[ Top ]

autoCommit   [line 394]

void autoCommit( [mixed $onoff = false])

Enable/disable automatic commits

Overrides DB_common::autoCommit() (enable automatic Commit)
[ Top ]

commit   [line 408]

void commit( )

Commit the current transaction.

Overrides DB_common::commit() (starts a Commit)
[ Top ]

connect   [line 101]

int connect( $dsn $dsninfo, [$persistent $persistent = false])

Connect to a database and log in as the specified user.
  • Return: DB_OK on success, a DB error on failure
  • Access: public

Parameters:

$dsn   $dsninfo     the data source name (see DB::parseDSN for syntax)
$persistent   $persistent     (optional) whether the connection should be persistent

[ Top ]

createSequence   [line 577]

void createSequence( mixed $seq_name)


Overrides DB_common::createSequence() (creates a new sequence)
[ Top ]

disconnect   [line 177]

bool disconnect( )

Log out and disconnect from the database.
  • Return: TRUE on success, FALSE if not connected.
  • Access: public

[ Top ]

dropSequence   [line 593]

void dropSequence( mixed $seq_name)


Overrides DB_common::dropSequence() (deletes a sequence)
[ Top ]

errorNative   [line 482]

int errorNative( )

Get the native error code of the last error (if any) that occured on the current connection.
  • Return: native MySQL error code
  • Access: public

Overrides DB_common::errorNative() (returns an errormessage, provides by the database)
[ Top ]

fetchInto   [line 290]

int fetchInto( $result $result, $arr &$arr, $fetchmode $fetchmode, [$rownum $rownum = null])

Fetch a row and insert the data into an existing array.
  • Return: DB_OK on success, a DB error on failure
  • Access: public

Parameters:

$result   $result     MySQL result identifier
$arr   &$arr     (reference) array where data from the row is stored
$fetchmode   $fetchmode     how the array data should be indexed
$rownum   $rownum     the row number to fetch

[ Top ]

fetchRow   [line 264]

array fetchRow( $result $result, [$fetchmode $fetchmode = DB_FETCHMODE_DEFAULT], [$rownum $rownum = null])

Fetch and return a row of data (it uses fetchInto for that)
  • Return: a row of data, or false on error

Parameters:

$result   $result     MySQL result identifier
$fetchmode   $fetchmode     format of fetched row array
$rownum   $rownum     the absolute row number to fetch

[ Top ]

freeResult   [line 324]

bool freeResult( $result $result)

Free the internal resources associated with $result.
  • Return: TRUE on success, FALSE if $result is invalid
  • Access: public

Parameters:

$result   $result     MySQL result identifier or DB statement identifier

[ Top ]

getSpecialQuery   [line 818]

string getSpecialQuery( string $type)

Returns the query needed to get some backend info
  • Return: The SQL query string

Parameters:

string   $type     What kind of info you want to retrieve

[ Top ]

modifyLimitQuery   [line 692]

void modifyLimitQuery( mixed $query, mixed $from, mixed $count)


[ Top ]

modifyQuery   [line 676]

void modifyQuery( mixed $query, [mixed $subject = null])


[ Top ]

mysqlRaiseError   [line 704]

void mysqlRaiseError( [mixed $errno = null])


[ Top ]

nextId   [line 503]

mixed nextId( string $seq_name, [bool $ondemand = true])

Get the next value in a sequence. We emulate sequences for MySQL. Will create the sequence if it does not exist.
  • Return: a sequence integer, or a DB error
  • Access: public

Overrides DB_common::nextId() (returns the next free id of a sequence)

Parameters:

string   $seq_name     the name of the sequence
bool   $ondemand     whether to create the sequence table on demand (default is true)

[ Top ]

nextResult   [line 248]

false nextResult( a $result)

Move the internal mysql result pointer to the next available result

This method has not been implemented yet.

  • Access: public

Parameters:

a   $result     valid sql result resource

[ Top ]

numCols   [line 356]

int numCols( $result $result)

Get the number of columns in a result set.
  • Return: the number of columns per row in $result
  • Access: public

Parameters:

$result   $result     MySQL result identifier

[ Top ]

numRows   [line 379]

int numRows( $result $result)

Get the number of rows in a result set.
  • Return: the number of rows in $result
  • Access: public

Overrides DB_common::numRows() (returns the number of rows in a result object)

Parameters:

$result   $result     MySQL result identifier

[ Top ]

quote   [line 655]

mixed quote( [$string $str = null])

Quote the given string so it can be safely used within string delimiters in a query.
  • Return: "NULL" string, quoted string or original data

Overrides DB_common::quote() (Quotes a string so it can be safely used in a query. It will return the string with single quotes around. Other backend quote styles should override this method.)

Parameters:

$string   $str     mixed Data to be quoted

[ Top ]

rollback   [line 432]

void rollback( )

Roll back (undo) the current transaction.

Overrides DB_common::rollback() (starts a rollback)
[ Top ]

simpleQuery   [line 199]

mixed simpleQuery( the $query)

Send a query to MySQL and return the results as a MySQL resource identifier.
  • Return: returns a valid MySQL result for successful SELECT queries, DB_OK for other successful queries. A DB error is returned on failure.
  • Access: public

Parameters:

the   $query     SQL query

[ Top ]

tableInfo   [line 717]

void tableInfo( mixed $result, [mixed $mode = null])


Overrides DB_common::tableInfo() (returns meta data about the result set)
[ Top ]


Documentation generated on Fri, 30 Apr 2004 23:19:48 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.