@@ 1988-2007 (lines=20) @@ | ||
1985 | * @param string the table to empty |
|
1986 | * @return object |
|
1987 | */ |
|
1988 | public function empty_table($table = '') |
|
1989 | { |
|
1990 | if ($table === '') |
|
1991 | { |
|
1992 | if ( ! isset($this->qb_from[0])) |
|
1993 | { |
|
1994 | return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; |
|
1995 | } |
|
1996 | ||
1997 | $table = $this->qb_from[0]; |
|
1998 | } |
|
1999 | else |
|
2000 | { |
|
2001 | $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); |
|
2002 | } |
|
2003 | ||
2004 | $sql = $this->_delete($table); |
|
2005 | $this->_reset_write(); |
|
2006 | return $this->query($sql); |
|
2007 | } |
|
2008 | ||
2009 | // -------------------------------------------------------------------- |
|
2010 | ||
@@ 2021-2040 (lines=20) @@ | ||
2018 | * @param string the table to truncate |
|
2019 | * @return object |
|
2020 | */ |
|
2021 | public function truncate($table = '') |
|
2022 | { |
|
2023 | if ($table === '') |
|
2024 | { |
|
2025 | if ( ! isset($this->qb_from[0])) |
|
2026 | { |
|
2027 | return ($this->db_debug) ? $this->display_error('db_must_set_table') : FALSE; |
|
2028 | } |
|
2029 | ||
2030 | $table = $this->qb_from[0]; |
|
2031 | } |
|
2032 | else |
|
2033 | { |
|
2034 | $table = $this->protect_identifiers($table, TRUE, NULL, FALSE); |
|
2035 | } |
|
2036 | ||
2037 | $sql = $this->_truncate($table); |
|
2038 | $this->_reset_write(); |
|
2039 | return $this->query($sql); |
|
2040 | } |
|
2041 | ||
2042 | // -------------------------------------------------------------------- |
|
2043 |