Returns the search results for the given SQL statement.

@param MW_DB_Connection_Interface $conn Database connection
@param $sql SQL statement
@return MW_DB_Result_Interface Search result object
435349
protected function _getSearchResults( MW_DB_Connection_Interface $conn, $sql )
	{
		$stmt = $conn->create($sql);

		$this->_getContext()->getLogger()->log(__METHOD__ . ': SQL statement: ' . $stmt, MW_Logger_Abstract::DEBUG);

		return $stmt->execute();
	}
1173253
public function query($sql) {
        $sql = $this->translateQuery($sql);
        return $this->getConnector()->query($sql);
    }
56311
public function execXMLStoredProcedure($conn, $sql, $bindArray)
    {

        $internalKey = $bindArray['internalKey'];
        $controlKey = $bindArray['controlKey'];
        $inputXml = $bindArray['inputXml'];
        $outputXml = $bindArray['outputXml'];

        // @todo see why error doesn't properly bubble up to top level.
        $crsr = @db2_prepare($conn, $sql);
        if (!$crsr) {
            $this->setStmtError();
            return false;
        }

        // stored procedure takes four parameters. Each 'name' will be bound to a real PHP variable
        $params = array(
            array('position' => 1, 'name' => "internalKey", 'inout' => DB2_PARAM_IN),
            array('position' => 2, 'name' => "controlKey",  'inout' => DB2_PARAM_IN),
            array('position' => 3, 'name' => "inputXml",    'inout' => DB2_PARAM_IN),
            array('position' => 4, 'name' => "outputXml",   'inout' => DB2_PARAM_OUT),
        );
        
        // bind the four parameters
        foreach ($params as $param) {
            $ret = db2_bind_param ($crsr, $param['position'], $param['name'], $param['inout']);
            if (!$ret) {
                // unable to bind a param. Set error and exit
                $this->setStmtError($crsr);
                return false;
            }
        }

        $ret = @db2_execute($crsr);
        if (!$ret) {
            // execution of XMLSERVICE stored procedure failed.
            $this->setStmtError($crsr);
            return false;
        }

        return $outputXml;
    }
342091
public function query($sql)
    {
        if (!$queryResource = mysql_query($sql, $this->dbConn)) {
            echo mysql_error();
            $this->handleError();
        } else {
            return new MySqlResult($this, $queryResource);
        }
    }
452468
public static function query($sql, $bind = [], $cache = false) {
        /* @var $connection Connection */
        $connection = Pool::get(Connection::class);
        try {
            $items = $connection->query($sql, $bind, $cache);
            Pool::release($connection);
            return $items;
        } catch (\RuntimeException $e) {
            Pool::release($connection);
            throw $e;
        } catch (\Error $e) {
            Pool::release($connection);
            throw $e;
        }
    }
963217
public function query($sql)
    {
        $result = $this->pdo->query($sql);
        $this->executed[] = $sql;
        return $result;
    }
1375047
public function fetchValue($sql, $col = null, $values = null, $connection = null)
  {
    $st = $this->query($sql, $values, $connection);

    if (!$row = $st->fetch(\PDO::FETCH_ASSOC)) {
      return false;
    }

    if (!$col) {
      return current($row);
    }

    if (!array_key_exists($col, $row)) {
      Exception::ThrowError(Exception::COLUMN_NOT_EXISTS, $col);
    }

    return $row[$col];
  }
1174568
public function query($sql)
    {
        if (true == Config::get('sql_log')) {
            wlog('SQL-Log', $sql);
        }

        // Prepare one MySQL client connect
        $isFromPool = $this->prepareDB();

        // If disconnect, Must connection
        if (!$this->db->connected) {
            // var_dump('........................mysql disconnected........................');
            $this->reconnect();
        }

        $this->db->setDefer();
        $this->db->query($sql);
        $result = $this->db->recv();

        // Fix Lost connection to MySQL server during query
        // MySQL server has gone away
        if($this->db->errno == 2006 || $this->db->errno == 2013) {
            // var_dump('........................mysql go away........................');
            $this->reconnect();

            $this->db->setDefer();
            $this->db->query($sql);
            $result = $this->db->recv();
        }

        // Put db connction to pool
        // If it is new client, queue in, else put pool client back
        if ($isFromPool) {
            DBPool::init($this->db_config)->back($this->db);
        } else {
            DBPool::init($this->db_config)->in($this->db);
        }

        if ($this->db->errno == 0) {
            $GLOBALS['__$DB_QUERY_COUNT']++;
        } else {
            \throw_error('DB_ERROR: ' . $this->db->error . "\nRAW_SQL: " . $sql, 12045);
        }

        $this->insert_id = $this->db->insert_id;
        $this->affected_rows = $this->db->affected_rows;

        return $result;
    }
996562
public function query(string $sql, $data = null) {
		$connection = $this->pool->getConnection();
		$result = null;
		$tryAgain = true;
SQL_START_EXECUTE:
		if (is_array($data) && count($data) > 0) {
			if (strpos($sql, ':') !== false) {
				$bind = [];
				$sql = preg_replace_callback('/:(\w+)\b/', function ($matches) use (&$data, &$bind) {
					$bind[] = $data[$matches[1]];
					return '?';
				}, $sql);
				$data = &$bind;
			}
			try {
				$st = $connection->prepare($sql);
				if ($st === false) {
					goto SQL_TRY_AGAIN;
				}
				if (is_object($st)) {
					$result = $st->execute($data);
				} else {
					$result = $connection->execute($data);
				}
			} catch (\Throwable $e) {
				goto SQL_TRY_AGAIN;
			}
			if ($result === false) {
				goto SQL_TRY_AGAIN;
			}
			goto SQL_SUCCESS_RETURN;
		} else {
			try {
				$result = $connection->query($sql);
			} catch (\Throwable $e) {
				goto SQL_TRY_AGAIN;
			}
			if ($result === false) {
				goto SQL_TRY_AGAIN;
			}
			goto SQL_SUCCESS_RETURN;
		}
SQL_TRY_AGAIN:
		if (($connection->errno === 2006 || $connection->errno === 2013) && $tryAgain) {
			$tryAgain = false;
			$connection = $this->pool->reconnect($connection);
			goto SQL_START_EXECUTE;
		} else {
			$error = $connection->error;
			$errno = $connection->errno;
			$this->pool->freeConnection($connection);
			throw new DBException($error, $errno);
		}
SQL_SUCCESS_RETURN:
		if ($result === true) {
			$result = [
				'_affected_rows' => $connection->affected_rows
			];
			if (stripos($sql, 'insert') === 0) {
				$result['_insert_id'] = $connection->insert_id;
			}
		}
		$this->pool->freeConnection($connection);
		return $result;
	}
1245019
final protected function executeQuery($sql)
    {
        $statement = $this->connection->prepare($sql);
        $statement->execute();
        return $statement->fetchAll();
    }
1210202
public function executeQuery($conn, $sql)
    {
        $txt = array();
        $stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
        if (is_resource($stmt)) {
            if (db2_fetch_row($stmt)) {
                $column = db2_result($stmt, 0);
                $txt[] = $column;
            }
        } else {
            $this->setStmtError();
            Throw new \Exception("Failure executing SQL: ($sql) " . db2_stmt_errormsg(), db2_stmt_error()); 
        }
         
        return $txt;
    }
1049639
protected function query($conn, $sql)
    {
        $items = array();
        if ($conn instanceof PDO) {
            $result = $conn->query($sql);
            if ($result) {
                foreach ($result as $row) {
                    $items[] = $row[0];
                }
            }
        } elseif (is_resource($conn)) {
            $result = sqlsrv_query($conn, $sql);
            if ($result) {
                while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_NUMERIC)) {
                    $items[] = $row[0];
                }
            }
        }
        return $items;
    }
272198
public final function fetchRow($sql, array $bind = [])
    {
        return $this->query($sql, $bind)->fetch(\PDO::FETCH_NAMED);
    }
477664
function queryAsync($sql)
    {
        $result = $this->tryReconnect(array('parent', 'query'), array($sql, MYSQLI_ASYNC));
        if (!$result)
        {
            Swoole\Error::info(__CLASS__." SQL Error", $this->errorMessage($sql));
            return false;
        }
        return $result;
    }
13119
public function query(string $sql, $bind = []): Result
    {
        $result = parent::query($sql, $bind);
        return new Result($this->tableName, $result);
    }
1221076
protected function query_one ( $sql )
	{
		$sql = $this->sql_printf(func_get_args());
		if (!($res = mysqli_query( $this->conn, $sql)))
		{
			$this->sql_errcheck($sql);
		}
		if ($row = mysqli_fetch_assoc($res))
		{
			$val = array_pop($row);
		}
		else
		{
			$val = false;
		}
		((mysqli_free_result($res) || (is_object($res) && (get_class($res) == "mysqli_result"))) ? true : false);
		return $val;
	}
1093589
public function exec($sql)
    {
        $return = $this->connection->exec($sql);

        if ($this->useDebug) {
            $this->log($sql);
            $this->setLastExecutedQuery($sql);
            $this->incrementQueryCount();
        }

        return $return;
    }