sql 
[ doc home ] [ class tree: sql ] [ index: sql ] [ all elements ]

Class: IsterSqlQuery

Source Location: /IsterSqlQuery.php

Class Overview

IsterObject
   |
   --IsterSqlConnection
      |
      --IsterSqlQuery

This class represents database queries.


Author(s): Ingo Schramm   

Copyright: Copyright (c) 2005 Ister.ORG Ingo Schramm

Methods


Child classes:

IsterSqlFunction
This class provides execution of SQL functions aka templates.

Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterSqlConnection

IsterSqlConnection::IsterSqlConnection()
Constructor
IsterSqlConnection::close()
Close the current connection.
IsterSqlConnection::connect()
Establish a connection to the databse server.
IsterSqlConnection::getConnection()
Return the current connection parameters.
IsterSqlConnection::getDriver()
Get the driver object of this connection.
IsterSqlConnection::getLastError()
Get the last error of the driver.
IsterSqlConnection::getLink()
Get the link ressource.
IsterSqlConnection::info()
Get an array with information about the driver and the connection.
IsterSqlConnection::isConnected()
Check whether a connection is established.
IsterSqlConnection::pconnect()
Establish a persistent connection to the databse server.
IsterSqlConnection::setConnection()
Setup the connection.

Class: IsterObject

IsterObject::IsterObject()
Constructor
IsterObject::abstractMethodError()
Report attempt to call an abstract method.
IsterObject::addLogger()
Add an IsterLogger to process log messages.
IsterObject::deleteLogger()
Delete an already registered IsterLogger.
IsterObject::getLoggerNames()
Fetch the names of all currently registered IsterLoggers.
IsterObject::getMem()
Return maximum amount of memory an application has allocated at this point.
IsterObject::log()
Trigger a log message.
IsterObject::passPHPmessage()
Catch PHP E_WARNING and E_NOTICE messages.
IsterObject::serialize()
Serialize the object.
IsterObject::setLogLocal()
Set logging local for the current object.
IsterObject::setupLogger()
Setup a logger.
IsterObject::triggerError()
Alias for log();
IsterObject::unserialize()
Unserialize the object.
IsterObject::__sleep()
Executed prior to serialize().
IsterObject::__wakeup()
Executed prior to unserialize().

Class Details

This class represents database queries.

  1. require_once('IsterSqlQuery.php');
  2.  
  3. $qu = new IsterSqlQuery('IsterSqlDriverPostgresql');
  4. $qu->setConnection('localhost', 'testuser', 'testpass', 'testdb');
  5. $qu->connect();
  6. if(! $qu->isConnected() )
  7. die( $qu->getLastError() );
  8.  
  9. $qu->query('SELECT * FROM table;');
  10. if( $qu->countRows() ) {
  11. while( $row = $qu->fetchRow() ) {
  12. foreach( $row->getColumnNames() as $name ) {
  13. print $name.' = '.$row->getColumnValue($name)."\n";
  14. }
  15. }
  16. }
  17. $qu->free();


copyright:  Copyright (c) 2005 Ister.ORG Ingo Schramm
author:  Ingo Schramm


[ Top ]


Class Methods


constructor IsterSqlQuery

IsterSqlQuery IsterSqlQuery( string $driver)

Constructor

Parameters:

string   $driver   Name of driver.

[ Top ]

method asyncQuery

boolean asyncQuery( string $query)

Execute an asynchronous database query.

Parameters:

string   $query  

[ Top ]

method countRows

integer countRows( )

Count the rows of the current result set.

[ Top ]

method escapeString

string escapeString( string $string, [boolean $binary = false])

Escape a string.

Parameters:

string   $string  
boolean   $binary  

[ Top ]

method fetchAll

array fetchAll( )

Fetch all IsterSqlRow objects from the current result set.

[ Top ]

method fetchObject

object IsterSqlRow fetchObject( )

Alias of fetchRow().

depricated


return:  A row object or null if no more rows are left.
[ Top ]

method fetchRow

object IsterSqlRow fetchRow( )

Fetch an IsterSqlRow object from the current result set.

return:  A row object or null if no more rows are left.
[ Top ]

method free

boolean free( )

Free the current result set.

[ Top ]

method lastWasRead

boolean lastWasRead( )

Check whether the last query was a read (SELECT) operation or not.

[ Top ]

method query

boolean query( string $query)

Execute a database query.

If query fails a warning will be triggered automatically reporting the message of the DBMS.


Parameters:

string   $query  

[ Top ]

method unescapeString

string unescapeString( string $string, [boolean $binary = false])

Unescape a previously escaped string.

Parameters:

string   $string  
boolean   $binary  

[ Top ]


Documentation generated on Tue, 20 Dec 2005 11:21:19 +0100 by phpDocumentor 1.3.0RC4