Ignore:
Timestamp:
10/03/2009 02:39:52 PM (3 years ago)
Author:
Acinonyx
Message:

[awmn] Add support for multiple-table deletes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/awmn/globals/classes/mysql.php

    r198 r206  
    44 * 
    55 * Copyright (C) 2005 Nikolaos Nikalexis <winner@cube.gr> 
     6 * Copyright (C) 2009 Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> 
    67 *  
    78 * This program is free software; you can redistribute it and/or modify 
     
    173174        } 
    174175 
    175         function del($table, $where="", $addlog=TRUE) { 
     176        function del($table, $using="", $where="", $addlog=TRUE) { 
    176177                $table_start = preg_split("/[\s,]+/", $table); 
    177178                $table_start = $table_start[0]; 
    178                 if ($addlog && $this->log) $aff = $this->query_data("SELECT ".$table_start.".id FROM $table".($where==""?"":" WHERE $where")); 
    179                 $query = "DELETE FROM $table".($where==""?"":" WHERE $where"); 
     179                if ($addlog && $this->log) $aff = $this->query_data("SELECT ".$table_start.".id FROM ".($using==""?"$table":"$using").($where==""?"":" WHERE $where")); 
     180                $query = "DELETE FROM $table".($using==""?"":" USING $using").($where==""?"":" WHERE $where"); 
    180181                $res = $this->query_data($query); 
    181182                if ($addlog && isset($aff)) { 
Note: See TracChangeset for help on using the changeset viewer.