PHP Classes

File: src/SQLTools/Command/AddIndex.php

Recommend this page to a friend!
  Classes of Rafael Lúcio   SQLTools   src/SQLTools/Command/AddIndex.php   Download  
File: src/SQLTools/Command/AddIndex.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: SQLTools
Create and alter databases, tables and indexes
Author: By
Last change: Update of src/SQLTools/Command/AddIndex.php
Date: 11 months ago
Size: 583 bytes
 

Contents

Class file image Download
<?php
/**
 * Created by PhpStorm.
 * User: rfontes
 * Date: 18/11/13
 * Time: 08:56
 */

namespace SQLTools\Command;


class
AddIndex extends AlterTable {

    private
$fields;
    private
$idxName;

   
/**
     * @param array $fields - List of field names
     * @param string $idxName - Index name
     */
   
public function __construct(array $fields, $idxName="")
    {
       
$this->fields = $fields;
       
$this->idxName = $idxName;
    }

    protected function
getWhatToAdd()
    {
        return
"INDEX " . $this->idxName . "(".implode(",", $this->fields).")";
    }

}