MDB2_Schema
[ class tree: MDB2_Schema ] [ index: MDB2_Schema ] [ all elements ]

Source for file Parser.php

Documentation is available at Parser.php

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PHP versions 4 and 5                                                 |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1998-2004 Manuel Lemos, Tomas V.V.Cox,                 |
  6. // | Stig. S. Bakken, Lukas Smith                                         |
  7. // | All rights reserved.                                                 |
  8. // +----------------------------------------------------------------------+
  9. // | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB  |
  10. // | API as well as database abstraction for PHP applications.            |
  11. // | This LICENSE is in the BSD license style.                            |
  12. // |                                                                      |
  13. // | Redistribution and use in source and binary forms, with or without   |
  14. // | modification, are permitted provided that the following conditions   |
  15. // | are met:                                                             |
  16. // |                                                                      |
  17. // | Redistributions of source code must retain the above copyright       |
  18. // | notice, this list of conditions and the following disclaimer.        |
  19. // |                                                                      |
  20. // | Redistributions in binary form must reproduce the above copyright    |
  21. // | notice, this list of conditions and the following disclaimer in the  |
  22. // | documentation and/or other materials provided with the distribution. |
  23. // |                                                                      |
  24. // | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,    |
  25. // | Lukas Smith nor the names of his contributors may be used to endorse |
  26. // | or promote products derived from this software without specific prior|
  27. // | written permission.                                                  |
  28. // |                                                                      |
  29. // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
  30. // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT    |
  31. // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS    |
  32. // | FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE      |
  33. // | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,          |
  34. // | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
  35. // | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
  36. // |  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED  |
  37. // | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT          |
  38. // | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
  39. // | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          |
  40. // | POSSIBILITY OF SUCH DAMAGE.                                          |
  41. // +----------------------------------------------------------------------+
  42. // | Author: Christian Dickmann <dickmann@php.net>                        |
  43. // +----------------------------------------------------------------------+
  44. //
  45. // $Id: Parser.php,v 1.8 2005/04/26 07:11:33 lsmith Exp $
  46. //
  47.  
  48. require_once 'XML/Parser.php';
  49.  
  50. /**
  51.  * Parses an XML schema file
  52.  *
  53.  * @package MDB2_Schema
  54.  * @category Database
  55.  * @access protected
  56.  * @author  Christian Dickmann <dickmann@php.net>
  57.  */
  58. class MDB2_Schema_Parser extends XML_Parser
  59. {
  60.     var $database_definition = array();
  61.     var $elements = array();
  62.     var $element = '';
  63.     var $count = 0;
  64.     var $table = array();
  65.     var $table_name = '';
  66.     var $field = array();
  67.     var $field_name = '';
  68.     var $init = array();
  69.     var $init_name = '';
  70.     var $init_value = '';
  71.     var $index = array();
  72.     var $index_name = '';
  73.     var $var_mode = false;
  74.     var $variables = array();
  75.     var $seq = array();
  76.     var $seq_name = '';
  77.     var $error = null;
  78.  
  79.     var $invalid_names = array(
  80.         'user' => array(),
  81.         'is' => array(),
  82.         'file' => array(
  83.             'oci' => array(),
  84.             'oracle' => array()
  85.         ),
  86.         'notify' => array(
  87.             'pgsql' => array()
  88.         ),
  89.         'restrict' => array(
  90.             'mysql' => array()
  91.         ),
  92.         'password' => array(
  93.             'ibase' => array()
  94.         )
  95.     );
  96.     var $fail_on_invalid_names = true;
  97.     var $structure = false;
  98.  
  99.     function MDB2_Schema_Parser($variables$fail_on_invalid_names = true$structure = false)
  100.     {
  101.         $this->XML_Parser();
  102.         $this->variables = $variables;
  103.         $this->fail_on_invalid_names = $fail_on_invalid_names;
  104.         $this->structure = $structure;
  105.     }
  106.  
  107.     function startHandler($xp$element$attribs)
  108.     {
  109.         if (strtolower($element== 'variable'{
  110.             $this->var_mode = true;
  111.             return;
  112.         }
  113.  
  114.         $this->elements[$this->count++strtolower($element);
  115.         $this->element = implode('-'$this->elements);
  116.  
  117.         switch ($this->element{
  118.         case 'database-table-initialization-insert':
  119.             $this->init = array('type' => 'insert');
  120.             break;
  121.         case 'database-table-initialization-insert-field':
  122.             $this->init_name = '';
  123.             $this->init_value = '';
  124.             break;
  125.         case 'database-table':
  126.             $this->table_name = '';
  127.             $this->table = array();
  128.             break;
  129.         case 'database-table-declaration-field':
  130.             $this->field_name = '';
  131.             $this->field = array();
  132.             break;
  133.         case 'database-table-declaration-field-default':
  134.             $this->field['default''';
  135.             break;
  136.         case 'database-table-declaration-index':
  137.             $this->index_name = '';
  138.             $this->index = array();
  139.             break;
  140.         case 'database-sequence':
  141.             $this->seq_name = '';
  142.             $this->seq = array();
  143.             break;
  144.         case 'database-table-declaration-index-field':
  145.             $this->field_name = '';
  146.             $this->field = array();
  147.             break;
  148.         }
  149.     }
  150.  
  151.     function endHandler($xp$element)
  152.     {
  153.         if (strtolower($element== 'variable'{
  154.             $this->var_mode = false;
  155.             return;
  156.         }
  157.  
  158.         switch ($this->element{
  159.         /* Initialization */
  160.         case 'database-table-initialization-insert-field':
  161.             if (!$this->init_name{
  162.                 $this->raiseError('field-name has to be specified'null$xp);
  163.             }
  164.             if (isset($this->init['fields'][$this->init_name])) {
  165.                 $this->raiseError('field "'.$this->init_name.'" already filled'null$xp);
  166.             }
  167.             if (!isset($this->table['fields'][$this->init_name])) {
  168.                 $this->raiseError('unkown field "'.$this->init_name.'"'null$xp);
  169.             }
  170.             if ($this->init_value !== ''
  171.                 && !$this->validateFieldValue($this->init_name$this->init_value$xp)
  172.             {
  173.                 $this->raiseError('field "'.$this->init_name.'" has wrong value'null$xp);
  174.             }
  175.             $this->init['fields'][$this->init_name$this->init_value;
  176.             break;
  177.         case 'database-table-initialization-insert':
  178.             $this->table['initialization'][$this->init;
  179.             break;
  180.  
  181.         /* Table definition */
  182.         case 'database-table':
  183.             if (!isset($this->table['was'])) {
  184.                 $this->table['was'$this->table_name;
  185.             }
  186.             if (!$this->table_name{
  187.                 $this->raiseError('tables need names'null$xp);
  188.             }
  189.             if (isset($this->database_definition['tables'][$this->table_name])) {
  190.                 $this->raiseError('table "'.$this->table_name.'" already exists'null$xp);
  191.             }
  192.             if (!isset($this->table['fields'])) {
  193.                 $this->raiseError('tables need one or more fields'null$xp);
  194.             }
  195.             if (isset($this->table['indexes'])) {
  196.                 foreach ($this->table['indexes'as $index{
  197.                     foreach ($index['fields'as $field_name => $field{
  198.                         if (!isset($this->table['fields'][$field_name])) {
  199.                             $this->raiseError('index field "'.$field_name.'" does not exist'null$xp);
  200.                         }
  201.                     }
  202.                 }
  203.             }
  204.             $this->database_definition['tables'][$this->table_name$this->table;
  205.             break;
  206.  
  207.         /* Field declaration */
  208.         case 'database-table-declaration-field':
  209.             if (!$this->field_name || !isset($this->field['type'])) {
  210.                 $this->raiseError('field "'.$this->field_name.'" was not properly specified'null$xp);
  211.             }
  212.             if (isset($this->table['fields'][$this->field_name])) {
  213.                 $this->raiseError('field "'.$this->field_name.'" already exists'null$xp);
  214.             }
  215.             /* Invalidname check */
  216.             if ($this->fail_on_invalid_names && isset($this->invalid_names[$this->field_name])) {
  217.                 $this->raiseError('fieldname "'.$this->field_name.'" not allowed'null$xp);
  218.             }
  219.             /* Type check */
  220.             switch ($this->field['type']{
  221.             case 'integer':
  222.                 if (isset($this->field['unsigned'])
  223.                     && $this->field['unsigned'!== '1' && $this->field['unsigned'!== '0'
  224.                 {
  225.                     $this->raiseError('unsigned has to be 1 or 0'null$xp);
  226.                 }
  227.                 break;
  228.             case 'text':
  229.             case 'clob':
  230.             case 'blob':
  231.                 if (isset($this->field['length']&& ((int)$this->field['length']<= 0{
  232.                     $this->raiseError('length has to be an integer greater 0'null$xp);
  233.                 }
  234.                 break;
  235.             case 'boolean':
  236.             case 'date':
  237.             case 'timestamp':
  238.             case 'time':
  239.             case 'float':
  240.             case 'decimal':
  241.                 break;
  242.             default:
  243.                 $this->raiseError('no valid field type ("'.$this->field['type'].'") specified'null$xp);
  244.             }
  245.             if (!isset($this->field['was'])) {
  246.                 $this->field['was'$this->field_name;
  247.             }
  248.             if (isset($this->field['notnull']&& !$this->isBoolean($this->field['notnull'])) {
  249.                 $this->raiseError('field "notnull" has to be 1 or 0'null$xp);
  250.             }
  251.             if (isset($this->field['notnull']&& !isset($this->field['default'])) {
  252.                 $this->raiseError('if field is "notnull", it needs a default value'null$xp);
  253.             }
  254.             if (isset($this->field['unsigned']&& !$this->isBoolean($this->field['unsigned'])) {
  255.                 $this->raiseError('field "notnull" has to be 1 or 0'null$xp);
  256.             }
  257.             $this->table['fields'][$this->field_name$this->field;
  258.             if (isset($this->field['default'])) {
  259.                 if ($this->field['type'== 'clob' || $this->field['type'== 'blob'{
  260.                     $this->raiseError('"'.$this->field['type'].
  261.                         '"-fields are not allowed to have a default value'null$xp);
  262.                 }
  263.                 if ($this->field['default'!== ''
  264.                     && !$this->validateFieldValue($this->field_name$this->field['default']$xp)
  265.                 {
  266.                     $this->raiseError('default value of "'.$this->field_name.'" is of wrong type'null$xp);
  267.                 }
  268.             }
  269.             break;
  270.  
  271.         /* Index declaration */
  272.         case 'database-table-declaration-index':
  273.             if (!$this->index_name{
  274.                 $this->raiseError('an index needs a name'null$xp);
  275.             }
  276.             if (isset($this->table['indexes'][$this->index_name])) {
  277.                 $this->raiseError('index "'.$this->index_name.'" already exists'null$xp);
  278.             }
  279.             if (isset($this->index['unique']&& !$this->isBoolean($this->index['unique'])) {
  280.                 $this->raiseError('field "unique" has to be 1 or 0'null$xp);
  281.             }
  282.             if (!isset($this->index['was'])) {
  283.                 $this->index['was'$this->index_name;
  284.             }
  285.             $this->table['indexes'][$this->index_name$this->index;
  286.             break;
  287.         case 'database-table-declaration-index-field':
  288.             if (!$this->field_name{
  289.                 $this->raiseError('the index-field-name is required'null$xp);
  290.             }
  291.             if (isset($this->field['sorting'])
  292.                 && $this->field['sorting'!== 'ascending' && $this->field['sorting'!== 'descending'{
  293.                 $this->raiseError('sorting type unknown'null$xp);
  294.             }
  295.             $this->index['fields'][$this->field_name$this->field;
  296.             break;
  297.         case 'database-table-name':
  298.             if (isset($this->structure['tables'][$this->table_name])) {
  299.                 $this->table = $this->structure['tables'][$this->table_name];
  300.             }
  301.             break;
  302.  
  303.         /* Sequence declaration */
  304.         case 'database-sequence':
  305.             if (!$this->seq_name{
  306.                 $this->raiseError('a sequence has to have a name'null$xp);
  307.             }
  308.             if (isset($this->database_definition['sequences'][$this->seq_name])) {
  309.                 $this->raiseError('sequence "'.$this->seq_name.'" already exists'null$xp);
  310.             }
  311.             if (!isset($this->seq['was'])) {
  312.                 $this->seq['was'$this->seq_name;
  313.             }
  314.             if (isset($this->seq['on'])) {
  315.                 if ((!isset($this->seq['on']['table']|| !$this->seq['on']['table'])
  316.                     || (!isset($this->seq['on']['field']|| !$this->seq['on']['field'])
  317.                 {
  318.                     $this->raiseError('sequence "'.$this->seq_name.
  319.                         '" was not properly defined'null$xp);
  320.                 }
  321.             }
  322.             $this->database_definition['sequences'][$this->seq_name$this->seq;
  323.             break;
  324.  
  325.         /* End of File */
  326.         case 'database':
  327.             if (isset($this->database_definition['create'])
  328.                 && !$this->isBoolean($this->database_definition['create'])
  329.             {
  330.                 $this->raiseError('field "create" has to be 1 or 0'null$xp);
  331.             }
  332.             if (isset($this->database_definition['overwrite'])
  333.                 && !$this->isBoolean($this->database_definition['overwrite'])
  334.             {
  335.                 $this->raiseError('field "overwrite" has to be 1 or 0'null$xp);
  336.             }
  337.             if (!isset($this->database_definition['name'])
  338.                 || !$this->database_definition['name']
  339.             {
  340.                 $this->raiseError('database needs a name'null$xp);
  341.             }
  342.             if (isset($this->database_definition['sequences'])) {
  343.                 foreach ($this->database_definition['sequences'as $seq_name => $seq{
  344.                     if (isset($seq['on'])
  345.                         && !isset($this->database_definition['tables'][$seq['on']['table']]['fields'][$seq['on']['field']])
  346.                     {
  347.                         $this->raiseError('sequence "'.$seq_name.
  348.                             '" was assigned on unexisting field/table'null$xp);
  349.                     }
  350.                 }
  351.             }
  352.             if (PEAR::isError($this->error)) {
  353.                 $this->database_definition = $this->error;
  354.             }
  355.             break;
  356.         }
  357.  
  358.         unset($this->elements[--$this->count]);
  359.         $this->element = implode('-'$this->elements);
  360.     }
  361.  
  362.     function validateFieldValue($field_name&$field_value&$xp)
  363.     {
  364.         if (!isset($this->table['fields'][$field_name])) {
  365.             return $this->raiseError('"'.$field_name.'" is not defined'null$xp);
  366.  
  367.         }
  368.         $field_def $this->table['fields'][$field_name];
  369.         switch ($field_def['type']{
  370.         case 'text':
  371.         case 'clob':
  372.             if (isset($field_def['length']&& strlen($field_value$field_def['length']{
  373.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  374.                     $field_def['type'].'"'null$xp);
  375.             }
  376.             break;
  377.         case 'blob':
  378.             /*
  379.             if (!preg_match('/^([0-9a-f]{2})*$/i', $field_value)) {
  380.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  381.                     $field_def['type'].'"', null, $xp);
  382.             }
  383.             */
  384.             $field_value pack('H*'$field_value);
  385.             if (isset($field_def['length']&& strlen($field_value$field_def['length']{
  386.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  387.                     $field_def['type'].'"'null$xp);
  388.             }
  389.             break;
  390.         case 'integer':
  391.             if ($field_value != ((int)$field_value)) {
  392.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  393.                     $field_def['type'].'"'null$xp);
  394.             }
  395.             $field_value = (int) $field_value;
  396.             if (isset($field_def['unsigned']&& $field_def['unsigned'&& $field_value < 0{
  397.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  398.                     $field_def['type'].'"'null$xp);
  399.             }
  400.             break;
  401.         case 'boolean':
  402.             if (!$this->isBoolean($field_value)) {
  403.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  404.                     $field_def['type'].'"'null$xp);
  405.             }
  406.             break;
  407.         case 'date':
  408.             if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/'$field_value)) {
  409.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  410.                     $field_def['type'].'"'null$xp);
  411.             }
  412.             break;
  413.         case 'timestamp':
  414.             if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/'$field_value)) {
  415.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  416.                     $field_def['type'].'"'null$xp);
  417.             }
  418.             break;
  419.         case 'time':
  420.             if (!preg_match("/([0-9]{2}):([0-9]{2}):([0-9]{2})/"$field_value)) {
  421.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  422.                     $field_def['type'].'"'null$xp);
  423.             }
  424.             break;
  425.         case 'float':
  426.         case 'double':
  427.             if ($field_value != (double) $field_value{
  428.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  429.                     $field_def['type'].'"'null$xp);
  430.             }
  431.             $field_value = (double) $field_value;
  432.             break;
  433.         }
  434.         return true;
  435.     }
  436.  
  437.     function raiseError($msg = null$ecode = 0$xp = null)
  438.     {
  439.         if (is_null($this->error)) {
  440.             $error '';
  441.             if (is_resource($msg)) {
  442.                 $error .= 'Parser error: '.xml_error_string(xml_get_error_code($msg));
  443.                 $xp $msg;
  444.             else {
  445.                 $error .= 'Parser error: '.$msg;
  446.                 if (!is_resource($xp)) {
  447.                     $xp $this->parser;
  448.                 }
  449.             }
  450.             if (($error_string xml_error_string($ecode))) {
  451.                 $error .= ' - '.$error_string;
  452.             }
  453.             if (is_resource($xp)) {
  454.                 $byte @xml_get_current_byte_index($xp);
  455.                 $line @xml_get_current_line_number($xp);
  456.                 $column @xml_get_current_column_number($xp);
  457.                 $error .= " - Byte: $byte; Line: $line; Col: $column";
  458.             }
  459.             $error .= "\n";
  460.             $this->error = MDB2::raiseError(MDB2_ERROR_MANAGER_PARSEnullnull$error);
  461.         }
  462.         return $this->error;
  463.     }
  464.  
  465.     function isBoolean(&$value)
  466.     {
  467.         if (is_int($value&& ($value == 0 || $value == 1)) {
  468.             return true;
  469.         }
  470.         if ($value === '1' || $value === '0'{
  471.             $value = (int) $value;
  472.             return true;
  473.         }
  474.         switch ($value{
  475.         case 'N':
  476.         case 'n':
  477.         case 'no':
  478.         case 'false':
  479.             $value = 0;
  480.             break;
  481.         case 'Y':
  482.         case 'y':
  483.         case 'yes':
  484.         case 'true':
  485.             $value = 1;
  486.             break;
  487.         default:
  488.             return false;
  489.         }
  490.         return true;
  491.     }
  492.  
  493.     function cdataHandler($xp$data)
  494.     {
  495.         if ($this->var_mode == true{
  496.             if (!isset($this->variables[$data])) {
  497.                 $this->raiseError('variable "'.$data.'" not found'null$xp);
  498.                 return;
  499.             }
  500.             $data $this->variables[$data];
  501.         }
  502.  
  503.         switch ($this->element{
  504.         /* Initialization */
  505.         case 'database-table-initialization-insert-field-name':
  506.             if (isset($this->init_name)) {
  507.                 $this->init_name .= $data;
  508.             else {
  509.                 $this->init_name = $data;
  510.             }
  511.             break;
  512.         case 'database-table-initialization-insert-field-value':
  513.             if (isset($this->init_value)) {
  514.                 $this->init_value .= $data;
  515.             else {
  516.                 $this->init_value = $data;
  517.             }
  518.             break;
  519.  
  520.         /* Database */
  521.         case 'database-name':
  522.             if (isset($this->database_definition['name'])) {
  523.                 $this->database_definition['name'.= $data;
  524.             else {
  525.                 $this->database_definition['name'$data;
  526.             }
  527.             break;
  528.         case 'database-create':
  529.             if (isset($this->database_definition['create'])) {
  530.                 $this->database_definition['create'.= $data;
  531.             else {
  532.                 $this->database_definition['create'$data;
  533.             }
  534.             break;
  535.         case 'database-overwrite':
  536.             if (isset($this->database_definition['overwrite'])) {
  537.                 $this->database_definition['overwrite'.= $data;
  538.             else {
  539.                 $this->database_definition['overwrite'$data;
  540.             }
  541.             break;
  542.         case 'database-table-name':
  543.             if (isset($this->table_name)) {
  544.                 $this->table_name .= $data;
  545.             else {
  546.                 $this->table_name = $data;
  547.             }
  548.             break;
  549.         case 'database-table-was':
  550.             if (isset($this->table['was'])) {
  551.                 $this->table['was'.= $data;
  552.             else {
  553.                 $this->table['was'$data;
  554.             }
  555.             break;
  556.  
  557.         /* Field declaration */
  558.         case 'database-table-declaration-field-name':
  559.             if (isset($this->field_name)) {
  560.                 $this->field_name .= $data;
  561.             else {
  562.                 $this->field_name = $data;
  563.             }
  564.             break;
  565.         case 'database-table-declaration-field-type':
  566.             if (isset($this->field['type'])) {
  567.                 $this->field['type'.= $data;
  568.             else {
  569.                 $this->field['type'$data;
  570.             }
  571.             break;
  572.         case 'database-table-declaration-field-was':
  573.             if (isset($this->field['was'])) {
  574.                 $this->field['was'.= $data;
  575.             else {
  576.                 $this->field['was'$data;
  577.             }
  578.             break;
  579.         case 'database-table-declaration-field-notnull':
  580.             if (isset($this->field['notnull'])) {
  581.                 $this->field['notnull'.= $data;
  582.             else {
  583.                 $this->field['notnull'$data;
  584.             }
  585.             break;
  586.         case 'database-table-declaration-field-unsigned':
  587.             if (isset($this->field['unsigned'])) {
  588.                 $this->field['unsigned'.= $data;
  589.             else {
  590.                 $this->field['unsigned'$data;
  591.             }
  592.             break;
  593.         case 'database-table-declaration-field-default':
  594.             if (isset($this->field['default'])) {
  595.                 $this->field['default'.= $data;
  596.             else {
  597.                 $this->field['default'$data;
  598.             }
  599.             break;
  600.         case 'database-table-declaration-field-length':
  601.             if (isset($this->field['length'])) {
  602.                 $this->field['length'.= $data;
  603.             else {
  604.                 $this->field['length'$data;
  605.             }
  606.             break;
  607.  
  608.         /* Index declaration */
  609.         case 'database-table-declaration-index-name':
  610.             if (isset($this->index_name)) {
  611.                 $this->index_name .= $data;
  612.             else {
  613.                 $this->index_name = $data;
  614.             }
  615.             break;
  616.         case 'database-table-declaration-index-unique':
  617.             if (isset($this->index['unique'])) {
  618.                 $this->index['unique'.= $data;
  619.             else {
  620.                 $this->index['unique'$data;
  621.             }
  622.             break;
  623.         case 'database-table-declaration-index-was':
  624.             if (isset($this->index['was'])) {
  625.                 $this->index['was'.= $data;
  626.             else {
  627.                 $this->index['was'$data;
  628.             }
  629.             break;
  630.         case 'database-table-declaration-index-field-name':
  631.             if (isset($this->field_name)) {
  632.                 $this->field_name .= $data;
  633.             else {
  634.                 $this->field_name = $data;
  635.             }
  636.             break;
  637.         case 'database-table-declaration-index-field-sorting':
  638.             if (isset($this->field['sorting'])) {
  639.                 $this->field['sorting'.= $data;
  640.             else {
  641.                 $this->field['sorting'$data;
  642.             }
  643.             break;
  644.  
  645.         /* Sequence declaration */
  646.         case 'database-sequence-name':
  647.             if (isset($this->seq_name)) {
  648.                 $this->seq_name .= $data;
  649.             else {
  650.                 $this->seq_name = $data;
  651.             }
  652.             break;
  653.         case 'database-sequence-was':
  654.             if (isset($this->seq['was'])) {
  655.                 $this->seq['was'.= $data;
  656.             else {
  657.                 $this->seq['was'$data;
  658.             }
  659.             break;
  660.         case 'database-sequence-start':
  661.             if (isset($this->seq['start'])) {
  662.                 $this->seq['start'.= $data;
  663.             else {
  664.                 $this->seq['start'$data;
  665.             }
  666.             break;
  667.         case 'database-sequence-on-table':
  668.             if (isset($this->seq['on']['table'])) {
  669.                 $this->seq['on']['table'.= $data;
  670.             else {
  671.                 $this->seq['on']['table'$data;
  672.             }
  673.             break;
  674.         case 'database-sequence-on-field':
  675.             if (isset($this->seq['on']['field'])) {
  676.                 $this->seq['on']['field'.= $data;
  677.             else {
  678.                 $this->seq['on']['field'$data;
  679.             }
  680.             break;
  681.         }
  682.     }
  683. }
  684.  
  685. ?>

Documentation generated on Mon, 11 Mar 2019 14:20:27 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.