[Openfirst-cvscommit] base/includes dbase.php,1.9,1.10
Brought to you by:
xtimg
From: Jamie <ast...@us...> - 2005-10-16 19:32:54
|
Update of /cvsroot/openfirst/base/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5619/includes Modified Files: dbase.php Log Message: Added DataBase::delete(), and some comments for another method Index: dbase.php =================================================================== RCS file: /cvsroot/openfirst/base/includes/dbase.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dbase.php 15 Oct 2005 19:21:01 -0000 1.9 --- dbase.php 16 Oct 2005 19:32:40 -0000 1.10 *************** *** 264,268 **** * @param array $values An array of values to SET * @param array $conds An array of conditions (WHERE) ! * @param array $options Nothing (was an array of UPDATE options, can be one or * more of IGNORE, LOW_PRIORITY) */ --- 264,268 ---- * @param array $values An array of values to SET * @param array $conds An array of conditions (WHERE) ! * @param array $options Nothing (was: an array of UPDATE options, can be one or * more of IGNORE, LOW_PRIORITY) */ *************** *** 291,294 **** --- 291,312 ---- return $this->query( $sql ); } + + /** + * DELETE query wrapper + * + * Use $conds == "*" to delete all rows + */ + function delete( $table, $conds ) { + if ( !$conds ) { + //ofDebugDieBacktrace( 'Database::delete() called with no conditions' ); + trigger_error(E_USER_ERROR, 'DataBase::delete() called with no conditions'); + } + $table = $this->quoteTable( $table ); + $sql = "DELETE FROM $table"; + if ( $conds != '*' ) { + $sql .= ' WHERE ' . $this->quoteFDPairs( $conds ); + } + return $this->query( $sql ); + } } ?> \ No newline at end of file |