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

Source for file mssql.php

Documentation is available at mssql.php

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PHP versions 4 and 5                                                 |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox,                 |
  6. // | Stig. S. Bakken, Lukas Smith, Frank M. Kromann                       |
  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. // | Authors: Lukas Smith <smith@pooteeweet.org>                          |
  43. // |          Lorenzo Alberton <l.alberton@quipo.it>                      |
  44. // +----------------------------------------------------------------------+
  45. //
  46. // $Id: mssql.php,v 1.39 2007/03/11 14:29:24 quipo Exp $
  47. //
  48.  
  49. require_once 'MDB2/Driver/Reverse/Common.php';
  50.  
  51. /**
  52.  * MDB2 MSSQL driver for the schema reverse engineering module
  53.  *
  54.  * @package MDB2
  55.  * @category Database
  56.  * @author  Lukas Smith <smith@dybnet.de>
  57.  * @author  Lorenzo Alberton <l.alberton@quipo.it>
  58.  */
  59. class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common
  60. {
  61.     // {{{ getTableFieldDefinition()
  62.  
  63.     /**
  64.      * Get the structure of a field into an array
  65.      *
  66.      * @param string    $table       name of table that should be used in method
  67.      * @param string    $field_name  name of field that should be used in method
  68.      * @return mixed data array on success, a MDB2 error on failure
  69.      * @access public
  70.      */
  71.     function getTableFieldDefinition($table$field_name)
  72.     {
  73.         $db =$this->getDBInstance();
  74.         if (PEAR::isError($db)) {
  75.             return $db;
  76.         }
  77.  
  78.         $result $db->loadModule('Datatype'nulltrue);
  79.         if (PEAR::isError($result)) {
  80.             return $result;
  81.         }
  82.         $table $db->quoteIdentifier($tabletrue);
  83.         $fldname $db->quoteIdentifier($field_nametrue);
  84.  
  85.         $query = "SELECT t.table_name,
  86.                          c.column_name 'name',
  87.                          c.data_type 'type',
  88.                          c.is_nullable,
  89.                          c.column_default,
  90.                          c.character_maximum_length 'length',
  91.                          c.numeric_precision,
  92.                          c.numeric_scale,
  93.                          c.character_set_name,
  94.                          c.collation_name
  95.                     FROM INFORMATION_SCHEMA.TABLES t,
  96.                          INFORMATION_SCHEMA.COLUMNS c
  97.                    WHERE t.table_name = c.table_name
  98.                      AND t.table_name = '$table'
  99.                      AND c.column_name = '$fldname'
  100.                 ORDER BY t.table_name";
  101.         $column $db->queryRow($querynullMDB2_FETCHMODE_ASSOC);
  102.         if (PEAR::isError($column)) {
  103.             return $column;
  104.         }
  105.         if (empty($column)) {
  106.             return $db->raiseError(MDB2_ERROR_NOT_FOUNDnullnull,
  107.                 'it was not specified an existing table column'__FUNCTION__);
  108.         }
  109.  
  110.         if ($db->options['portability'MDB2_PORTABILITY_FIX_CASE{
  111.             if ($db->options['field_case'== CASE_LOWER{
  112.                 $column['name'strtolower($column['name']);
  113.             else {
  114.                 $column['name'strtoupper($column['name']);
  115.             }
  116.         else {
  117.             $column array_change_key_case($column$db->options['field_case']);
  118.         }
  119.         $mapped_datatype $db->datatype->mapNativeDatatype($column);
  120.         if (PEAR::IsError($mapped_datatype)) {
  121.             return $mapped_datatype;
  122.         }
  123.         list($types$length$unsigned$fixed$mapped_datatype;
  124.         $notnull = true;
  125.         if ($column['is_nullable']{
  126.             $notnull = false;
  127.         }
  128.         $default = false;
  129.         if (array_key_exists('column_default'$column)) {
  130.             $default $column['column_default'];
  131.             if (is_null($default&& $notnull{
  132.                 $default '';
  133.             elseif (strlen($default> 4
  134.                    && substr($default01== '('
  135.                    &&  substr($default-11== ')'
  136.             {
  137.                 //mssql wraps the default value in parentheses: "((1234))", "(NULL)"
  138.                 $default trim($default'()');
  139.                 if ($default == 'NULL'{
  140.                     $default = null;
  141.                 }
  142.             }
  143.         }
  144.         $definition[0= array(
  145.             'notnull' => $notnull,
  146.             'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i''\\1'$column['type'])
  147.         );
  148.         if (!is_null($length)) {
  149.             $definition[0]['length'$length;
  150.         }
  151.         if (!is_null($unsigned)) {
  152.             $definition[0]['unsigned'$unsigned;
  153.         }
  154.         if (!is_null($fixed)) {
  155.             $definition[0]['fixed'$fixed;
  156.         }
  157.         if ($default !== false{
  158.             $definition[0]['default'$default;
  159.         }
  160.         foreach ($types as $key => $type{
  161.             $definition[$key$definition[0];
  162.             if ($type == 'clob' || $type == 'blob'{
  163.                 unset($definition[$key]['default']);
  164.             }
  165.             $definition[$key]['type'$type;
  166.             $definition[$key]['mdb2type'$type;
  167.         }
  168.         return $definition;
  169.     }
  170.  
  171.     // }}}
  172.     // {{{ getTableIndexDefinition()
  173.  
  174.     /**
  175.      * Get the structure of an index into an array
  176.      *
  177.      * @param string    $table      name of table that should be used in method
  178.      * @param string    $index_name name of index that should be used in method
  179.      * @return mixed data array on success, a MDB2 error on failure
  180.      * @access public
  181.      */
  182.     function getTableIndexDefinition($table$index_name)
  183.     {
  184.         $db =$this->getDBInstance();
  185.         if (PEAR::isError($db)) {
  186.             return $db;
  187.         }
  188.  
  189.         $table $db->quoteIdentifier($tabletrue);
  190.         //$idxname = $db->quoteIdentifier($index_name, true);
  191.  
  192.         $query = "SELECT OBJECT_NAME(i.id) tablename,
  193.                          i.name indexname,
  194.                          c.name field_name,
  195.                          CASE INDEXKEY_PROPERTY(i.id, i.indid, ik.keyno, 'IsDescending')
  196.                            WHEN 1 THEN 'DESC' ELSE 'ASC'
  197.                          END 'collation'
  198.                     FROM sysindexes i
  199.                     JOIN sysobjects o ON o.id = i.id
  200.                     JOIN sysindexkeys ik ON ik.id = i.id AND ik.indid = i.indid
  201.                     JOIN syscolumns c ON c.id = ik.id AND c.colid = ik.colid
  202.                    WHERE OBJECT_NAME(i.id) = '$table'
  203.                      AND i.name = '%s'
  204.                      AND NOT EXISTS (
  205.                             SELECT *
  206.                               FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE k
  207.                              WHERE k.table_name = OBJECT_NAME(i.id)
  208.                                AND k.constraint_name = i.name)
  209.                 ORDER BY tablename, indexname, ik.keyno";
  210.  
  211.         $index_name_mdb2 $db->getIndexName($index_name);
  212.         $result $db->queryRow(sprintf($query$index_name_mdb2));
  213.         if (!PEAR::isError($result&& !is_null($result)) {
  214.             // apply 'idxname_format' only if the query succeeded, otherwise
  215.             // fallback to the given $index_name, without transformation
  216.             $index_name $index_name_mdb2;
  217.         }
  218.         $result $db->query(sprintf($query$index_name));
  219.         if (PEAR::isError($result)) {
  220.             return $result;
  221.         }
  222.  
  223.         $definition = array();
  224.         while (is_array($row $result->fetchRow(MDB2_FETCHMODE_ASSOC))) {
  225.             $column_name $row['field_name'];
  226.             if ($db->options['portability'MDB2_PORTABILITY_FIX_CASE{
  227.                 if ($db->options['field_case'== CASE_LOWER{
  228.                     $column_name strtolower($column_name);
  229.                 else {
  230.                     $column_name strtoupper($column_name);
  231.                 }
  232.             }
  233.             $definition['fields'][$column_name= array();
  234.             if (!empty($row['collation'])) {
  235.                 $definition['fields'][$column_name]['sorting'($row['collation'== 'ASC'
  236.                     ? 'ascending' 'descending');
  237.             }
  238.         }
  239.         $result->free();
  240.         if (empty($definition['fields'])) {
  241.             return $db->raiseError(MDB2_ERROR_NOT_FOUNDnullnull,
  242.                 'it was not specified an existing table index'__FUNCTION__);
  243.         }
  244.         return $definition;
  245.     }
  246.  
  247.     // }}}
  248.     // {{{ getTableConstraintDefinition()
  249.  
  250.     /**
  251.      * Get the structure of a constraint into an array
  252.      *
  253.      * @param string    $table      name of table that should be used in method
  254.      * @param string    $index_name name of index that should be used in method
  255.      * @return mixed data array on success, a MDB2 error on failure
  256.      * @access public
  257.      */
  258.     function getTableConstraintDefinition($table$index_name)
  259.     {
  260.         $db =$this->getDBInstance();
  261.         if (PEAR::isError($db)) {
  262.             return $db;
  263.         }
  264.  
  265.         $table $db->quoteIdentifier($tabletrue);
  266.         $query = "SELECT k.table_name,
  267.                          k.column_name field_name,
  268.                          CASE c.constraint_type WHEN 'PRIMARY KEY' THEN 1 ELSE 0 END 'primary',
  269.                          CASE c.constraint_type WHEN 'UNIQUE' THEN 1 ELSE 0 END 'unique',
  270.                          CASE c.constraint_type WHEN 'FOREIGN KEY' THEN 1 ELSE 0 END 'foreign',
  271.                          CASE c.constraint_type WHEN 'CHECK' THEN 1 ELSE 0 END 'check'
  272.                     FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE k
  273.                     LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS c
  274.                       ON k.table_name = c.table_name
  275.                      AND k.constraint_name = c.constraint_name
  276.                    WHERE k.constraint_catalog = DB_NAME()
  277.                     AND k.table_name = '$table'
  278.                     AND k.constraint_name = '%s'
  279.                ORDER BY k.constraint_name,
  280.                         k.ordinal_position";
  281.  
  282.         $index_name_mdb2 $db->getIndexName($index_name);
  283.         $result $db->queryRow(sprintf($query$index_name_mdb2));
  284.         if (!PEAR::isError($result&& !is_null($result)) {
  285.             // apply 'idxname_format' only if the query succeeded, otherwise
  286.             // fallback to the given $index_name, without transformation
  287.             $index_name $index_name_mdb2;
  288.         }
  289.         $result $db->query(sprintf($query$index_name));
  290.         if (PEAR::isError($result)) {
  291.             return $result;
  292.         }
  293.  
  294.         $definition = array();
  295.         while (is_array($row $result->fetchRow(MDB2_FETCHMODE_ASSOC))) {
  296.             $column_name $row['field_name'];
  297.             if ($db->options['portability'MDB2_PORTABILITY_FIX_CASE{
  298.                 if ($db->options['field_case'== CASE_LOWER{
  299.                     $column_name strtolower($column_name);
  300.                 else {
  301.                     $column_name strtoupper($column_name);
  302.                 }
  303.             }
  304.             $definition['fields'][$column_name= array();
  305.             if (!empty($row['collation'])) {
  306.                 $definition['fields'][$column_name]['sorting'($row['collation'== 'ASC'
  307.                     ? 'ascending' 'descending');
  308.             }
  309.             $definition['primary'$row['primary'];
  310.             $definition['unique']  $row['unique'];
  311.             $definition['foreign'$row['foreign'];
  312.             $definition['check']   $row['check'];
  313.         }
  314.         $result->free();
  315.         if (empty($definition['fields'])) {
  316.             return $db->raiseError(MDB2_ERROR_NOT_FOUNDnullnull,
  317.                 'it was not specified an existing table index'__FUNCTION__);
  318.         }
  319.         return $definition;
  320.     }
  321.  
  322.     // }}}
  323.     // {{{ getTriggerDefinition()
  324.  
  325.     /**
  326.      * Get the structure of a trigger into an array
  327.      *
  328.      * EXPERIMENTAL
  329.      *
  330.      * WARNING: this function is experimental and may change the returned value
  331.      * at any time until labelled as non-experimental
  332.      *
  333.      * @param string    $trigger    name of trigger that should be used in method
  334.      * @return mixed data array on success, a MDB2 error on failure
  335.      * @access public
  336.      */
  337.     function getTriggerDefinition($trigger)
  338.     {
  339.         $db =$this->getDBInstance();
  340.         if (PEAR::isError($db)) {
  341.             return $db;
  342.         }
  343.  
  344.         $query "SELECT sys1.name trigger_name,
  345.                          sys2.name table_name,
  346.                          c.text trigger_body,
  347.                          c.encrypted is_encripted,
  348.                          CASE
  349.                            WHEN OBJECTPROPERTY(sys1.id, 'ExecIsTriggerDisabled') = 1
  350.                            THEN 0 ELSE 1
  351.                          END trigger_enabled,
  352.                          CASE
  353.                            WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsertTrigger') = 1
  354.                            THEN 'INSERT'
  355.                            WHEN OBJECTPROPERTY(sys1.id, 'ExecIsUpdateTrigger') = 1
  356.                            THEN 'UPDATE'
  357.                            WHEN OBJECTPROPERTY(sys1.id, 'ExecIsDeleteTrigger') = 1
  358.                            THEN 'DELETE'
  359.                          END trigger_event,
  360.                          CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsteadOfTrigger') = 1
  361.                            THEN 'INSTEAD OF' ELSE 'AFTER'
  362.                          END trigger_type,
  363.                          '' trigger_comment
  364.                     FROM sysobjects sys1
  365.                     JOIN sysobjects sys2 ON sys1.parent_obj = sys2.id
  366.                     JOIN syscomments c ON sys1.id = c.id
  367.                    WHERE sys1.xtype = 'TR'
  368.                      AND sys1.name = "$db->quote($trigger'text');
  369.  
  370.         $types = array(
  371.             'trigger_name'    => 'text',
  372.             'table_name'      => 'text',
  373.             'trigger_body'    => 'text',
  374.             'trigger_type'    => 'text',
  375.             'trigger_event'   => 'text',
  376.             'trigger_comment' => 'text',
  377.             'trigger_enabled' => 'boolean',
  378.             'is_encripted'    => 'boolean',
  379.         );
  380.  
  381.         $def $db->queryRow($query$typesMDB2_FETCHMODE_ASSOC);
  382.         if (PEAR::isError($def)) {
  383.             return $def;
  384.         }
  385.         $trg_body $db->queryCol('EXEC sp_helptext '$db->quote($trigger'text')'text');
  386.         if (!PEAR::isError($trg_body)) {
  387.             $def['trigger_body'implode(''$trg_body);
  388.         }
  389.         return $def;
  390.     }
  391.  
  392.     // }}}
  393.     // {{{ tableInfo()
  394.  
  395.     /**
  396.      * Returns information about a table or a result set
  397.      *
  398.      * NOTE: only supports 'table' and 'flags' if <var>$result</var>
  399.      * is a table name.
  400.      *
  401.      * @param object|string $result  MDB2_result object from a query or a
  402.      *                                  string containing the name of a table.
  403.      *                                  While this also accepts a query result
  404.      *                                  resource identifier, this behavior is
  405.      *                                  deprecated.
  406.      * @param int            $mode    a valid tableInfo mode
  407.      *
  408.      * @return array  an associative array with the information requested.
  409.      *                  A MDB2_Error object on failure.
  410.      *
  411.      * @see MDB2_Driver_Common::tableInfo()
  412.      */
  413.     function tableInfo($result$mode = null)
  414.     {
  415.         if (is_string($result)) {
  416.            return parent::tableInfo($result$mode);
  417.         }
  418.  
  419.         $db =$this->getDBInstance();
  420.         if (PEAR::isError($db)) {
  421.             return $db;
  422.         }
  423.  
  424.         $resource = MDB2::isResultCommon($result$result->getResource($result;
  425.         if (!is_resource($resource)) {
  426.             return $db->raiseError(MDB2_ERROR_NEED_MORE_DATAnullnull,
  427.                 'Could not generate result resource'__FUNCTION__);
  428.         }
  429.  
  430.         if ($db->options['portability'MDB2_PORTABILITY_FIX_CASE{
  431.             if ($db->options['field_case'== CASE_LOWER{
  432.                 $case_func 'strtolower';
  433.             else {
  434.                 $case_func 'strtoupper';
  435.             }
  436.         else {
  437.             $case_func 'strval';
  438.         }
  439.  
  440.         $count @mssql_num_fields($resource);
  441.         $res   = array();
  442.  
  443.         if ($mode{
  444.             $res['num_fields'$count;
  445.         }
  446.  
  447.         $db->loadModule('Datatype'nulltrue);
  448.         for ($i = 0; $i $count$i++{
  449.             $res[$i= array(
  450.                 'table' => '',
  451.                 'name'  => $case_func(@mssql_field_name($resource$i)),
  452.                 'type'  => @mssql_field_type($resource$i),
  453.                 'length'   => @mssql_field_length($resource$i),
  454.                 'flags' => '',
  455.             );
  456.             $mdb2type_info $db->datatype->mapNativeDatatype($res[$i]);
  457.             if (PEAR::isError($mdb2type_info)) {
  458.                return $mdb2type_info;
  459.             }
  460.             $res[$i]['mdb2type'$mdb2type_info[0][0];
  461.             if ($mode MDB2_TABLEINFO_ORDER{
  462.                 $res['order'][$res[$i]['name']] $i;
  463.             }
  464.             if ($mode MDB2_TABLEINFO_ORDERTABLE{
  465.                 $res['ordertable'][$res[$i]['table']][$res[$i]['name']] $i;
  466.             }
  467.         }
  468.  
  469.         return $res;
  470.     }
  471.  
  472.     // }}}
  473.     // {{{ _mssql_field_flags()
  474.  
  475.     /**
  476.      * Get a column's flags
  477.      *
  478.      * Supports "not_null", "primary_key",
  479.      * "auto_increment" (mssql identity), "timestamp" (mssql timestamp),
  480.      * "unique_key" (mssql unique index, unique check or primary_key) and
  481.      * "multiple_key" (multikey index)
  482.      *
  483.      * mssql timestamp is NOT similar to the mysql timestamp so this is maybe
  484.      * not useful at all - is the behaviour of mysql_field_flags that primary
  485.      * keys are alway unique? is the interpretation of multiple_key correct?
  486.      *
  487.      * @param string $table   the table name
  488.      * @param string $column  the field name
  489.      *
  490.      * @return string  the flags
  491.      *
  492.      * @access protected
  493.      * @author Joern Barthel <j_barthel@web.de>
  494.      */
  495.     function _mssql_field_flags($table$column)
  496.     {
  497.         $db =$this->getDBInstance();
  498.         if (PEAR::isError($db)) {
  499.             return $db;
  500.         }
  501.  
  502.         static $tableName = null;
  503.         static $flags = array();
  504.  
  505.         if ($table != $tableName{
  506.  
  507.             $flags = array();
  508.             $tableName $table;
  509.  
  510.             // get unique and primary keys
  511.             $res $db->queryAll("EXEC SP_HELPINDEX[$table]"nullMDB2_FETCHMODE_ASSOC);
  512.  
  513.             foreach ($res as $val{
  514.                 $val array_change_key_case($valCASE_LOWER);
  515.                 $keys explode(', '$val['index_keys']);
  516.  
  517.                 if (sizeof($keys> 1{
  518.                     foreach ($keys as $key{
  519.                         $this->_add_flag($flags[$key]'multiple_key');
  520.                     }
  521.                 }
  522.  
  523.                 if (strpos($val['index_description']'primary key')) {
  524.                     foreach ($keys as $key{
  525.                         $this->_add_flag($flags[$key]'primary_key');
  526.                     }
  527.                 elseif (strpos($val['index_description']'unique')) {
  528.                     foreach ($keys as $key{
  529.                         $this->_add_flag($flags[$key]'unique_key');
  530.                     }
  531.                 }
  532.             }
  533.  
  534.             // get auto_increment, not_null and timestamp
  535.             $res $db->queryAll("EXEC SP_COLUMNS[$table]"nullMDB2_FETCHMODE_ASSOC);
  536.  
  537.             foreach ($res as $val{
  538.                 $val array_change_key_case($valCASE_LOWER);
  539.                 if ($val['nullable'== '0'{
  540.                     $this->_add_flag($flags[$val['column_name']]'not_null');
  541.                 }
  542.                 if (strpos($val['type_name']'identity')) {
  543.                     $this->_add_flag($flags[$val['column_name']]'auto_increment');
  544.                 }
  545.                 if (strpos($val['type_name']'timestamp')) {
  546.                     $this->_add_flag($flags[$val['column_name']]'timestamp');
  547.                 }
  548.             }
  549.         }
  550.  
  551.         if (!empty($flags[$column])) {
  552.             return(implode(' '$flags[$column]));
  553.         }
  554.         return '';
  555.     }
  556.  
  557.     // }}}
  558.     // {{{ _add_flag()
  559.  
  560.     /**
  561.      * Adds a string to the flags array if the flag is not yet in there
  562.      * - if there is no flag present the array is created
  563.      *
  564.      * @param array  &$array  the reference to the flag-array
  565.      * @param string $value   the flag value
  566.      *
  567.      * @return void 
  568.      *
  569.      * @access protected
  570.      * @author Joern Barthel <j_barthel@web.de>
  571.      */
  572.     function _add_flag(&$array$value)
  573.     {
  574.         if (!is_array($array)) {
  575.             $array = array($value);
  576.         elseif (!in_array($value$array)) {
  577.             array_push($array$value);
  578.         }
  579.     }
  580.  
  581.     // }}}
  582. }
  583. ?>

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