public function count($type,$addSQL='',$params=array()) {
		try {
			return (int) $this->writer->count($type,$addSQL,$params);
		}catch(RedBean_Exception_SQL $e) {
			if (!$this->writer->sqlStateIn($e->getSQLState(),
			array(RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_TABLE)
			)) throw $e;
		}
		return 0;
	}