Database

From HTML5 Builder
Jump to: navigation, search

The Database component contains information about a real database which lets your application work with that database. You will find this component in the Tool Palette, under the Data Access section.

Configuration

To get your Database component working, configure at least the following mandatory properties: DriverName, DatabaseName, Host, User, and Password.

Note: For certain DBMS, either the DatabaseName or the Host properties might be optional. You should read the documentation for yours.

Usage

Data Dictionary

A data dictionary defines database metadata, such as table names or field display names. That metadata might be used by some data-aware components, affecting the way they are displayed.

If you have a data dictionary on your DBMS, you can give Database’s Dictionary property the identifier of that dictionary, so it can be used by the component and any other component using the Database. Else, you can define custom dictionary properties from PHP, using Database’s DictionaryProperties property:

Note: You should run this code on the OnBeforeShow event of your top-level container.

function PageBeforeShow($sender, $params)
{
  $properties = array();
  $properties['table']['field'] = array('displaylabel' => array('Field Display Name'));
  $this->Database->DictionaryProperties = $properties;
}

This would set the display name of the field field of the table table to Field Display Name.

Server-side Features

Properties, Methods and Events

Documented in the RPCL Reference.

Help Resources

Frequently Encountered Problems

Values are returned with the wrong character encoding

You can specify the character encoding to be used for the values retrieved from the database through the ConnectionParams property of the Database component. Open its property editor, and add a new entry with the key name charset and the target character encoding as value (e.g. utf8).