Object | --Persistent | --Component | --CustomConnection
Located in File: /db.inc.php
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.
![]() | 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)
property Connected (line 414)
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.
property DataSets (line 93)
Use DataSets to access active datasets associated with a database component. An active dataset is one that is currently open.
property Name
property Tag
property ComponentCount
property Components
property ControlState
property DataFieldValue
property NamePath
property Owner
property NamePath
| __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)
Overrides : Component::__construct() Component constructor
Method BeginTrans (line 124)
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
Method Close (line 380)
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.
Method CompleteTrans (line 150)
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.
Method DBDate (line 190)
You must use this method to get a data formatted in a valid format depending on the type of database.
Method DoConnect (line 457)
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.
Method DoDisconnect (line 471)
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.
Method loaded (line 386)
Overrides : Component::loaded() Initializes the component after the form file has been read into memory.
Method MetaFields (line 109)
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.
Method Open (line 365)
Call Open to establish a connection to the remote source of database information. Open sets the Connected property to true.
Method Param (line 225)
When writting parametrized queries, use this method to get a parameter formatted in a valid format for the current database type.
Method Prepare (line 209)
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.
Method QuoteStr (line 241)
When writting queries, use this method to get a string quoted in a format valid for the current database type.
Method SendConnectEvent (line 167)
This is an internal method used to fire a dataset connect event to all attached datasets.
![]() | 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)
property OnAfterConnect (line 270)
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.
property OnAfterDisconnect (line 309)
Write an OnAfterDisconnect event handler to take application-specific actions after the connection component drops a connection.
property OnBeforeConnect (line 287)
Write a OnBeforeConnect event handler to take application-specific actions before the connection component opens a connection to the remote source of database information.
property OnBeforeDisconnect (line 325)
Write a BeforeDisconnect event handler to take application-specific actions before dropping a connection.
property OnLogin (line 344)
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.