Daniia/Daniia.php
final public function delete( $ids = [] ) {
      if (func_num_args()>0) {
         if (func_num_args()==1) {
            if (!is_array($ids)) {
               $ids = (array) $ids;
            }
         }
         else {
            $ids = func_get_args();
         }
      }

      $this->connection();
      if ( $this->find_delete_data ) {
         if(is_object($this->data) && $this->data) {
            $ids[] = $this->data->{$this->primaryKey};
         }

         if(is_array($this->data) && $this->data) {
            foreach($this->data as $data)
               $ids[] = $data->{$this->primaryKey};
         }

         $this->find_delete_data = FALSE;

         if (!count( $ids )) {
            return FALSE;
         }
      }

      if ( $this->is_assoc( $ids ) ) {
         $this->where( $ids );
         $ids = NULL;
      }
      else {
         $this->placeholder_data = $ids;
         $placeholder = $this->get_placeholder($ids);
      }
      

      $where = '';
      if ( $ids ) {
         if (preg_match("/WHERE/", $this->where))
            $where = " {$this->where} AND {$this->primaryKey} IN({$placeholder}) ";
         else
            $where = " WHERE {$this->primaryKey} IN({$placeholder}) ";
      }
      else {
         if (preg_match("/WHERE/", $this->where))
            $where = $this->where;
      }

      $schema = '';
      if($this->driver=='pgsql' && $this->schema) {
         if (!preg_match('/\./', $this->table)) {
            $schema = $this->schema ? $this->schema.'.' : '';	
         }
      }

      $this->last_sql = $this->sql = "DELETE FROM {$schema}{$this->table} {$where}";

      // $this->fetch(false);
      $this->fetch();

      $this->reset();

      if ( $this->tableOrig!==null ) {
         $this->table = $this->tableOrig;
      }

      $error = $this->error();
      return $error['message'] ? false : true;
   }
final public function delete( $ids = [] ) {
      if (func_num_args()>0) {
         if (func_num_args()==1) {
            if (!is_array($ids)) {
               $ids = (array) $ids;
            }
         }
         else {
            $ids = func_get_args();
         }
      }

      $this->connection();
      if ( $this->find_delete_data ) {
         if(is_object($this->data) && $this->data) {
            $ids[] = $this->data->{$this->primaryKey};
         }

         if(is_array($this->data) && $this->data) {
            foreach($this->data as $data)
               $ids[] = $data->{$this->primaryKey};
         }

         $this->find_delete_data = FALSE;

         if (!count( $ids )) {
            return FALSE;
         }
      }

      if ( $this->is_assoc( $ids ) ) {
         $this->where( $ids );
         $ids = NULL;
      }
      else {
         $this->placeholder_data = $ids;
         $placeholder = $this->get_placeholder($ids);
      }
      

      $where = '';
      if ( $ids ) {
         if (preg_match("/WHERE/", $this->where))
            $where = " {$this->where} AND {$this->primaryKey} IN({$placeholder}) ";
         else
            $where = " WHERE {$this->primaryKey} IN({$placeholder}) ";
      }
      else {
         if (preg_match("/WHERE/", $this->where))
            $where = $this->where;
      }

      $schema = '';
      if($this->driver=='pgsql' && $this->schema) {
         if (!preg_match('/\./', $this->table)) {
            $schema = $this->schema ? $this->schema.'.' : '';	
         }
      }

      $this->last_sql = $this->sql = "DELETE FROM {$schema}{$this->table} {$where}";

      // $this->fetch(false);
      $this->fetch();

      $this->reset();

      if ( $this->tableOrig!==null ) {
         $this->table = $this->tableOrig;
      }

      $error = $this->error();
      return $error['message'] ? false : true;
   }
final public function delete ( $ ids = [ ] ) { if ( func_num_args ( ) > 0 ) { if ( func_num_args ( ) == 1 ) { if ( ! is_array ( $ ids ) ) { $ ids = ( array ) $ ids ; } } else { $ ids = func_get_args ( ) ; } } $ this -> connection ( ) ; if ( $ this -> find_delete_data ) { if ( is_object ( $ this -> data ) && $ this -> data ) { $ ids [ ] = $ this -> data -> { $ this -> primaryKey } ; } if ( is_array ( $ this -> data ) && $ this -> data ) { foreach ( $ this -> data as $ data ) $ ids [ ] = $ data -> { $ this -> primaryKey } ; } $ this -> find_delete_data = FALSE ; if ( ! count ( $ ids ) ) { return FALSE ; } } if ( $ this -> is_assoc ( $ ids ) ) { $ this -> where ( $ ids ) ; $ ids = NULL ; } else { $ this -> placeholder_data = $ ids ; $ placeholder = $ this -> get_placeholder ( $ ids ) ; } $ where = '' ; if ( $ ids ) { if ( preg_match ( "/WHERE/" , $ this -> where ) ) $ where = " {$this->where} AND {$this->primaryKey} IN({$placeholder}) " ; else $ where = " WHERE {$this->primaryKey} IN({$placeholder}) " ; } else { if ( preg_match ( "/WHERE/" , $ this -> where ) ) $ where = $ this -> where ; } $ schema = '' ; if ( $ this -> driver == 'pgsql' && $ this -> schema ) { if ( ! preg_match ( '/\./' , $ this -> table ) ) { $ schema = $ this -> schema ? $ this -> schema . '.' : '' ; } } $ this -> last_sql = $ this -> sql = "DELETE FROM {$schema}{$this->table} {$where}" ; // $this->fetch(false); $ this -> fetch ( ) ; $ this -> reset ( ) ; if ( $ this -> tableOrig !== null ) { $ this -> table = $ this -> tableOrig ; } $ error = $ this -> error ( ) ; return $ error [ 'message' ] ? false : true ; }
elimina un registro en la base de datos
@author Carlos Garcia
@param $ids mixed
@return boolean
elimina un registro en la base de datos