function Execute($sql)
	{
		$result = null;
		
		if ($this->ConnectionSetting->IsReadOnlySlave) {
			
			// this is a read-only slave connection attempting a write operation.  we
			// will only proceed if the connection specifies a "master" delegate connection
			if (!$this->_masterAdapter) {
				
				if ($this->ConnectionSetting->MasterConnectionDelegate) {
					
					$this->Observe("DataAdapter ($this->_label) (DataAdapter.Execute) Delegating write operation from Slave to Master Connection", OBSERVE_INFO);
				
					$this->_masterAdapter = new DataAdapter($this->ConnectionSetting->MasterConnectionDelegate);
					
					foreach ($this->_observers as $observer) {
						$this->_masterAdapter->AttachObserver($observer);
					}
				}
				else {
					throw new Exception('DB Write operation was attempted on a read-only slave connection');
				}
			}
			
			// we have a master connection initialized and ready to use
			$result = $this->_masterAdapter->Execute($sql);

		}
		else {
			$this->RequireConnection(true);
			$this->Observe("DataAdapter ($this->_label) (DataAdapter.Execute) " . $sql, OBSERVE_QUERY);
			$result = -1;
			
			try
			{
				$result = $this->_driver->Execute($this->_dbconn, $sql);
				$this->_num_retries = 0;
			}
			catch (Exception $ex)
			{
				// retry one time a communication error occurs
				if ($this->_num_retries == 0 && DataAdapter::$RETRY_ON_COMMUNICATION_ERROR && $this->IsCommunicationError($ex))
				{
					$this->_num_retries++;
					$this->Observe("DataAdapter ($this->_label) Communication error.  Retry attempt " . $this->_num_retries, OBSERVE_WARN);
					sleep(2); // slight delay to prevent throttling
					return $this->Execute($sql);
				}
				
				$msg = "DataAdapter ($this->_label)" . ' Error Executing SQL: ' . $ex->getMessage() . ' (retry attempts: '.$this->_num_retries.')';
				
				$this->Observe($msg,OBSERVE_FATAL);
				throw new Exception($msg,$ex->getCode());
			}
			}
		return $result;
	}
function Execute($sql)
	{
		$result = null;
		
		if ($this->ConnectionSetting->IsReadOnlySlave) {
			
			// this is a read-only slave connection attempting a write operation.  we
			// will only proceed if the connection specifies a "master" delegate connection
			if (!$this->_masterAdapter) {
				
				if ($this->ConnectionSetting->MasterConnectionDelegate) {
					
					$this->Observe("DataAdapter ($this->_label) (DataAdapter.Execute) Delegating write operation from Slave to Master Connection", OBSERVE_INFO);
				
					$this->_masterAdapter = new DataAdapter($this->ConnectionSetting->MasterConnectionDelegate);
					
					foreach ($this->_observers as $observer) {
						$this->_masterAdapter->AttachObserver($observer);
					}
				}
				else {
					throw new Exception('DB Write operation was attempted on a read-only slave connection');
				}
			}
			
			// we have a master connection initialized and ready to use
			$result = $this->_masterAdapter->Execute($sql);

		}
		else {
			$this->RequireConnection(true);
			$this->Observe("DataAdapter ($this->_label) (DataAdapter.Execute) " . $sql, OBSERVE_QUERY);
			$result = -1;
			
			try
			{
				$result = $this->_driver->Execute($this->_dbconn, $sql);
				$this->_num_retries = 0;
			}
			catch (Exception $ex)
			{
				// retry one time a communication error occurs
				if ($this->_num_retries == 0 && DataAdapter::$RETRY_ON_COMMUNICATION_ERROR && $this->IsCommunicationError($ex))
				{
					$this->_num_retries++;
					$this->Observe("DataAdapter ($this->_label) Communication error.  Retry attempt " . $this->_num_retries, OBSERVE_WARN);
					sleep(2); // slight delay to prevent throttling
					return $this->Execute($sql);
				}
				
				$msg = "DataAdapter ($this->_label)" . ' Error Executing SQL: ' . $ex->getMessage() . ' (retry attempts: '.$this->_num_retries.')';
				
				$this->Observe($msg,OBSERVE_FATAL);
				throw new Exception($msg,$ex->getCode());
			}
			}
		return $result;
	}
function Execute ( $ sql ) { $ result = null ; if ( $ this -> ConnectionSetting -> IsReadOnlySlave ) { // this is a read-only slave connection attempting a write operation.  we
 // will only proceed if the connection specifies a "master" delegate connection
 if ( ! $ this -> _masterAdapter ) { if ( $ this -> ConnectionSetting -> MasterConnectionDelegate ) { $ this -> Observe ( "DataAdapter ($this->_label) (DataAdapter.Execute) Delegating write operation from Slave to Master Connection" , OBSERVE_INFO ) ; $ this -> _masterAdapter = new DataAdapter ( $ this -> ConnectionSetting -> MasterConnectionDelegate ) ; foreach ( $ this -> _observers as $ observer ) { $ this -> _masterAdapter -> AttachObserver ( $ observer ) ; } } else { throw new Exception ( 'DB Write operation was attempted on a read-only slave connection' ) ; } } // we have a master connection initialized and ready to use
 $ result = $ this -> _masterAdapter -> Execute ( $ sql ) ; } else { $ this -> RequireConnection ( true ) ; $ this -> Observe ( "DataAdapter ($this->_label) (DataAdapter.Execute) " . $ sql , OBSERVE_QUERY ) ; $ result = - 1 ; try { $ result = $ this -> _driver -> Execute ( $ this -> _dbconn , $ sql ) ; $ this -> _num_retries = 0 ; } catch ( Exception $ ex ) { // retry one time a communication error occurs
 if ( $ this -> _num_retries == 0 && DataAdapter :: $ RETRY_ON_COMMUNICATION_ERROR && $ this -> IsCommunicationError ( $ ex ) ) { $ this -> _num_retries ++ ; $ this -> Observe ( "DataAdapter ($this->_label) Communication error.  Retry attempt " . $ this -> _num_retries , OBSERVE_WARN ) ; sleep ( 2 ) ; // slight delay to prevent throttling
 return $ this -> Execute ( $ sql ) ; } $ msg = "DataAdapter ($this->_label)" . ' Error Executing SQL: ' . $ ex -> getMessage ( ) . ' (retry attempts: ' . $ this -> _num_retries . ')' ; $ this -> Observe ( $ msg , OBSERVE_FATAL ) ; throw new Exception ( $ msg , $ ex -> getCode ( ) ) ; } } return $ result ; }
Executes a SQL query that does not return a resultset

@access public
@param string $sql
@return int number of records affected
Executes a SQL query that does not return a resultset