Class CustomConnection

(line 79)

Description

Object
   |
   --Persistent
      |
      --Component
         |
         --CustomConnection

Located in File: /db.inc.php

CustomConnection, a common ancestor for all Connection objects

A connection must represent the object which through data objects (tables, queries, etc) perform their operations. Components like Database inherit from CustomConnection and implement the right functionality.



Classes extended from CustomConnection:
Database
Database provides discrete control over a connection to a single database in a database application.
IBDatabase
IBDatabase provides discrete control over a connection to a single InterBase database in a database application.
MySQLDatabase
MySQLDatabase provides discrete control over a connection to a single MySQL database in a database application.
OracleDatabase
OracleDatabase provides discrete control over a connection to a single Oracle database in a database application.

Properties

Summary:
Clients Returns the clients of this database
Connected Determines whether a connection has been established to the remote source of data.
DataSets Provides an indexed array of all active datasets for a database component.

Defined in class Component

Name Specifies the name for the component. The name is used as an identifier and should be unique.
Tag A versatile property of every Component that can be used in any way you want
ComponentCount Indicates the number of components owned by the component.
Components Lists all the components owned by this component.
ControlState A flag to know the state of the control, csLoading, csDesigning
DataFieldValue This property returns the value of the datafield if any.
NamePath Specifies the path to uniquely identify a component, qualified by the owner when required.
Owner Indicates the component that is responsible for streaming and freeing this component.

Defined in class Persistent

NamePath Used to serialize/unserialize. It returns the full path to identify this component.
Owner Owner of the component.

property Clients (line 253)

Collection Clients

Returns the clients of this database

Info

  • see - readDatasets

property Connected (line 414)

boolean Connected

Determines whether a connection has been established to the remote source of data.

Set Connected to true to open the connection. Set Connected to false to terminate the connection.

Setting Connected to true generates a OnBeforeConnect event, calls the protected DoConnect method to establish the connection, and generates an OnAfterConnect event. In addition, when setting Connected to true.

Setting Connected to false generates a OnBeforeDisconnect event, calls the protected DoConnect method to drop the connection, and generates an OnAfterDisconnect event.

When deriving custom connection components from CustomConnection, override readConnected to return true when a connection is established, and override DoConnect and DoDisconnect to create and drop the connection.

Info


property DataSets (line 93)

Collection DataSets

Provides an indexed array of all active datasets for a database component.

Use DataSets to access active datasets associated with a database component. An active dataset is one that is currently open.

Info


property Name

Specifies the name for the component. The name is used as an identifier and should be unique.
This property is implemented in Component::Name

property Tag

A versatile property of every Component that can be used in any way you want
This property is implemented in Component::Tag

property ComponentCount

Indicates the number of components owned by the component.
This property is implemented in Component::ComponentCount

property Components

Lists all the components owned by this component.
This property is implemented in Component::Components

property ControlState

A flag to know the state of the control, csLoading, csDesigning
This property is implemented in Component::ControlState

property DataFieldValue

This property returns the value of the datafield if any.
This property is implemented in Component::DataFieldValue

property NamePath

Specifies the path to uniquely identify a component, qualified by the owner when required.
This property is implemented in Component::NamePath

property Owner

Indicates the component that is responsible for streaming and freeing this component.
This property is implemented in Component::Owner

property NamePath

Used to serialize/unserialize. It returns the full path to identify this component.
This property is implemented in Persistent::NamePath

property Owner

Owner of the component.
This property is implemented in Persistent::Owner

Methods

Summary:
__construct Component constructor [Overrides Component::__construct()]
BeginTrans Begins a new transaction against the database server.
Close Closes the connection.
CompleteTrans Permanently stores updates, insertions, and deletions of data associated with
DBDate Returns a date formatted to be used on this database, depending on the type
DoConnect Provides the interface for a method that opens a connection.
DoDisconnect Provides the interface for a method that terminates the connection.
loaded Initializes the component after the form file has been read into memory. [Overrides Component::loaded()]
MetaFields Returns the fieldnames for the table
Open Opens the connection.
Param Returns a parameter formatted depending on the database type
Prepare Sends a query to the server for optimization prior to execution.
QuoteStr Quote a string depending on the database type
SendConnectEvent Send a connect event to all the datasets, both for connecting and disconnecting

Defined in class Component

dumpChildrenJavascript Dumps the javascript code for all the children
dumpFormItems Dumps code just after the form tag, useful to dump hidden fields for state retrieving for non visible components
dumpHeaderCode Dumps header code required
dumpJavascript Dumps the javascript code needed by this component
hasValidDataField Returns true if a valid data field is attached to the component
init Initializes a component
loaded Initializes the component after the form file has been read into memory.
loadedChildren Calls childrens loaded
preinit Method called before init()
serializeChildren Serializes all children
unserializeChildren Unserializes all children by calling unserialize for all the components

Defined in class Persistent

serialize Stores this object into the session.
unserialize This method uses PHP reflection to iterate through published properties (the ones starting with get) and retrieve the properties stored by a previous serialize() call.

Defined in class Object

__construct Constructs an object and initializes its data before the object is first used.
className Returns a string indicating the type of the object instance (as opposed to the type of the variable passed as an argument).
classParent Returns the type of the immediate ancestor of a class.

Constructor __construct (line 348)

CustomConnection __construct( [ $aowner = null])

Overrides : Component::__construct() Component constructor


Method BeginTrans (line 124)

void BeginTrans( )

Begins a new transaction against the database server.

Call BeginTrans to begin a new transaction against the database server.

Updates, insertions, and deletions that take place after a call to StartTransaction are held by the server until an application calls CompleteTrans with true to commit the changes or false to Rollback

Info

  • see - completeTrans

Method Close (line 380)

void Close( )

Closes the connection.

Call Close to disconnect from the remote source of database information. Before the connection component is deactivated, all associated datasets are closed. Calling Close is the same as setting the Connected property to false.

Info


Method CompleteTrans (line 150)

bool CompleteTrans( [bool $autocomplete = true])

Permanently stores updates, insertions, and deletions of data associated with

the current transaction, and ends the current transactions, but if false is sent in the autocomplete parameter, then a rollback is performed and then Cancels all updates, insertions, and deletions for the current transaction and ends the transaction.

Call CompleteTrans to permanently store to the database server all updates, insertions, and deletions of data associated with the current transaction and then end the transaction. The current transaction is the last transaction started by calling BeginTrans.

If you send false on the autocomplete parameter, then it cancels all updates, insertions, and deletions for the current transaction and to end the transaction. The current transaction is the last transaction started by calling BeginTrans.

Parameters

  • bool $autocomplete: If true, the transaction will be commited, if false, will be rolled back

Info

  • see - beginTrans

Method DBDate (line 190)

string DBDate( string $input)

Returns a date formatted to be used on this database, depending on the type

You must use this method to get a data formatted in a valid format depending on the type of database.

Parameters

  • string $input: Date to convert

Info

  • return - Date converted to a valid format
  • see - param, quoteStr

Method DoConnect (line 457)

void DoConnect( )

Provides the interface for a method that opens a connection.

The Connected property uses DoConnect to establish a connection. Descendant classes override the DoConnect method to establish their connection as appropriate. As implemented in CustomConnection, DoConnect does nothing.

Info


Method DoDisconnect (line 471)

void DoDisconnect( )

Provides the interface for a method that terminates the connection.

The Connected property uses DoDisconnect to close a connection. Descendant classes override the DoDisconnect method to drop a connection. As implemented in CustomConnection, DoDisconnect does nothing.

Info


Method loaded (line 386)

void loaded( )

Overrides : Component::loaded() Initializes the component after the form file has been read into memory.


Method MetaFields (line 109)

array MetaFields( string $tablename)

Returns the fieldnames for the table

Use this method to get an array with the fieldnames for an specific table. This method can be useful if you want to explore the structure of a table.

Parameters

  • string $tablename: Table to get the fields for

Info

  • return - Array with fieldnames for $tablename

Method Open (line 365)

void Open( )

Opens the connection.

Call Open to establish a connection to the remote source of database information. Open sets the Connected property to true.

Info


Method Param (line 225)

string Param( string $input)

Returns a parameter formatted depending on the database type

When writting parametrized queries, use this method to get a parameter formatted in a valid format for the current database type.

Parameters

  • string $input: Parameter name

Info


Method Prepare (line 209)

void Prepare( string $query)

Sends a query to the server for optimization prior to execution.

Call Prepare to have a remote database server allocate resources for the query and to perform additional optimizations.

If the query will only be executed once, the application does not need to explicitly call Prepare. Executing an unprepared query generates these calls automatically. However, if the same query is to be executed repeatedly, it is more efficient to prevent these automatic calls by calling Prepare explicitly.

Parameters

  • string $query: SQL sentence to be prepared

Method QuoteStr (line 241)

string QuoteStr( string $input)

Quote a string depending on the database type

When writting queries, use this method to get a string quoted in a format valid for the current database type.

Parameters

  • string $input: String to quote

Info

  • return - quoted with valid quotes
  • see - param, dbDate

Method SendConnectEvent (line 167)

void SendConnectEvent( $connecting $connecting)

Send a connect event to all the datasets, both for connecting and disconnecting

This is an internal method used to fire a dataset connect event to all attached datasets.

Parameters

  • $connecting $connecting: boolean specifies the status of the connection

Info


Events

Summary:
OnCustomConnect
OnAfterConnect Occurs after a connection is established.
OnAfterDisconnect Occurs after the connection closes.
OnBeforeConnect Occurs immediately before establishing a connection.
OnBeforeDisconnect Occurs immediately before the connection closes.
OnLogin Occurs when an application connects to a database.

property OnCustomConnect (line 293)

void OnCustomConnect


property OnAfterConnect (line 270)

mixed OnAfterConnect

Occurs after a connection is established.

Write an OnAfterConnect event handler to take application-specific actions immediately after the connection component opens a connection to the remote source of database information.

Info


property OnAfterDisconnect (line 309)

mixed OnAfterDisconnect

Occurs after the connection closes.

Write an OnAfterDisconnect event handler to take application-specific actions after the connection component drops a connection.

Info


property OnBeforeConnect (line 287)

mixed OnBeforeConnect

Occurs immediately before establishing a connection.

Write a OnBeforeConnect event handler to take application-specific actions before the connection component opens a connection to the remote source of database information.

Info


property OnBeforeDisconnect (line 325)

mixed OnBeforeDisconnect

Occurs immediately before the connection closes.

Write a BeforeDisconnect event handler to take application-specific actions before dropping a connection.

Info


property OnLogin (line 344)

mixed OnLogin

Occurs when an application connects to a database.

Write an OnLogin event handler to take specific actions when an application attempts to connect to a database.

If there is no OnLogin event handler, the current UserName and Password are the ones used from the UserName and UserPassword properties.

These values are then passed to the remote server.


Javascript Events

Summary:

[none]

Documentation generated on Fri, 26 Dec 2008 11:44:35 +0100 by phpDocumentor 1.4.0a2