ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:structure:introduction

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
v5:dictionary:structure:introduction [2016/04/10 02:39] mnewnhamv5:dictionary:structure:introduction [2021/08/26 10:11] (current) – typos peterdd
Line 15: Line 15:
 From ADOdb Version 5.21, A new method of managing changes to the schema has been added. This method is called //**Structured**// schema management to signify the more formal method of managing elements. The original method, referred to as //**Simple**//, remains unchanged. From ADOdb Version 5.21, A new method of managing changes to the schema has been added. This method is called //**Structured**// schema management to signify the more formal method of managing elements. The original method, referred to as //**Simple**//, remains unchanged.
  
-In Structured schema management, the elements that can be modified through the dictionary management routines such as [[v5:dictionary:createindexsql|createIndexSql()]],[[v5:dictionary:dropcolumnsql|dropSql()]] and [[v5:dictionary:createtablesql|createtableSql()]] can be created and represented as objects prior to them being passed to the methods that create the SQL necessary to create them in the database. The concept is built on [[v5:axmls:axmls_index|AXMLS]] and contains some feature overlap.+In Structured schema management, the elements that can be modified through the dictionary management routines such as [[v5:dictionary:createindexsql|createIndexSql()]], [[v5:dictionary:dropcolumnsql|dropColumnSql()]] and [[v5:dictionary:createtablesql|createTableSql()]] can be created and represented as objects prior to them being passed to the methods that create the SQL necessary to create them in the database. The concept is built on [[v5:axmls:axmls_index|AXMLS]] and contains some feature overlap.
  
 These objects can then be easily stored through the use of technologies such as JSON, which can easily be manipulated through 3rd party tools and reprocessed.  These objects can then be easily stored through the use of technologies such as JSON, which can easily be manipulated through 3rd party tools and reprocessed. 
  
-Each tableand element of a table (such as a column or index) is represented by a PHP object called a //**metaObjectStructure**//. Each of these objects can store an unlimited number of additional attributes that represent configuration items for the element. The attributes themselves can be defined as platform-specific.+Each table and element of a table (such as a column or index) is represented by a PHP object called a //**metaObjectStructure**//. Each of these objects can store an unlimited number of additional attributes that represent configuration items for the element. The attributes themselves can be defined as platform-specific.
  
 ===== Construction Of The Structure ===== ===== Construction Of The Structure =====
Line 44: Line 44:
 The structure is not automatically sent to createTableSql, it must be deliberately passed on. This is important because it allows the returned object be to re-used or stored, for example by serializing or JSON-encoding it. Conceivably, a JSON-encoded object could be passed in by a 3rd party application and used. The structure is not automatically sent to createTableSql, it must be deliberately passed on. This is important because it allows the returned object be to re-used or stored, for example by serializing or JSON-encoding it. Conceivably, a JSON-encoded object could be passed in by a 3rd party application and used.
  
-In this example, we create a table 'TEST' with a single column 'COL1', and extract the structure+In this example, we create a table 'test' with a single column 'COL1', and extract the structure
  
 <code php> <code php>
 $dict = newDataDictionary($db); $dict = newDataDictionary($db);
-$t = new metaObjectStructure($dict,'test');+$t = new metaObjectStructure($dict, 'test');
 /* /*
 * Make sure the table is transactional in MySQL * Make sure the table is transactional in MySQL
 */ */
-$t->addAttribute('ENGINE INNODB','mysql');+$t->addAttribute('ENGINE INNODB', 'mysql');
  
 /* /*
 * Add the column * Add the column
 */ */
-$t->addColumnObject('COL1','I');+$t->addColumnObject('COL1', 'I');
  
 /* /*
v5/dictionary/structure/introduction.1460248768.txt.gz · Last modified: 2017/04/21 11:29 (external edit)