Executes a given SQL statement and returns the value of the named column and first row.

@param string $sql SQL statement to execute
@param string $column Column name to retrieve
@param string $name Name from the resource configuration
188396
protected function _getValue( $sql, $column, $name = 'db' )
	{
		$result = $this->_getConnection( $name )->create( $sql )->execute();

		if( ( $row = $result->fetch() ) === false ) {
			throw new MW_Setup_Exception( sprintf( 'No rows found: %1$s', $sql ) );
		}

		if( array_key_exists( $column, $row ) === false ) {
			throw new MW_Setup_Exception( sprintf( 'No column "%1$s" found: %2$s', $column, $sql ) );
		}

		$result->finish();

		return $row[$column];
	}
249851
static ResultSet executeStatement(SQL sql) throws SQLException {
    try (SqlSession session = sqlSessionFactory.openSession(true)) {
      try (Connection conn = session.getConnection()) {
        try (Statement stmt = conn.createStatement()) {
          return stmt.executeQuery(sql.toString());
        }
      }
    }
  }
650434
private void execute(String sql) throws SQLException {
        Statement statement = connection.createStatement();
        try {
            statement.executeUpdate(substitute(sql));
        } finally {
            DbUtils.closeQuietly(statement);
        }
    }
1312102
public function sqlFetchColumn(string $sql, array $params = [], string $column = '0')
    {
        $stmt = $this->prepare($sql, $params);

        if (ctype_digit((string) $column)) {
            return $stmt->fetchColumn($column);
        }

        if ($record = $stmt->fetch()) {
            return array_key_exists($column, $record) ? $record[$column] : null;
        }

        return null;
    }
1098028
protected function execute($sql, $bindings = array())
		{
			$bindings = (array) $bindings;

			// Since expressions are injected into the query as strings, we need to
			// remove them from the array of bindings. After we have removed them,
			// we'll reset the array so there aren't gaps in the keys.
			$bindings = array_values(array_filter($bindings, function($binding) {
				return ! $binding instanceof Expression;
			}));

			$sql = $this->grammar()->shortcut($sql, $bindings);

			$statement = $this->pdo->prepare($sql);

			// Every query is timed so that we can log the executinon time along
			// with the query SQL and array of bindings. This should be make it
			// convenient for the developer to profile performance.
			$time = microtime(true);

			$result = $statement->execute($bindings);

			$time = number_format((microtime(true) - $time) * 1000, 2);

			// Once we have execute the query, we log the SQL, bindings, and
			// execution time in a static array that is accessed by all of
			// the connections used by the application.
			$this->log($sql, $bindings, $time);

			return array($statement, $result);
		}
760020
@Override
    public boolean execute(String sql) throws SQLException
    {
        checkClosed();
        VoltSQL query = VoltSQL.parseSQL(sql);
        return this.execute(query);
    }
605095
public function getColumn(string $sql, $data = null, $column = null) {
		if ($column === null) {
			if ($data === null) {
				throw new DBException('$column can not be empty');
			} else {
				$column = $data;
			}
		}
		$result = $this->get($sql, $data);
		if ($result === null || !isset($result[$column])) {
			throw new DBException("Column $column not exists");
		} else {
			return $result[$column];
		}
	}
872440
protected function query_row ( $sql )
	{
		$sql = $this->sql_printf(func_get_args());
		if (!($res = mysql_query($sql, $this->conn)))
		{
			$this->sql_errcheck($sql);
		}
		if ($row = mysql_fetch_array($res))
		{
			$rs = $row;
		}
		else
		{
			$rs = false;
		}
		mysql_free_result($res);
		return $rs;
	}
1125979
public function selectValue($sql)
    {
        $result = $this->execute($sql);
        if ($result->count()) {
            $row = $result->current();
            return reset($row);
        }
    }
815791
public static function insertBySql($sql,$data=[],$db_name=''){
		$db = self::getDb($db_name);
		$result = $db->createCommand($sql,$data)
				->execute();
		return $result;
	
	}
1264072
protected function query_row ( $sql )
	{
		$sql = $this->sql_printf(func_get_args());
		try 
		{
			$all = $this->conn->query($sql, PDO::FETCH_NUM);
			$row = array();
			foreach ($all as $r) {
				$row = $r;
				break;
			}
		}
		catch (PDOException $e)
		{
			$this->sql_errcheck($sql);
		}
		return $row;
	}
689760
final protected function executeCount($sql)
    {
        $statement = $this->connection->prepare($sql);
        $statement->execute();
        return (Integer) $statement->fetchColumn();
    }
758075
@Override
    public boolean execute( String sql ) throws SQLException {
        notClosed();
        warning = null;
        moreResults = 0;
        try {
            // Convert the supplied SQL into JCR-SQL2 ...
            String jcrSql2 = connection.nativeSQL(sql);
            // Create the query ...
            final QueryResult jcrResults = getJcrRepositoryDelegate().execute(jcrSql2, this.sqlLanguage);
            results = new JcrResultSet(this, jcrResults, null);
            moreResults = 1;
        } catch (RepositoryException e) {
            throw new SQLException(e.getLocalizedMessage(), e);
        }
        return true; // always a ResultSet
    }
1344234
public function exec(string $sql)
    {
        try {
            return $this->dbh->exec($sql);
        } catch (\PDOException $e) {
            die("Error: " . $e->getMessage());
        }
    }
737181
protected function _execute($sql)
	{
		return ibase_query(isset($this->_ibase_trans) ? $this->_ibase_trans : $this->conn_id, $sql);
	}
547413
public function exec_script($sql)
    {
        $sql  = $this->fix_table_names($sql);
        $buff = '';
        $exec = '';

        foreach (explode("\n", $sql) as $line) {
            $trimmed = trim($line);
            if ($trimmed == '' || preg_match('/^--/', $trimmed)) {
                continue;
            }

            if ($trimmed == 'GO') {
                $exec = $buff;
            }
            else if ($trimmed[strlen($trimmed)-1] == ';') {
                $exec = $buff . substr(rtrim($line), 0, -1);
            }

            if ($exec) {
                $this->query($exec);
                $buff = '';
                $exec = '';
                if ($this->db_error) {
                    break;
                }
            }
            else {
                $buff .= $line . "\n";
            }
        }

        return !$this->db_error;
    }
860553
public static function execute($sql, $data = [])
    {
        $statement = self::$pdo->prepare($sql);
        $statement->execute($data);
        return $statement;
    }