phpDocumentor db
[ class tree: db ] [ index: db ] [ all elements ]

Class: Database

Source Location: /myphp-1.9/myphp-1.9-db/html/mysql/Database.php

Class Database

Class Overview

The interface towards the mysql database

The interface use an advanced sql caching methode

  1. Usage:
  2. $myDb = new Database();
  3. $myDb->open(); // Open a connection to the database
  4. :
  5. $myDb->doSomeThing() // Use the connection object to operate on table data
  6. :
  7. $myDb->freeResult(); // Free the resources
  8. $myDb->close();

Located in /myphp-1.9/myphp-1.9-db/html/mysql/Database.php [line 36]

Object
   |
   --DatabaseCommon
      |
      --Database

Properties

Methods

[ Top ]
Direct descendents
Child Class Description
DatabaseFields The Database Fields interface towards the mysql tables
Execute Used to perform a query against the database

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From DatabaseCommon

DatabaseCommon::$connection
DatabaseCommon::$result

Inherited From Object

Object::$cachefile
Object::$html

Inherited From DatabaseCommon

DatabaseCommon::DatabaseCommon()
Constructor
DatabaseCommon::close()
Close the connection to the database
DatabaseCommon::freeResult()
Free the resources
DatabaseCommon::getError()
Get the error message
DatabaseCommon::open()
Connect to the host, and select the database to use
DatabaseCommon::set()
Set the named attribute of a class as: $this->key = $value

Inherited From Object

Object::Object()
Constructor
Object::addHtml()
Add the current html to the SourceCode object
Object::getCacheFileName()
Returns the name of the cache file name
Object::getClassName()
Returns the name of the instanciated class
Object::getHtml()
Returns the html for the element
Object::getMsg()
Get the formatted message and debug level and Log to file ?
Object::save()
Save the SQL cache file
Object::setCacheFileName()
Set the path/name of the cache file
Object::toString()
Returns the information for this class
Object::write()
Write the content to the file opened by fp

[ Top ]
Property Summary
int   $affectedRows  
int   $numRows  
int   $row  
String   $sql  

[ Top ]
Method Summary
Database   Database()   Constructor
array   fetchArray()   Fetch the result of the query
object Returns   fetchAssoc()   Fetch the result of the query
object Returns   fetchObject()   Fetch the result of the query
object Returns   fetchRow()   Fetch one row of data from the result associated with the specified result identifier
int   getAffectedRows()   Get the affected rows
String   getFieldFlags()   Get the flags associated with the specified field in a result
int   getFieldLen()   Get the length of the specified field
String   getFieldName()   Get the name of the specified field in a result
String   getFieldTable()   Get name of the table the specified field is in
String   getFieldType()   Get the type of the specified field in a result
int   getInsertId()   Return the ID generated for the INSERT statement for an AUTO_INCREMENT type
int   getNumFields()   Returns the number of fields in the result
int   getNumRows()   Get the number of rows
boolean   query()   Execute the specified query. SELECT, UPDATE, INSERT etc...

[ Top ]
Properties
int   $affectedRows = 0 [line 40]

[ Top ]
int   $numRows = 0 [line 45]

[ Top ]
int   $row = NULL [line 50]

[ Top ]
String   $sql = '' [line 55]

Redefinition of:
Object::$sql

[ Top ]
Methods
Constructor Database  [line 60]

  Database Database( )

Constructor



[ Top ]
fetchArray  [line 182]

  array fetchArray( [int $result_type = MYSQL_BOTH]  )

Fetch the result of the query

Parameters:
int   $result_type:  The optional argument result_type is a constant and can take the following values: MYSQL_ASSOC, MYSQL_NUM, and MYSQL_BOTH.

API Tags:
Return:  Returns the contents of the resultset, returns FALSE when all have been returned


[ Top ]
fetchAssoc  [line 190]

  object Returns fetchAssoc( )

Fetch the result of the query


API Tags:
Return:  the contents of the resultset, returns FALSE when all have been returned


[ Top ]
fetchObject  [line 172]

  object Returns fetchObject( [object $result_type = MYSQL_ASSOC]  )

Fetch the result of the query

Parameters:
object   $result_type:  The optional argument result_type is a constant and can take the following values: MYSQL_ASSOC, MYSQL_NUM, and MYSQL_BOTH.

API Tags:
Return:  the contents of the resultset, returns FALSE when all have been returned


[ Top ]
fetchRow  [line 161]

  object Returns fetchRow( [object $result = '']  )

Fetch one row of data from the result associated with the specified result identifier

Parameters:
object   $result:  The result identifier or NULL

API Tags:
Return:  an array that corresponds to the fetched row, or FALSE if there are no more rows


[ Top ]
getAffectedRows  [line 144]

  int getAffectedRows( )

Get the affected rows


API Tags:
Return:  The number of rows affected by the query


[ Top ]
getFieldFlags  [line 240]

  String getFieldFlags( int $offset  )

Get the flags associated with the specified field in a result

Parameters:
int   $offset:  The field offset to fetch

API Tags:
Return:  Returns the field flags of the specified field or FALSE on failure The flags are reported as a single word per flag separated by a single space, so that you can split the returned value using explode().


[ Top ]
getFieldLen  [line 217]

  int getFieldLen( int $offset  )

Get the length of the specified field

Parameters:
int   $offset:  The field offset to fetch

API Tags:
Return:  Returns the length of the specified field


[ Top ]
getFieldName  [line 207]

  String getFieldName( int $offset  )

Get the name of the specified field in a result

Parameters:
int   $offset:  The field offset to fetch

API Tags:
Return:  Returns the name of the specified field index


[ Top ]
getFieldTable  [line 250]

  String getFieldTable( String $offset  )

Get name of the table the specified field is in

Parameters:
String   $offset:  The field offset to fetch

API Tags:
Return:  Returns the name of the table that the specifed field is in


[ Top ]
getFieldType  [line 228]

  String getFieldType( int $offset  )

Get the type of the specified field in a result

Parameters:
int   $offset:  The field offset to fetch

API Tags:
Return:  Returns the field type and will be one of "int", "real", "string", "blob", ...


[ Top ]
getInsertId  [line 125]

  int getInsertId( )

Return the ID generated for the INSERT statement for an AUTO_INCREMENT type


API Tags:
Return:  Return the ID generated by the INSERT query


[ Top ]
getNumFields  [line 198]

  int getNumFields( )

Returns the number of fields in the result


API Tags:
Return:  The number of fields in the result


Redefined in descendants as:

[ Top ]
getNumRows  [line 152]

  int getNumRows( )

Get the number of rows


API Tags:
Return:  The number of rows returned by the query


[ Top ]
query  [line 70]

  boolean query( String $sql  )

Execute the specified query. SELECT, UPDATE, INSERT etc...

Return false or a resource identifier (for SELECT,SHOW,EXPLAIN or DESCRIBE, ...)

Parameters:
String   $sql:  The sql query to execute

API Tags:
Return:  Returns TRUE (INSERT, UPDATE, DELETE, ...)


[ Top ]

Documentation generated on Thu, 22 Dec 2005 17:05:20 +0100 by phpDocumentor 1.3.0RC3