ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


Action unknown: siteexport_addpage
v5:dictionary:structure:platform

Platform

From Version 5.21.0-beta-2

See Also

Structured Schema Management
Column Attributes Reference

The keyword Platform is part of the Structured Schema Management suite, and indicates if the application of a metaStructure object or platform should be applied to a specific DBMS.

The Platform parameter can match one of the 3 values

NULL or Net Set

This is the default setting, and means that the object or attribute should be applied to all DBMS systems that the structure is applied to.

The Data Provider

For ADOdb, a data provider is the base class that the database type is derived from. For example, for ODBC connections, the data provider is odbc, and the driver may be odbc_mysql,odbc_mssql,odbc_mssql2012 etc.

To identify the Data Provider for the connection type you are using, check the ADOdb page for the driver.

Use of the Data Provider to match a database is the optimal method. If used, it matches all the database types that are derived from provider, so if a new database type is added to ADOdb, a data provider match will work without modification of the code.

The Driver Type

The database type is the value used in the adoNewConnection statement. If used, the platform will only match the provided parameter.

Usage

In the following example, a table employees is to be created. The table is to be used in a portable environment, and require 2 platform specific attribute.

  1. Under MySQL, an engine type needs to be specified. The mysql option matches the Data Provider, and will be used if the database type is mysqli, mysqlt, or similar.
  2. Under IBM DB2, a tablespace needs to be specified. The db2 option matches the Driver Type, and will only be used if the driver type matches the provided values.
$t = new metaObjectStructure($dict,'employees');
 
$t->addAttribute('ENGINE INNODB','mysql');
 
/*
* Add another platform option, for IBM DB2
*/
$t->addAttribute(array('TABLESPACE'=>'LARGE1'),'db2');

Alternatively, we can write the definition as:

$t = new metaObjectStructure($dict,'employees');
 
$t->addAttribute('ENGINE INNODB','mysql')
  ->addAttribute(array('TABLESPACE'=>'LARGE1'),'db2');
v5/dictionary/structure/platform.txt · Last modified: 2016/04/09 20:21 by mnewnham