wordpress/wp-content/plugins/sqlite-integration/pdoengine.class.php
/**
	 * Method to execute ALTER TABLE query.
	 *
	 * @param string
	 * @return boolean
	 */
Method to execute ALTER TABLE query.
@param string
@return boolean
Method to execute ALTER TABLE query . @param string @return boolean
private function execute_alter_query($query) {
		$engine          = $this->prepare_engine($this->query_type);
		$reason          = 0;
		$message         = '';
		$re_query        = '';
		$rewritten_query = $engine->rewrite_query($query, $this->query_type);
		if (is_array($rewritten_query) && array_key_exists('recursion', $rewritten_query)) {
			$re_query = $rewritten_query['recursion'];
			unset($rewritten_query['recursion']);
		}
		try {
			$this->beginTransaction();
			if (is_array($rewritten_query)) {
				foreach ($rewritten_query as $single_query) {
					$this->queries[] = "Executing:\n" . $single_query;
					$single_query    = trim($single_query);
					if (empty($single_query)) continue;
					$this->pdo->exec($single_query);
				}
			} else {
				$this->queries[] = "Executing:\n" . $rewritten_query;
				$rewritten_query = trim($rewritten_query);
				$this->pdo->exec($rewritten_query);
			}
			$this->commit();
		} catch (PDOException $err) {
			$reason  = $err->getCode();
			$message = $err->getMessage();
			if (5 == $reason || 6 == $reason) {
				$this->commit();
				usleep(10000);
			} else {
				$this->rollBack();
			}
		}
		if ($re_query != '') {
			$this->query($re_query);
		}
		if ($reason > 0) {
			$err_message = sprintf("Problem in executing alter query. Error was: %s", $message);
			$this->set_error(__LINE__, __FUNCTION__, $err_message);
			return false;
		}
		return true;
	}
private function execute_alter_query ( $ query ) { $ engine = $ this -> prepare_engine ( $ this -> query_type ) ; $ reason = 0 ; $ message = '' ; $ re_query = '' ; $ rewritten_query = $ engine -> rewrite_query ( $ query , $ this -> query_type ) ; if ( is_array ( $ rewritten_query ) && array_key_exists ( 'recursion' , $ rewritten_query ) ) { $ re_query = $ rewritten_query [ 'recursion' ] ; unset ( $ rewritten_query [ 'recursion' ] ) ; } try { $ this -> beginTransaction ( ) ; if ( is_array ( $ rewritten_query ) ) { foreach ( $ rewritten_query as $ single_query ) { $ this -> queries [ ] = " Executing: \n " . $ single_query ; $ single_query = trim ( $ single_query ) ; if ( empty ( $ single_query ) ) continue ; $ this -> pdo -> exec ( $ single_query ) ; } } else { $ this -> queries [ ] = " Executing: \n " . $ rewritten_query ; $ rewritten_query = trim ( $ rewritten_query ) ; $ this -> pdo -> exec ( $ rewritten_query ) ; } $ this -> commit ( ) ; } catch ( PDOException $ err ) { $ reason = $ err -> getCode ( ) ; $ message = $ err -> getMessage ( ) ; if ( 5 == $ reason || 6 == $ reason ) { $ this -> commit ( ) ; usleep ( 10000 ) ; } else { $ this -> rollBack ( ) ; } } if ( $ re_query != '' ) { $ this -> query ( $ re_query ) ; } if ( $ reason > 0 ) { $ err_message = sprintf ( " Problem in executing alter query. Error was: %s " , $ message ) ; $ this -> set_error ( __LINE__ , __FUNCTION__ , $ err_message ) ; return false ; } return true ; }
Method to execute ALTER TABLE query.
Method to execute ALTER TABLE query .