MDB2
[ class tree: MDB2 ] [ index: MDB2 ] [ 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.4 2005/01/12 12:28:09 lsmith Exp $
  46. //
  47.  
  48. require_once 'XML/Parser.php';
  49.  
  50. /**
  51.  * Parses an XML schema file
  52.  *
  53.  * @package MDB2
  54.  * @category Database
  55.  * @access private
  56.  * @author  Christian Dickmann <dickmann@php.net>
  57.  */
  58. class MDB2_Tools_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.  
  98.     function MDB2_Tools_Parser($variables$fail_on_invalid_names = true)
  99.     {
  100.         $this->XML_Parser();
  101.         $this->variables $variables;
  102.         $this->fail_on_invalid_names $fail_on_invalid_names;
  103.     }
  104.  
  105.     function startHandler($xp$element$attribs)
  106.     {
  107.         if (strtolower($element== 'variable'{
  108.             $this->var_mode = true;
  109.             return;
  110.         }
  111.  
  112.         $this->elements[$this->count++strtolower($element);
  113.         $this->element implode('-'$this->elements);
  114.  
  115.         switch ($this->element{
  116.         case 'database-table-initialization-insert':
  117.             $this->init = array('type' => 'insert');
  118.             break;
  119.         case 'database-table-initialization-insert-field':
  120.             $this->init_name '';
  121.             $this->init_value '';
  122.             break;
  123.         case 'database-table':
  124.             $this->table_name '';
  125.             $this->table = array();
  126.             break;
  127.         case 'database-table-declaration-field':
  128.             $this->field_name '';
  129.             $this->field = array();
  130.             break;
  131.         case 'database-table-declaration-field-default':
  132.             $this->field['default''';
  133.             break;
  134.         case 'database-table-declaration-index':
  135.             $this->index_name '';
  136.             $this->index = array();
  137.             break;
  138.         case 'database-sequence':
  139.             $this->seq_name '';
  140.             $this->seq = array();
  141.             break;
  142.         case 'database-table-declaration-index-field':
  143.             $this->field_name '';
  144.             $this->field = array();
  145.             break;
  146.         }
  147.     }
  148.  
  149.     function endHandler($xp$element)
  150.     {
  151.         if (strtolower($element== 'variable'{
  152.             $this->var_mode = false;
  153.             return;
  154.         }
  155.  
  156.         switch ($this->element{
  157.         /* Initialization */
  158.         case 'database-table-initialization-insert-field':
  159.             if (!$this->init_name{
  160.                 $this->raiseError('field-name has to be specified'null$xp);
  161.             }
  162.             if (isset($this->init['fields'][$this->init_name])) {
  163.                 $this->raiseError('field "'.$this->init_name.'" already filled'null$xp);
  164.             }
  165.             if (!isset($this->table['fields'][$this->init_name])) {
  166.                 $this->raiseError('unkown field "'.$this->init_name.'"'null$xp);
  167.             }
  168.             if ($this->init_value !== ''
  169.                 && !$this->validateFieldValue($this->init_name$this->init_value$xp)
  170.             {
  171.                 $this->raiseError('field "'.$this->init_name.'" has wrong value'null$xp);
  172.             }
  173.             $this->init['fields'][$this->init_name$this->init_value;
  174.             break;
  175.         case 'database-table-initialization-insert':
  176.             $this->table['initialization'][$this->init;
  177.             break;
  178.  
  179.         /* Table definition */
  180.         case 'database-table':
  181.             if (!isset($this->table['was'])) {
  182.                 $this->table['was'$this->table_name;
  183.             }
  184.             if (!$this->table_name{
  185.                 $this->raiseError('tables need names'null$xp);
  186.             }
  187.             if (isset($this->database_definition['tables'][$this->table_name])) {
  188.                 $this->raiseError('table "'.$this->table_name.'" already exists'null$xp);
  189.             }
  190.             if (!isset($this->table['fields'])) {
  191.                 $this->raiseError('tables need one or more fields'null$xp);
  192.             }
  193.             if (isset($this->table['indexes'])) {
  194.                 foreach ($this->table['indexes'as $index{
  195.                     foreach ($index['fields'as $field_name => $field{
  196.                         if (!isset($this->table['fields'][$field_name])) {
  197.                             $this->raiseError('index field "'.$field_name.'" does not exist'null$xp);
  198.                         }
  199.                         if (!(isset($this->table['fields'][$field_name]['notnull'])
  200.                             && $this->table['fields'][$field_name]['notnull'== true)
  201.                         {
  202.                             $this->raiseError('index field "'.$field_name.
  203.                                 '" has to be "notnull"'null$xp);
  204.                         }
  205.                     }
  206.                 }
  207.             }
  208.             $this->database_definition['tables'][$this->table_name$this->table;
  209.             break;
  210.  
  211.         /* Field declaration */
  212.         case 'database-table-declaration-field':
  213.             if (!$this->field_name || !isset($this->field['type'])) {
  214.                 $this->raiseError('field "'.$this->field_name.'" was not properly specified'null$xp);
  215.             }
  216.             if (isset($this->table['fields'][$this->field_name])) {
  217.                 $this->raiseError('field "'.$this->field_name.'" already exists'null$xp);
  218.             }
  219.             /* Invalidname check */
  220.             if ($this->fail_on_invalid_names && isset($this->invalid_names[$this->field_name])) {
  221.                 $this->raiseError('fieldname "'.$this->field_name.'" not allowed'null$xp);
  222.             }
  223.             /* Type check */
  224.             switch ($this->field['type']{
  225.             case 'integer':
  226.                 if (isset($this->field['unsigned'])
  227.                     && $this->field['unsigned'!== '1' && $this->field['unsigned'!== '0'
  228.                 {
  229.                     $this->raiseError('unsigned has to be 1 or 0'null$xp);
  230.                 }
  231.                 break;
  232.             case 'text':
  233.             case 'clob':
  234.             case 'blob':
  235.                 if (isset($this->field['length']&& ((int)$this->field['length']<= 0{
  236.                     $this->raiseError('length has to be an integer greater 0'null$xp);
  237.                 }
  238.                 break;
  239.             case 'boolean':
  240.             case 'date':
  241.             case 'timestamp':
  242.             case 'time':
  243.             case 'float':
  244.             case 'decimal':
  245.                 break;
  246.             default:
  247.                 $this->raiseError('no valid field type ("'.$this->field['type'].'") specified'null$xp);
  248.             }
  249.             if (!isset($this->field['was'])) {
  250.                 $this->field['was'$this->field_name;
  251.             }
  252.             if (isset($this->field['notnull']&& !$this->is_boolean($this->field['notnull'])) {
  253.                 $this->raiseError('field  "notnull" has to be 1 or 0'null$xp);
  254.             }
  255.             if (isset($this->field['notnull']&& !isset($this->field['default'])) {
  256.                 $this->raiseError('if field is "notnull", it needs a default value'null$xp);
  257.             }
  258.             if (isset($this->field['unsigned']&& !$this->is_boolean($this->field['unsigned'])) {
  259.                 $this->raiseError('field  "notnull" has to be 1 or 0'null$xp);
  260.             }
  261.             $this->table['fields'][$this->field_name$this->field;
  262.             if (isset($this->field['default'])) {
  263.                 if ($this->field['type'== 'clob' || $this->field['type'== 'blob'{
  264.                     $this->raiseError('"'.$this->field['type'].
  265.                         '"-fields are not allowed to have a default value'null$xp);
  266.                 }
  267.                 if ($this->field['default'!== ''
  268.                     && !$this->validateFieldValue($this->field_name$this->field['default']$xp)
  269.                 {
  270.                     $this->raiseError('default value of "'.$this->field_name.'" is of wrong type'null$xp);
  271.                 }
  272.             }
  273.             break;
  274.  
  275.         /* Index declaration */
  276.         case 'database-table-declaration-index':
  277.             if (!$this->index_name{
  278.                 $this->raiseError('an index needs a name'null$xp);
  279.             }
  280.             if (isset($this->table['indexes'][$this->index_name])) {
  281.                 $this->raiseError('index "'.$this->index_name.'" already exists'null$xp);
  282.             }
  283.             if (isset($this->index['unique']&& !$this->is_boolean($this->index['unique'])) {
  284.                 $this->raiseError('field  "unique" has to be 1 or 0'null$xp);
  285.             }
  286.             if (!isset($this->index['was'])) {
  287.                 $this->index['was'$this->index_name;
  288.             }
  289.             $this->table['indexes'][$this->index_name$this->index;
  290.             break;
  291.         case 'database-table-declaration-index-field':
  292.             if (!$this->field_name{
  293.                 $this->raiseError('the index-field-name is required'null$xp);
  294.             }
  295.             if (isset($this->field['sorting'])
  296.                 && $this->field['sorting'!== 'ascending' && $this->field['sorting'!== 'descending'{
  297.                 $this->raiseError('sorting type unknown'null$xp);
  298.             }
  299.             $this->index['fields'][$this->field_name$this->field;
  300.             break;
  301.  
  302.         /* Sequence declaration */
  303.         case 'database-sequence':
  304.             if (!$this->seq_name{
  305.                 $this->raiseError('a sequence has to have a name'null$xp);
  306.             }
  307.             if (isset($this->database_definition['sequences'][$this->seq_name])) {
  308.                 $this->raiseError('sequence "'.$this->seq_name.'" already exists'null$xp);
  309.             }
  310.             if (!isset($this->seq['was'])) {
  311.                 $this->seq['was'$this->seq_name;
  312.             }
  313.             if (isset($this->seq['on'])) {
  314.                 if ((!isset($this->seq['on']['table']|| !$this->seq['on']['table'])
  315.                     || (!isset($this->seq['on']['field']|| !$this->seq['on']['field'])
  316.                 {
  317.                     $this->raiseError('sequence "'.$this->seq_name.
  318.                         '" was not properly defined'null$xp);
  319.                 }
  320.             }
  321.             $this->database_definition['sequences'][$this->seq_name$this->seq;
  322.             break;
  323.  
  324.         /* End of File */
  325.         case 'database':
  326.             if (isset($this->database_definition['create'])
  327.                 && !$this->is_boolean($this->database_definition['create'])
  328.             {
  329.                 $this->raiseError('field "create" has to be 1 or 0'null$xp);
  330.             }
  331.             if (isset($this->database_definition['overwrite'])
  332.                 && !$this->is_boolean($this->database_definition['overwrite'])
  333.             {
  334.                 $this->raiseError('field "overwrite" has to be 1 or 0'null$xp);
  335.             }
  336.             if (!isset($this->database_definition['name'])
  337.                 || !$this->database_definition['name']
  338.             {
  339.                 $this->raiseError('database needs a name'null$xp);
  340.             }
  341.             if (isset($this->database_definition['sequences'])) {
  342.                 foreach ($this->database_definition['sequences'as $seq_name => $seq{
  343.                     if (isset($seq['on'])
  344.                         && !isset($this->database_definition['tables'][$seq['on']['table']]['fields'][$seq['on']['field']])
  345.                     {
  346.                         $this->raiseError('sequence "'.$seq_name.
  347.                             '" was assigned on unexisting field/table'null$xp);
  348.                     }
  349.                 }
  350.             }
  351.             if (MDB2::isError($this->error)) {
  352.                 $this->database_definition $this->error;
  353.             }
  354.             break;
  355.         }
  356.  
  357.         unset($this->elements[--$this->count]);
  358.         $this->element implode('-'$this->elements);
  359.     }
  360.  
  361.     function validateFieldValue($field_name&$field_value&$xp)
  362.     {
  363.         if (!isset($this->table['fields'][$field_name])) {
  364.             return $this->raiseError('"'.$field_name.'" is not defined'null$xp);
  365.  
  366.         }
  367.         $field_def $this->table['fields'][$field_name];
  368.         switch ($field_def['type']{
  369.         case 'text':
  370.         case 'clob':
  371.             if (isset($field_def['length']&& strlen($field_value$field_def['length']{
  372.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  373.                     $field_def['type'].'"'null$xp);
  374.             }
  375.             break;
  376.         case 'blob':
  377.             /*
  378.             if (!preg_match('/^([0-9a-f]{2})*$/i', $field_value)) {
  379.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  380.                     $field_def['type'].'"', null, $xp);
  381.             }
  382.             */
  383.             $field_value pack('H*'$field_value);
  384.             if (isset($field_def['length']&& strlen($field_value$field_def['length']{
  385.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  386.                     $field_def['type'].'"'null$xp);
  387.             }
  388.             break;
  389.         case 'integer':
  390.             if ($field_value != ((int)$field_value)) {
  391.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  392.                     $field_def['type'].'"'null$xp);
  393.             }
  394.             $field_value = (int) $field_value;
  395.             if (isset($field_def['unsigned']&& $field_def['unsigned'&& $field_value < 0{
  396.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  397.                     $field_def['type'].'"'null$xp);
  398.             }
  399.             break;
  400.         case 'boolean':
  401.             if (!$this->is_boolean($field_value)) {
  402.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  403.                     $field_def['type'].'"'null$xp);
  404.             }
  405.             break;
  406.         case 'date':
  407.             if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/'$field_value)) {
  408.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  409.                     $field_def['type'].'"'null$xp);
  410.             }
  411.             break;
  412.         case 'timestamp':
  413.             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)) {
  414.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  415.                     $field_def['type'].'"'null$xp);
  416.             }
  417.             break;
  418.         case 'time':
  419.             if (!preg_match("/([0-9]{2}):([0-9]{2}):([0-9]{2})/"$field_value)) {
  420.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  421.                     $field_def['type'].'"'null$xp);
  422.             }
  423.             break;
  424.         case 'float':
  425.         case 'double':
  426.             if ($field_value != (double) $field_value{
  427.                 return $this->raiseError('"'.$field_value.'" is not of type "'.
  428.                     $field_def['type'].'"'null$xp);
  429.             }
  430.             $field_value = (double) $field_value;
  431.             break;
  432.         }
  433.         return true;
  434.     }
  435.  
  436.     function raiseError($msg = null$ecode = 0$xp = null)
  437.     {
  438.         if (is_null($this->error)) {
  439.             $error '';
  440.             if (is_resource($msg)) {
  441.                 $error .= 'Parser error: '.xml_error_string(xml_get_error_code($msg));
  442.                 $xp $msg;
  443.             else {
  444.                 $error .= 'Parser error: '.$msg;
  445.                 if (!is_resource($xp)) {
  446.                     $xp $this->parser;
  447.                 }
  448.             }
  449.             if (($error_string xml_error_string($ecode))) {
  450.                 $error .= ' - '.$error_string;
  451.             }
  452.             if (is_resource($xp)) {
  453.                 $byte @xml_get_current_byte_index($xp);
  454.                 $line @xml_get_current_line_number($xp);
  455.                 $column @xml_get_current_column_number($xp);
  456.                 $error .= " - Byte: $byte; Line: $line; Col: $column";
  457.             }
  458.             $error .= "\n";
  459.             $this->error MDB2_Driver_Common::raiseError(MDB2_ERROR_MANAGER_PARSEnullnull$error);
  460.         }
  461.         return $this->error;
  462.     }
  463.  
  464.     function is_boolean(&$value)
  465.     {
  466.         if (is_int($value&& ($value == 0 || $value == 1)) {
  467.             return true;
  468.         }
  469.         if ($value === '1' || $value === '0'{
  470.             $value = (int) $value;
  471.             return true;
  472.         }
  473.         switch ($value{
  474.         case 'N':
  475.         case 'n':
  476.         case 'no':
  477.         case 'false':
  478.             $value = 0;
  479.             break;
  480.         case 'Y':
  481.         case 'y':
  482.         case 'yes':
  483.         case 'true':
  484.             $value = 1;
  485.             break;
  486.         default:
  487.             return false;
  488.         }
  489.         return true;
  490.     }
  491.  
  492.     function cdataHandler($xp$data)
  493.     {
  494.         if ($this->var_mode == true{
  495.             if (!isset($this->variables[$data])) {
  496.                 $this->raiseError('variable "'.$data.'" not found'null$xp);
  497.                 return;
  498.             }
  499.             $data $this->variables[$data];
  500.         }
  501.  
  502.         switch ($this->element{
  503.         /* Initialization */
  504.         case 'database-table-initialization-insert-field-name':
  505.             if (isset($this->init_name)) {
  506.                 $this->init_name .= $data;
  507.             else {
  508.                 $this->init_name $data;
  509.             }
  510.             break;
  511.         case 'database-table-initialization-insert-field-value':
  512.             if (isset($this->init_value)) {
  513.                 $this->init_value .= $data;
  514.             else {
  515.                 $this->init_value $data;
  516.             }
  517.             break;
  518.  
  519.         /* Database */
  520.         case 'database-name':
  521.             if (isset($this->database_definition['name'])) {
  522.                 $this->database_definition['name'.= $data;
  523.             else {
  524.                 $this->database_definition['name'$data;
  525.             }
  526.             break;
  527.         case 'database-create':
  528.             if (isset($this->database_definition['create'])) {
  529.                 $this->database_definition['create'.= $data;
  530.             else {
  531.                 $this->database_definition['create'$data;
  532.             }
  533.             break;
  534.         case 'database-overwrite':
  535.             if (isset($this->database_definition['overwrite'])) {
  536.                 $this->database_definition['overwrite'.= $data;
  537.             else {
  538.                 $this->database_definition['overwrite'$data;
  539.             }
  540.             break;
  541.         case 'database-table-name':
  542.             if (isset($this->table_name)) {
  543.                 $this->table_name .= $data;
  544.             else {
  545.                 $this->table_name $data;
  546.             }
  547.             break;
  548.         case 'database-table-was':
  549.             if (isset($this->table['was'])) {
  550.                 $this->table['was'.= $data;
  551.             else {
  552.                 $this->table['was'$data;
  553.             }
  554.             break;
  555.  
  556.         /* Field declaration */
  557.         case 'database-table-declaration-field-name':
  558.             if (isset($this->field_name)) {
  559.                 $this->field_name .= $data;
  560.             else {
  561.                 $this->field_name $data;
  562.             }
  563.             break;
  564.         case 'database-table-declaration-field-type':
  565.             if (isset($this->field['type'])) {
  566.                 $this->field['type'.= $data;
  567.             else {
  568.                 $this->field['type'$data;
  569.             }
  570.             break;
  571.         case 'database-table-declaration-field-was':
  572.             if (isset($this->field['was'])) {
  573.                 $this->field['was'.= $data;
  574.             else {
  575.                 $this->field['was'$data;
  576.             }
  577.             break;
  578.         case 'database-table-declaration-field-notnull':
  579.             if (isset($this->field['notnull'])) {
  580.                 $this->field['notnull'.= $data;
  581.             else {
  582.                 $this->field['notnull'$data;
  583.             }
  584.             break;
  585.         case 'database-table-declaration-field-unsigned':
  586.             if (isset($this->field['unsigned'])) {
  587.                 $this->field['unsigned'.= $data;
  588.             else {
  589.                 $this->field['unsigned'$data;
  590.             }
  591.             break;
  592.         case 'database-table-declaration-field-default':
  593.             if (isset($this->field['default'])) {
  594.                 $this->field['default'.= $data;
  595.             else {
  596.                 $this->field['default'$data;
  597.             }
  598.             break;
  599.         case 'database-table-declaration-field-length':
  600.             if (isset($this->field['length'])) {
  601.                 $this->field['length'.= $data;
  602.             else {
  603.                 $this->field['length'$data;
  604.             }
  605.             break;
  606.  
  607.         /* Index declaration */
  608.         case 'database-table-declaration-index-name':
  609.             if (isset($this->index_name)) {
  610.                 $this->index_name .= $data;
  611.             else {
  612.                 $this->index_name $data;
  613.             }
  614.             break;
  615.         case 'database-table-declaration-index-unique':
  616.             if (isset($this->index['unique'])) {
  617.                 $this->index['unique'.= $data;
  618.             else {
  619.                 $this->index['unique'$data;
  620.             }
  621.             break;
  622.         case 'database-table-declaration-index-was':
  623.             if (isset($this->index['was'])) {
  624.                 $this->index['was'.= $data;
  625.             else {
  626.                 $this->index['was'$data;
  627.             }
  628.             break;
  629.         case 'database-table-declaration-index-field-name':
  630.             if (isset($this->field_name)) {
  631.                 $this->field_name .= $data;
  632.             else {
  633.                 $this->field_name $data;
  634.             }
  635.             break;
  636.         case 'database-table-declaration-index-field-sorting':
  637.             if (isset($this->field['sorting'])) {
  638.                 $this->field['sorting'.= $data;
  639.             else {
  640.                 $this->field['sorting'$data;
  641.             }
  642.             break;
  643.  
  644.         /* Sequence declaration */
  645.         case 'database-sequence-name':
  646.             if (isset($this->seq_name)) {
  647.                 $this->seq_name .= $data;
  648.             else {
  649.                 $this->seq_name $data;
  650.             }
  651.             break;
  652.         case 'database-sequence-was':
  653.             if (isset($this->seq['was'])) {
  654.                 $this->seq['was'.= $data;
  655.             else {
  656.                 $this->seq['was'$data;
  657.             }
  658.             break;
  659.         case 'database-sequence-start':
  660.             if (isset($this->seq['start'])) {
  661.                 $this->seq['start'.= $data;
  662.             else {
  663.                 $this->seq['start'$data;
  664.             }
  665.             break;
  666.         case 'database-sequence-on-table':
  667.             if (isset($this->seq['on']['table'])) {
  668.                 $this->seq['on']['table'.= $data;
  669.             else {
  670.                 $this->seq['on']['table'$data;
  671.             }
  672.             break;
  673.         case 'database-sequence-on-field':
  674.             if (isset($this->seq['on']['field'])) {
  675.                 $this->seq['on']['field'.= $data;
  676.             else {
  677.                 $this->seq['on']['field'$data;
  678.             }
  679.             break;
  680.         }
  681.     }
  682. }
  683.  
  684. ?>

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