Source for file Mysql.php

Documentation is available at Mysql.php

  1. <?php
  2. /*
  3.  *  $Id: Mysql.php 2288 2007-08-29 21:51:49Z Jonathan.Wage $
  4.  *
  5.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16.  *
  17.  * This software consists of voluntary contributions made by many individuals
  18.  * and is licensed under the LGPL. For more information, see
  19.  * <http://www.phpdoctrine.com>.
  20.  */
  21. Doctrine::autoload('Doctrine_Export');
  22. /**
  23.  * Doctrine_Export_Mysql
  24.  *
  25.  * @package     Doctrine
  26.  * @author      Konsta Vesterinen <kvesteri@cc.hut.fi>
  27.  * @author      Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
  28.  * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
  29.  * @category    Object Relational Mapping
  30.  * @link        www.phpdoctrine.com
  31.  * @since       1.0
  32.  * @version     $Revision: 2288 $
  33.  */
  34. {
  35.    /**
  36.      * create a new database
  37.      *
  38.      * @param string $name name of the database that should be created
  39.      * @return string 
  40.      */
  41.     public function createDatabaseSql($name)
  42.     {
  43.         return 'CREATE DATABASE ' $this->conn->quoteIdentifier($nametrue);
  44.     }
  45.     /**
  46.      * drop an existing database
  47.      *
  48.      * @param string $name name of the database that should be dropped
  49.      * @return string 
  50.      */
  51.     public function dropDatabaseSql($name)
  52.     {
  53.         return 'DROP DATABASE ' $this->conn->quoteIdentifier($name);
  54.     }
  55.     /**
  56.      * create a new table
  57.      *
  58.      * @param string $name   Name of the database that should be created
  59.      * @param array $fields  Associative array that contains the definition of each field of the new table
  60.      *                        The indexes of the array entries are the names of the fields of the table an
  61.      *                        the array entry values are associative arrays like those that are meant to be
  62.      *                        passed with the field definitions to get[Type]Declaration() functions.
  63.      *                           array(
  64.      *                               'id' => array(
  65.      *                                   'type' => 'integer',
  66.      *                                   'unsigned' => 1
  67.      *                                   'notnull' => 1
  68.      *                                   'default' => 0
  69.      *                               ),
  70.      *                               'name' => array(
  71.      *                                   'type' => 'text',
  72.      *                                   'length' => 12
  73.      *                               ),
  74.      *                               'password' => array(
  75.      *                                   'type' => 'text',
  76.      *                                   'length' => 12
  77.      *                               )
  78.      *                           );
  79.      * @param array $options  An associative array of table options:
  80.      *                           array(
  81.      *                               'comment' => 'Foo',
  82.      *                               'charset' => 'utf8',
  83.      *                               'collate' => 'utf8_unicode_ci',
  84.      *                               'type'    => 'innodb',
  85.      *                           );
  86.      *
  87.      * @return void 
  88.      */
  89.     public function createTableSql($namearray $fieldsarray $options array()) 
  90.     {
  91.         if $name)
  92.             throw new Doctrine_Export_Exception('no valid table name specified');
  93.  
  94.         if (empty($fields)) {
  95.             throw new Doctrine_Export_Exception('no fields specified for table "'.$name.'"');
  96.         }
  97.         $queryFields $this->getFieldDeclarationList($fields);
  98.         
  99.         // build indexes for all foreign key fields (needed in MySQL!!)
  100.         if (isset($options['foreignKeys'])) {
  101.             foreach ($options['foreignKeys'as $fk{
  102.                 $local $fk['local'];
  103.                 $found false;
  104.                 if (isset($options['indexes'])) {
  105.                     foreach ($options['indexes'as $definition{
  106.                         if (is_string($definition['fields'])) {
  107.                             // Check if index already exists on the column                            
  108.                             $found ($local == $definition['fields']);                        
  109.                         else if (in_array($local$definition['fields']&& count($definition['fields']=== 1{
  110.                             // Index already exists on the column
  111.                             $found true;
  112.                         }
  113.                     }
  114.                 }
  115.                 if (isset($options['primary']&& !empty($options['primary']&&
  116.                         in_array($local$options['primary'])) {
  117.                     // field is part of the PK and therefore already indexed
  118.                     $found true;
  119.                 }
  120.                 
  121.                 if $found{
  122.                     $options['indexes'][$localarray('fields' => array($local => array()));
  123.                 }
  124.             }
  125.         }
  126.  
  127.         // add all indexes
  128.         if (isset($options['indexes']&& empty($options['indexes'])) {
  129.             foreach($options['indexes'as $index => $definition{
  130.                 $queryFields .= ', ' $this->getIndexDeclaration($index$definition);
  131.             }
  132.         }
  133.  
  134.         // attach all primary keys
  135.         if (isset($options['primary']&& empty($options['primary'])) {
  136.             $queryFields .= ', PRIMARY KEY(' implode(', 'array_values($options['primary'])) ')';
  137.         }
  138.  
  139.         $query 'CREATE TABLE ' $this->conn->quoteIdentifier($nametrue' (' $queryFields ')';
  140.  
  141.         $optionStrings array();
  142.  
  143.         if (isset($options['comment'])) {
  144.             $optionStrings['comment''COMMENT = ' $this->dbh->quote($options['comment']'text');
  145.         }
  146.         if (isset($options['charset'])) {
  147.             $optionStrings['charset''DEFAULT CHARACTER SET ' $options['charset'];
  148.             if (isset($options['collate'])) {
  149.                 $optionStrings['charset'.= ' COLLATE ' $options['collate'];
  150.             }
  151.         }
  152.  
  153.         $type false;
  154.  
  155.         // get the type of the table
  156.         if (isset($options['type'])) {
  157.             $type $options['type'];
  158.         else {
  159.             $type $this->conn->getAttribute(Doctrine::ATTR_DEFAULT_TABLE_TYPE);
  160.         }
  161.  
  162.         if ($type{
  163.             $optionStrings['ENGINE = ' $type;
  164.         }
  165.  
  166.         if (!empty($optionStrings)) {
  167.             $query.= ' '.implode(' '$optionStrings);
  168.         }
  169.         $sql[$query;
  170.  
  171.         if (isset($options['foreignKeys'])) {
  172.  
  173.             foreach ((array) $options['foreignKeys'as $k => $definition{
  174.                 if (is_array($definition)) {
  175.                     $sql[$this->createForeignKeySql($name$definition);
  176.                 }
  177.             }
  178.         }   
  179.         return $sql;
  180.     }
  181.     /**
  182.      * alter an existing table
  183.      *
  184.      * @param string $name         name of the table that is intended to be changed.
  185.      * @param array $changes     associative array that contains the details of each type
  186.      *                              of change that is intended to be performed. The types of
  187.      *                              changes that are currently supported are defined as follows:
  188.      *
  189.      *                              name
  190.      *
  191.      *                                 New name for the table.
  192.      *
  193.      *                             add
  194.      *
  195.      *                                 Associative array with the names of fields to be added as
  196.      *                                  indexes of the array. The value of each entry of the array
  197.      *                                  should be set to another associative array with the properties
  198.      *                                  of the fields to be added. The properties of the fields should
  199.      *                                  be the same as defined by the Metabase parser.
  200.      *
  201.      *
  202.      *                             remove
  203.      *
  204.      *                                 Associative array with the names of fields to be removed as indexes
  205.      *                                  of the array. Currently the values assigned to each entry are ignored.
  206.      *                                  An empty array should be used for future compatibility.
  207.      *
  208.      *                             rename
  209.      *
  210.      *                                 Associative array with the names of fields to be renamed as indexes
  211.      *                                  of the array. The value of each entry of the array should be set to
  212.      *                                  another associative array with the entry named name with the new
  213.      *                                  field name and the entry named Declaration that is expected to contain
  214.      *                                  the portion of the field declaration already in DBMS specific SQL code
  215.      *                                  as it is used in the CREATE TABLE statement.
  216.      *
  217.      *                             change
  218.      *
  219.      *                                 Associative array with the names of the fields to be changed as indexes
  220.      *                                  of the array. Keep in mind that if it is intended to change either the
  221.      *                                  name of a field and any other properties, the change array entries
  222.      *                                  should have the new names of the fields as array indexes.
  223.      *
  224.      *                                 The value of each entry of the array should be set to another associative
  225.      *                                  array with the properties of the fields to that are meant to be changed as
  226.      *                                  array entries. These entries should be assigned to the new values of the
  227.      *                                  respective properties. The properties of the fields should be the same
  228.      *                                  as defined by the Metabase parser.
  229.      *
  230.      *                             Example
  231.      *                                 array(
  232.      *                                     'name' => 'userlist',
  233.      *                                     'add' => array(
  234.      *                                         'quota' => array(
  235.      *                                             'type' => 'integer',
  236.      *                                             'unsigned' => 1
  237.      *                                         )
  238.      *                                     ),
  239.      *                                     'remove' => array(
  240.      *                                         'file_limit' => array(),
  241.      *                                         'time_limit' => array()
  242.      *                                     ),
  243.      *                                     'change' => array(
  244.      *                                         'name' => array(
  245.      *                                             'length' => '20',
  246.      *                                             'definition' => array(
  247.      *                                                 'type' => 'text',
  248.      *                                                 'length' => 20,
  249.      *                                             ),
  250.      *                                         )
  251.      *                                     ),
  252.      *                                     'rename' => array(
  253.      *                                         'sex' => array(
  254.      *                                             'name' => 'gender',
  255.      *                                             'definition' => array(
  256.      *                                                 'type' => 'text',
  257.      *                                                 'length' => 1,
  258.      *                                                 'default' => 'M',
  259.      *                                             ),
  260.      *                                         )
  261.      *                                     )
  262.      *                                 )
  263.      *
  264.      * @param boolean $check     indicates whether the function should just check if the DBMS driver
  265.      *                            can perform the requested table alterations if the value is true or
  266.      *                            actually perform them otherwise.
  267.      * @return boolean 
  268.      */
  269.     public function alterTableSql($namearray $changes$check)
  270.     {
  271.         if $name{
  272.             throw new Doctrine_Export_Exception('no valid table name specified');
  273.         }
  274.         foreach ($changes as $changeName => $change{
  275.             switch ($changeName{
  276.                 case 'add':
  277.                 case 'remove':
  278.                 case 'change':
  279.                 case 'rename':
  280.                 case 'name':
  281.                     break;
  282.                 default:
  283.                     throw new Doctrine_Export_Exception('change type "' $changeName '" not yet supported');
  284.             }
  285.         }
  286.  
  287.         if ($check{
  288.             return true;
  289.         }
  290.  
  291.         $query '';
  292.         if empty($changes['name'])) {
  293.             $change_name $this->conn->quoteIdentifier($changes['name']);
  294.             $query .= 'RENAME TO ' $change_name;
  295.         }
  296.  
  297.         if empty($changes['add']&& is_array($changes['add'])) {
  298.             foreach ($changes['add'as $fieldName => $field{
  299.                 if ($query{
  300.                     $query.= ', ';
  301.                 }
  302.                 $query.= 'ADD ' $this->getDeclaration($field['type']$fieldName$field);
  303.             }
  304.         }
  305.  
  306.         if empty($changes['remove']&& is_array($changes['remove'])) {
  307.             foreach ($changes['remove'as $fieldName => $field{
  308.                 if ($query{
  309.                     $query .= ', ';
  310.                 }
  311.                 $fieldName $this->conn->quoteIdentifier($fieldName);
  312.                 $query .= 'DROP ' $fieldName;
  313.             }
  314.         }
  315.  
  316.         $rename array();
  317.         if empty($changes['rename']&& is_array($changes['rename'])) {
  318.             foreach ($changes['rename'as $fieldName => $field{
  319.                 $rename[$field['name']] $fieldName;
  320.             }
  321.         }
  322.  
  323.         if empty($changes['change']&& is_array($changes['change'])) {
  324.             foreach ($changes['change'as $fieldName => $field{
  325.                 if ($query{
  326.                     $query.= ', ';
  327.                 }
  328.                 if (isset($rename[$fieldName])) {
  329.                     $oldFieldName $rename[$fieldName];
  330.                     unset($rename[$fieldName]);
  331.                 else {
  332.                     $oldFieldName $fieldName;
  333.                 }
  334.                 $oldFieldName $this->conn->quoteIdentifier($oldFieldNametrue);
  335.                 $query .= 'CHANGE ' $oldFieldName ' ' 
  336.                         . $this->getDeclaration($field['definition']['type']$fieldName$field['definition']);
  337.             }
  338.         }
  339.  
  340.         if empty($rename&& is_array($rename)) {
  341.             foreach ($rename as $renameName => $renamedField{
  342.                 if ($query{
  343.                     $query.= ', ';
  344.                 }
  345.                 $field $changes['rename'][$renamedField];
  346.                 $renamedField $this->conn->quoteIdentifier($renamedFieldtrue);
  347.                 $query .= 'CHANGE ' $renamedField ' '
  348.                         . $this->getDeclaration($field['definition']['type']$field['name']$field['definition']);
  349.             }
  350.         }
  351.  
  352.         if $query{
  353.             return false;
  354.         }
  355.  
  356.         $name $this->conn->quoteIdentifier($nametrue);
  357.         return $this->conn->exec('ALTER TABLE ' $name ' ' $query);
  358.     }
  359.     /**
  360.      * create sequence
  361.      *
  362.      * @param string    $sequenceName name of the sequence to be created
  363.      * @param string    $start        start value of the sequence; default is 1
  364.      * @param array     $options  An associative array of table options:
  365.      *                           array(
  366.      *                               'comment' => 'Foo',
  367.      *                               'charset' => 'utf8',
  368.      *                               'collate' => 'utf8_unicode_ci',
  369.      *                               'type'    => 'innodb',
  370.      *                           );
  371.      * @return boolean 
  372.      */
  373.     public function createSequence($sequenceName$start 1array $options array())
  374.     {
  375.         $sequenceName   $this->conn->quoteIdentifier($this->conn->getSequenceName($sequenceName)true);
  376.         $seqcolName     $this->conn->quoteIdentifier($this->conn->getAttribute(Doctrine::ATTR_SEQCOL_NAME)true);
  377.  
  378.         $optionsStrings array();
  379.  
  380.         if (isset($options['comment']&& empty($options['comment'])) {
  381.             $optionsStrings['comment''COMMENT = ' $this->conn->quote($options['comment']'string');
  382.         }
  383.  
  384.         if (isset($options['charset']&& empty($options['charset'])) {
  385.             $optionsStrings['charset''DEFAULT CHARACTER SET ' $options['charset'];
  386.  
  387.             if (isset($options['collate'])) {
  388.                 $optionsStrings['collate'.= ' COLLATE ' $options['collate'];
  389.             }
  390.         }
  391.  
  392.         $type false;
  393.  
  394.         if (isset($options['type'])) {
  395.             $type $options['type'];
  396.         else {
  397.             $type $this->conn->default_table_type;
  398.         }
  399.         if ($type{
  400.             $optionsStrings['ENGINE = ' $type;
  401.         }
  402.  
  403.  
  404.         try {
  405.             $query  'CREATE TABLE ' $sequenceName
  406.                     . ' (' $seqcolName ' INT NOT NULL AUTO_INCREMENT, PRIMARY KEY ('
  407.                     . $seqcolName '))'
  408.                     . strlen($this->conn->default_table_type' TYPE = '
  409.                     . $this->conn->default_table_type '';
  410.  
  411.             $res    $this->conn->exec($query);
  412.         catch(Doctrine_Connection_Exception $e{
  413.             throw new Doctrine_Export_Exception('could not create sequence table');
  414.         }
  415.  
  416.         if ($start == 1)
  417.             return true;
  418.  
  419.         $query  'INSERT INTO ' $sequenceName
  420.                 . ' (' $seqcolName ') VALUES (' ($start 1')';
  421.  
  422.         $res    $this->conn->exec($query);
  423.  
  424.         // Handle error
  425.         try {
  426.             $result $this->conn->exec('DROP TABLE ' $sequenceName);
  427.         catch(Doctrine_Connection_Exception $e{
  428.             throw new Doctrine_Export_Exception('could not drop inconsistent sequence table');
  429.         }
  430.  
  431.  
  432.     }
  433.     /**
  434.      * Get the stucture of a field into an array
  435.      *
  436.      * @author Leoncx
  437.      * @param string    $table         name of the table on which the index is to be created
  438.      * @param string    $name          name of the index to be created
  439.      * @param array     $definition    associative array that defines properties of the index to be created.
  440.      *                                  Currently, only one property named FIELDS is supported. This property
  441.      *                                  is also an associative with the names of the index fields as array
  442.      *                                  indexes. Each entry of this array is set to another type of associative
  443.      *                                  array that specifies properties of the index that are specific to
  444.      *                                  each field.
  445.      *
  446.      *                                  Currently, only the sorting property is supported. It should be used
  447.      *                                  to define the sorting direction of the index. It may be set to either
  448.      *                                  ascending or descending.
  449.      *
  450.      *                                  Not all DBMS support index sorting direction configuration. The DBMS
  451.      *                                  drivers of those that do not support it ignore this property. Use the
  452.      *                                  function supports() to determine whether the DBMS driver can manage indexes.
  453.      *
  454.      *                                  Example
  455.      *                                     array(
  456.      *                                         'fields' => array(
  457.      *                                             'user_name' => array(
  458.      *                                                 'sorting' => 'ASC'
  459.      *                                                 'length' => 10
  460.      *                                             ),
  461.      *                                             'last_login' => array()
  462.      *                                         )
  463.      *                                     )
  464.      * @throws PDOException
  465.      * @return void 
  466.      */
  467.     public function createIndexSql($table$namearray $definition)
  468.     {
  469.         $table  $table;
  470.         $name   $this->conn->getIndexName($name);
  471.         $type   '';
  472.         if (isset($definition['type'])) {
  473.             switch (strtolower($definition['type'])) {
  474.                 case 'fulltext':
  475.                 case 'unique':
  476.                     $type strtoupper($definition['type']' ';
  477.                 break;
  478.                 default:
  479.                     throw new Doctrine_Export_Exception('Unknown index type ' $definition['type']);
  480.             }
  481.         }
  482.         $query  'CREATE ' $type 'INDEX ' $name ' ON ' $table;
  483.         $query .= ' (' $this->getIndexFieldDeclarationList(')';
  484.  
  485.         return $query;
  486.     }
  487.     /** 
  488.      * getDefaultDeclaration
  489.      * Obtain DBMS specific SQL code portion needed to set a default value
  490.      * declaration to be used in statements like CREATE TABLE.
  491.      *
  492.      * @param array $field      field definition array
  493.      * @return string           DBMS specific SQL code portion needed to set a default value
  494.      */
  495.     public function getDefaultFieldDeclaration($field)
  496.     {
  497.         $default '';
  498.         if (isset($field['default']&& $field['length'<= 255{
  499.             if ($field['default'=== ''{
  500.                 $field['default'empty($field['notnull'])
  501.                     ? null $this->valid_default_values[$field['type']];
  502.  
  503.                 if ($field['default'=== ''
  504.                     && ($conn->getAttribute(Doctrine::ATTR_PORTABILITYDoctrine::PORTABILITY_EMPTY_TO_NULL)
  505.                 {
  506.                     $field['default'' ';
  507.                 }
  508.             }
  509.     
  510.             $default ' DEFAULT ' $this->conn->quote($field['default']$field['type']);
  511.         }
  512.         return $default;
  513.     }
  514.     /**
  515.      * Obtain DBMS specific SQL code portion needed to set an index
  516.      * declaration to be used in statements like CREATE TABLE.
  517.      *
  518.      * @param string $charset       name of the index
  519.      * @param array $definition     index definition
  520.      * @return string  DBMS specific SQL code portion needed to set an index
  521.      */
  522.     public function getIndexDeclaration($namearray $definition)
  523.     {
  524.         $name   $this->conn->quoteIdentifier($name);
  525.         $type   '';
  526.         if(isset($definition['type'])) {
  527.             switch (strtolower($definition['type'])) {
  528.                 case 'fulltext':
  529.                 case 'unique':
  530.                     $type strtoupper($definition['type']' ';
  531.                 break;
  532.                 default:
  533.                     throw new Doctrine_Export_Exception('Unknown index type ' $definition['type']);
  534.             }
  535.         }
  536.         
  537.         if isset($definition['fields'])) {
  538.             throw new Doctrine_Export_Exception('No index columns given.');
  539.         }
  540.         if is_array($definition['fields'])) {
  541.             $definition['fields'array($definition['fields']);
  542.         }
  543.  
  544.         $query $type 'INDEX ' $this->conn->formatter->getIndexName($name);
  545.  
  546.         $query .= ' (' $this->getIndexFieldDeclarationList($definition['fields']')';
  547.         
  548.         return $query;
  549.     }
  550.     /**
  551.      * getIndexFieldDeclarationList
  552.      * Obtain DBMS specific SQL code portion needed to set an index
  553.      * declaration to be used in statements like CREATE TABLE.
  554.      *
  555.      * @return string 
  556.      */
  557.     public function getIndexFieldDeclarationList(array $fields)
  558.     {
  559.         $declFields array();
  560.  
  561.         foreach ($fields as $fieldName => $field{
  562.             $fieldString $fieldName;
  563.  
  564.             if (is_array($field)) {
  565.                 if (isset($field['length'])) {
  566.                     $fieldString .= '(' $field['length'')';
  567.                 }
  568.  
  569.                 if (isset($field['sorting'])) {
  570.                     $sort strtoupper($field['sorting']);
  571.                     switch ($sort{
  572.                         case 'ASC':
  573.                         case 'DESC':
  574.                             $fieldString .= ' ' $sort;
  575.                             break;
  576.                         default:
  577.                             throw new Doctrine_Export_Exception('Unknown index sorting option given.');
  578.                     }
  579.                 }
  580.             else {
  581.                 $fieldString $field;
  582.             }
  583.             $declFields[$fieldString;
  584.         }
  585.         return implode(', '$declFields);
  586.     }
  587.     /**
  588.      * getAdvancedForeignKeyOptions
  589.      * Return the FOREIGN KEY query section dealing with non-standard options
  590.      * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
  591.      *
  592.      * @param array $definition 
  593.      * @return string 
  594.      */
  595.     public function getAdvancedForeignKeyOptions(array $definition)
  596.     {
  597.         $query '';
  598.         if (!empty($definition['match'])) {
  599.             $query .= ' MATCH ' $definition['match'];
  600.         }
  601.         if (!empty($definition['onUpdate'])) {
  602.             $query .= ' ON UPDATE ' $this->getForeignKeyReferentialAction($definition['onUpdate']);
  603.         }
  604.         if (!empty($definition['onDelete'])) {
  605.             $query .= ' ON DELETE ' $this->getForeignKeyReferentialAction($definition['onDelete']);
  606.         }
  607.         return $query;
  608.     }
  609.     /**
  610.      * drop existing index
  611.      *
  612.      * @param string    $table          name of table that should be used in method
  613.      * @param string    $name           name of the index to be dropped
  614.      * @return void 
  615.      */
  616.     public function dropIndexSql($table$name)
  617.     {
  618.         $table  $this->conn->quoteIdentifier($tabletrue);
  619.         $name   $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name)true);
  620.         return 'DROP INDEX ' $name ' ON ' $table;
  621.     }
  622.     /**
  623.      * dropTable
  624.      *
  625.      * @param string    $table          name of table that should be dropped from the database
  626.      * @throws PDOException
  627.      * @return void 
  628.      */
  629.     public function dropTableSql($table)
  630.     {
  631.         $table  $this->conn->quoteIdentifier($tabletrue);
  632.         return 'DROP TABLE ' $table;
  633.     }
  634. }