public function exec($query, $params=array()) {

		$this->openConnection();
		
		$this->query = $query;
		
		try {

			$stat = $this->handler->prepare($this->query);
			$stat->execute((array)$params);
			$affected = $stat->rowCount();

		} catch (\PDOException $e) {

			// logger
			$this->logParamQuery($this->query, 0, $params);

			switch ($e->getCode()) {
				
				// integrity constraint violation
				/*
				case '23000':
					$message = 'Database integrity constraint violation';
					break;
				*/
				default:
					$message = $e->getMessage();
					break;
			}
			
			$this->addError($message);
				
			$affected = 0;
		
		} catch (\Exception $e) {
			
			// logger
			$this->logParamQuery($this->query, 0, $params);
			$this->addError($e->getMessage());
			$affected = 0;
		
		}
		
		$stat->closeCursor();
		$this->logParamQuery($this->query, $affected, $params);
		
		return $affected;
		
	}
public function exec($query, $params=array()) {

		$this->openConnection();
		
		$this->query = $query;
		
		try {

			$stat = $this->handler->prepare($this->query);
			$stat->execute((array)$params);
			$affected = $stat->rowCount();

		} catch (\PDOException $e) {

			// logger
			$this->logParamQuery($this->query, 0, $params);

			switch ($e->getCode()) {
				
				// integrity constraint violation
				/*
				case '23000':
					$message = 'Database integrity constraint violation';
					break;
				*/
				default:
					$message = $e->getMessage();
					break;
			}
			
			$this->addError($message);
				
			$affected = 0;
		
		} catch (\Exception $e) {
			
			// logger
			$this->logParamQuery($this->query, 0, $params);
			$this->addError($e->getMessage());
			$affected = 0;
		
		}
		
		$stat->closeCursor();
		$this->logParamQuery($this->query, $affected, $params);
		
		return $affected;
		
	}
public function exec ( $ query , $ params = array ( ) ) { $ this -> openConnection ( ) ; $ this -> query = $ query ; try { $ stat = $ this -> handler -> prepare ( $ this -> query ) ; $ stat -> execute ( ( array ) $ params ) ; $ affected = $ stat -> rowCount ( ) ; } catch ( \ PDOException $ e ) { // logger
 $ this -> logParamQuery ( $ this -> query , 0 , $ params ) ; switch ( $ e -> getCode ( ) ) { // integrity constraint violation
 /*
				case '23000':
					$message = 'Database integrity constraint violation';
					break;
				*/ default : $ message = $ e -> getMessage ( ) ; break ; } $ this -> addError ( $ message ) ; $ affected = 0 ; } catch ( \ Exception $ e ) { // logger
 $ this -> logParamQuery ( $ this -> query , 0 , $ params ) ; $ this -> addError ( $ e -> getMessage ( ) ) ; $ affected = 0 ; } $ stat -> closeCursor ( ) ; $ this -> logParamQuery ( $ this -> query , $ affected , $ params ) ; return $ affected ; }
Executes a query and returns TRUE if success.

@param	string	SQL Query da eseguire.
@param	mixed	Parameters to bind on sql query in array or simple value.

@return	mixed	Number of affected items.
Executes a query and returns TRUE if success .