private function executeCreateUpdateQuery (&$query)
	{
		
		// Execute

		try
		{
			$query->execute ();
			return TRUE;
		}
		catch (\PDOException $e)
		{
			
			// Catch some errors
			
			switch ($e->getCode ())
			{
				
				// Duplicate Key
				
				case 23000:
				
					// Get attribute name and set error

					if (preg_match ('/Duplicate entry \'(.*?)\' for key \'(.*?)\'/', $e->getMessage (), $match))
					{
						$name	= $this->attributeExists ($match[2]) && isset (static::$attributes[$match[2]]['name'])? static::$attributes[$match[2]]['name'] : $match[2];
						new Message ('error',  'Please choose another ' . ucwords ($name) . ' `' . $match[1] . '` already exists!');
						return FALSE;
					}

					// Else unrecognised message so throw the error again

					else
					{
						throw $e;
					}
					
					break;
					
					
				// Throw error by default
					
				default:
					throw $e;
				
			}
			
		}
		
	}
private function executeCreateUpdateQuery (&$query)
	{
		
		// Execute

		try
		{
			$query->execute ();
			return TRUE;
		}
		catch (\PDOException $e)
		{
			
			// Catch some errors
			
			switch ($e->getCode ())
			{
				
				// Duplicate Key
				
				case 23000:
				
					// Get attribute name and set error

					if (preg_match ('/Duplicate entry \'(.*?)\' for key \'(.*?)\'/', $e->getMessage (), $match))
					{
						$name	= $this->attributeExists ($match[2]) && isset (static::$attributes[$match[2]]['name'])? static::$attributes[$match[2]]['name'] : $match[2];
						new Message ('error',  'Please choose another ' . ucwords ($name) . ' `' . $match[1] . '` already exists!');
						return FALSE;
					}

					// Else unrecognised message so throw the error again

					else
					{
						throw $e;
					}
					
					break;
					
					
				// Throw error by default
					
				default:
					throw $e;
				
			}
			
		}
		
	}
private function executeCreateUpdateQuery ( & $ query ) { // Execute try { $ query -> execute ( ) ; return TRUE ; } catch ( \ PDOException $ e ) { // Catch some errors switch ( $ e -> getCode ( ) ) { // Duplicate Key case 23000 : // Get attribute name and set error if ( preg_match ( '/Duplicate entry \'(.*?)\' for key \'(.*?)\'/' , $ e -> getMessage ( ) , $ match ) ) { $ name = $ this -> attributeExists ( $ match [ 2 ] ) && isset ( static :: $ attributes [ $ match [ 2 ] ] [ 'name' ] ) ? static :: $ attributes [ $ match [ 2 ] ] [ 'name' ] : $ match [ 2 ] ; new Message ( 'error' , 'Please choose another ' . ucwords ( $ name ) . ' `' . $ match [ 1 ] . '` already exists!' ) ; return FALSE ; } // Else unrecognised message so throw the error again else { throw $ e ; } break ; // Throw error by default default : throw $ e ; } } }
Execute create or update query and cope with an exception
@param \PDOStatement $query Query object to bind values to
@return boolean
@throws PDOException
Execute create or update query and cope with an exception