Differences

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

Link to this comparison view

Next revision
Previous revision
integration:rdbms:mysql:tables [2011/04/05 02:53]
127.0.0.1 external edit
integration:rdbms:mysql:tables [2016/06/28 22:38] (current)
Line 23: Line 23:
 === The CREATE TABLE Statement === === The CREATE TABLE Statement ===
  
-The [[dev:​sql:​statements:​create_table:​home|CREATE TABLE]] statement is used to declare ​an MySQL table or view within an Omnidex Environment File.  The Omnidex Environment File will contain a declaration for each MySQL table or view to be accessed, and will correlate all of the schema information between Omnidex and MySQL, including object names and datatypes. This statement can either be issued directly, or it can be extracted from MySQL using the EXTRACT statement as discussed in the previous section.+The [[dev:​sql:​statements:​create_table:​home|CREATE TABLE]] statement is used to declare ​MySQL table or view within an Omnidex Environment File.  The Omnidex Environment File will contain a declaration for each MySQL table or view to be accessed, and will correlate all of the schema information between Omnidex and MySQL, including object names and datatypes. This statement can either be issued directly, or it can be extracted from MySQL using the EXTRACT statement as discussed in the previous section.
  
 The following example compares the MySQL declarations with the Omnidex declarations.  ​ The following example compares the MySQL declarations with the Omnidex declarations.  ​
Line 32: Line 32:
 create table STATES create table STATES
        ​(STATE_CD ​               CHAR(2),        ​(STATE_CD ​               CHAR(2),
-        DESCRIPTION ​            VARCHAR2(31),+        DESCRIPTION ​            VARCHAR(31),
         STATE_NUM ​              ​CHAR(2),​         STATE_NUM ​              ​CHAR(2),​
         REGION_CD ​              ​CHAR(2),​         REGION_CD ​              ​CHAR(2),​
         COUNTRY_CD ​             CHAR(2),         COUNTRY_CD ​             CHAR(2),
-        TAX_RATE ​               ​NUMBER(16,​6));+        TAX_RATE ​               ​DOUBLE);
 </​code>​ </​code>​
  
Line 43: Line 43:
 <​code>​ <​code>​
 create table          "​STATES"​ create table          "​STATES"​
- ​physical ​            "​SIMPLE.STATES"​+ ​physical ​            "​STATES"​
  (  (
   "​STATE" ​            ​CHARACTER(2) ​  ​physical "​STATE_CD",​   "​STATE" ​            ​CHARACTER(2) ​  ​physical "​STATE_CD",​
Line 55: Line 55:
 </​code>​ </​code>​
  
-In the Omnidex declaration,​ note that the PHYSICAL clause for table points ​to the MySQL syntax of //user.table//.  ​Also note that the columns use the PHYSICAL clause to point to the underlying MySQL column name, and use Omnidex datatypes rather ​than MySQL datatypes.+=== Using the Table and Column PHYSICAL Clauses === 
 + 
 +In the Omnidex declaration,​ note that the optional ​PHYSICAL clause for the table allows Omnidex ​to have a different table name than MySQL. ​This is most commonly used when administrators wish a different name in the Omnidex environment or need to shorten a table name to meet the 32-character limit in Omnidex.  ​If the PHYSICAL clause is not present, Omnidex assumes ​that the table names are the same between Omnidex and MySQL. 
 + 
 +Column declarations can similarly use a PHYSICAL clause to allow Omnidex ​to have a different ​column name than MySQL. ​  
  
 === Modifying Omnidex'​s View of the MySQL Data Objects === === Modifying Omnidex'​s View of the MySQL Data Objects ===
Line 61: Line 66:
 When Omnidex accesses a table, it only knows about the data objects that are declared in the Omnidex Environment File.  It does not have an independent understanding of the MySQL environment. ​ This allows administrators to shape the Omnidex Environment the way they want.  Some of the opportunities this provides are: When Omnidex accesses a table, it only knows about the data objects that are declared in the Omnidex Environment File.  It does not have an independent understanding of the MySQL environment. ​ This allows administrators to shape the Omnidex Environment the way they want.  Some of the opportunities this provides are:
  
-  * Omnidex can have a controlled view of the MySQL database, limited to only the tables ​and  ​columns that the application requires.+  * Omnidex can have a controlled view of the MySQL database, limited to only the tables ​that the application requires. ​ Similarly, administrators can choose to include only the columns ​for each table that the application requires.
   * Omnidex tables can point to MySQL views, allowing an easy approach to reshaping the application'​s view of the data.   * Omnidex tables can point to MySQL views, allowing an easy approach to reshaping the application'​s view of the data.
   * Omnidex can use different names for tables and columns by using the PHYSICAL clause in the TABLE or COLUMN sections of the CREATE TABLE statement to map to the underlying MySQL names.   * Omnidex can use different names for tables and columns by using the PHYSICAL clause in the TABLE or COLUMN sections of the CREATE TABLE statement to map to the underlying MySQL names.
- for the MySQL tables and columns by using the respective PHYSICAL clause to  
-  * Omnidex columns can often be assigned datatypes that differ from the MySQL datatype. ​ Character-class datatypes can be interchanged,​ allowing applications to easily receive the datatype that works best for its needs. ​ Binary datatypes can be assigned to any of the integer or floating point datatypes; in fact, this is a necessity since MySQL'​s NUMBER datatype is only an internal datatype.  ​ 
   * Omnidex tables can include [[admin:​features:​expressioncols:​home|Expression-based Columns]], which are columns derived from a SQL expression rather than a specific column in the underlying database.   * Omnidex tables can include [[admin:​features:​expressioncols:​home|Expression-based Columns]], which are columns derived from a SQL expression rather than a specific column in the underlying database.
  
Line 72: Line 75:
 Omnidex table declarations can reference MySQL Views. ​ Omnidex will retrieve from the MySQL view just as though it is a table. ​ MySQL Views can be used to provide different views of the data, appropriate for the application. Omnidex table declarations can reference MySQL Views. ​ Omnidex will retrieve from the MySQL view just as though it is a table. ​ MySQL Views can be used to provide different views of the data, appropriate for the application.
  
-When referencing ​an MySQL view, it is necessary to declare a UNIQUE constraint. ​ This requirement for the UNIQUE constraint is independent of any PRIMARY or FOREIGN constraintsdiscussed in the next page.  The UNIQUE constraint tells Omnidex how to uniquely identify a row.  When Omnidex retrieves individual rows, it will use this unique value; therefore, it is important that access to this column (or columns) be properly indexed in the underlying table.  ​+When referencing ​MySQL view, it is necessary to declare a UNIQUE constraint. ​ This requirement for the UNIQUE constraint is independent of any PRIMARY or FOREIGN constraints discussed in the next page.  The UNIQUE constraint tells Omnidex how to uniquely identify a row.  When Omnidex retrieves individual rows, it will use this unique value. Therefore, it is important that access to this column (or columns) be properly indexed in the underlying table.  ​
  
 **MySQL CREATE VIEW Statement** **MySQL CREATE VIEW Statement**
Line 102: Line 105:
 <​code>​ <​code>​
 create table          "​STATES_VIEW"​ create table          "​STATES_VIEW"​
- ​physical ​            "​SIMPLE.STATES_VIEW"​+ ​physical ​            "​STATES_VIEW"​
  (  (
   "​CTRY_DESCRIPTION" ​ STRING(47),   "​CTRY_DESCRIPTION" ​ STRING(47),
 
Back to top
integration/rdbms/mysql/tables.1301971997.txt.gz · Last modified: 2016/06/28 22:38 (external edit)