Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TSqlDelete.php

Documentation is available at TSqlDelete.php

  1. <?php
  2. namespace Adianti\Database;
  3.  
  4. use Adianti\Database\TSqlStatement;
  5.  
  6. /**
  7.  * Provides an Interface to create DELETE statements
  8.  *
  9.  * @version    7.4
  10.  * @package    database
  11.  * @author     Pablo Dall'Oglio
  12.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  13.  * @license    http://www.adianti.com.br/framework-license
  14.  */
  15. class TSqlDelete extends TSqlStatement
  16. {
  17.     protected $sql;
  18.     protected $criteria;    // stores the select criteria
  19.     
  20.     /**
  21.      * Returns a string containing the DELETE plain statement
  22.      * @param $prepared Return a prepared Statement
  23.      */
  24.     public function getInstruction$prepared FALSE )
  25.     {
  26.         // creates the DELETE instruction
  27.         $this->sql  = "DELETE FROM {$this->entity}";
  28.         
  29.         // concatenates with the criteria (WHERE)
  30.         if ($this->criteria)
  31.         {
  32.             $dbInfo = TTransaction::getDatabaseInfo();
  33.             if (isset($dbInfo['case']) && $dbInfo['case'] == 'insensitive')
  34.             {
  35.                 $this->criteria->setCaseInsensitive(TRUE);
  36.             }
  37.  
  38.             $expression = $this->criteria->dump$prepared );
  39.             if ($expression)
  40.             {
  41.                 $this->sql .= ' WHERE ' $expression;
  42.             }
  43.         }
  44.         return $this->sql;
  45.     }