Execute an SQL statement and return the number of affected rows
@param string $sql
@return integer
197784
public function exec($sql)
    {
        $result = $this->pdo->exec($sql);
        $this->executed[] = $sql;
        return $result;
    }
205805
public function sqlExecute(string $sql, array $params = []): int
    {
        return $this->prepare($sql, $params)->rowCount();
    }
1254602
protected function getStatement($sql)
    {
        if (!isset($this->statements[$sql])) {
            $this->statements[$sql] = $this->adapter->prepare($sql);
        }
        return $this->statements[$sql];
    }
170953
protected function query_one ( $sql )
	{
		$sql = $this->sql_printf(func_get_args());
		if (!($res = mysql_query($sql, $this->conn)))
		{
			$this->sql_errcheck($sql);
		}
		$val = @mysql_result($res, 0, 0);
		mysql_free_result($res);
		return $val;
	}
266547
public function selectValues($sql)
    {
        $result = $this->execute($sql);
        if ($result->count()) {
            $values = [];
            foreach ($result as $row) {
                $values[] = reset($row);
            }
            return $values;
        }
    }
1156762
public function count($column = '*')
    {
        if ($column != '*') {
            $column = '`' . $column . '`';
        }

        $sql = 'select count(' . $column . ') from `' . $this->table .'`';

        if ($this->where !== null) {
            $sql .= ' where ' . $this->where;

            $this->where = null;
        }

        $stmt = $this->connection->prepare($sql);

        $this->bind($stmt, $this->where_data_binding);

        $this->where_data_binding = [];

        $stmt->execute();

        $r = $stmt->fetchColumn();

        return (int) $r;
    }
389583
public function query($sql)
    {
        // auto reconnect
        $this->connect();
        
        //echo $sql;
        $this->statement = null; //reset 
        //echo 'adapter:'; var_dump($sql);exit;
        if (!($this->result = $this->connection->query($sql))) {
            $this->showError();
        }
        return $this->result;
    }
860553
public static function execute($sql, $data = [])
    {
        $statement = self::$pdo->prepare($sql);
        $statement->execute($data);
        return $statement;
    }
368018
public function getRow($sql, $params = array())
    {
        $stmt = $this->execute($sql, $params);
        return $stmt->fetch($this->fetchMode);
    }
761022
protected function query ( $sql )
	{
		$sql = $this->sql_printf(func_get_args());
		try
		{
			$this->lastaffectedrows = $this->conn->exec($sql);
			if ($this->lastaffectedrows === FALSE) {
				$this->sql_errcheck($sql);
			}
		}
		catch (PDOException $e) 
		{
			$this->sql_errcheck($sql);
		}
	}
249309
public function exec($sql)
    {
        try {
            $stmt = $this->query($sql);
            $rows = $stmt->rowCount();
            $stmt->closeCursor();
            return $rows;
        } catch (\Exception $e) {
            throw new \PDOException($e->getMessage());
        }
        return $this;
    }
1235208
public function executeRaw($sql) {
        if (!is_string($sql)) throw new IllegalTypeException('Illegal type of parameter $sql: '.gettype($sql));
        if (!$this->isConnected())
            $this->connect();

        // execute statement
        $result = null;
        try {
            if ($this->skipResults) $result = $this->sqlite->exec($sql);        // TRUE on success, FALSE on error
            else                    $result = $this->sqlite->query($sql);       // bug: always SQLite3Result, never boolean
            if (!$result) trigger_error('Error '.$this->sqlite->lastErrorCode().', '.$this->sqlite->lastErrorMsg(), E_USER_ERROR);
        }
        catch (\Exception $ex) {
            if (!$ex instanceof IRosasurferException)
                $ex = new DatabaseException($ex->getMessage(), $ex->getCode(), $ex);
            throw $ex->addMessage('Database: '.$this->file.NL.'SQL: "'.$sql.'"');
        }

        // track last_insert_id
        $this->lastInsertId = $this->sqlite->lastInsertRowID();

        // track last_affected_rows
        $this->lastAffectedRows = $this->sqlite->changes();

        return $result;
    }
904631
public final function execute($sql, $_)
    {
        $params = func_get_args();
        if ($this->debug)
        {
            var_dump($params);
        }
        array_shift($params);
        $stm = $this->prepare($sql);
        if ($stm->execute($params))
        {
            return $this->lastInsertId();
        }
        else
        {
            \Swoole\Error::info("SQL Error", implode(", ", $this->errorInfo()) . "<hr />$sql");
            return false;
        }
    }
211269
private static function getOperation(string $sql): string
    {
        // remove annotion and blank
        $sql = preg_replace('/\/\*[^\/]+\*\//', '', $sql);
        $sql = trim($sql);
        $sql = strtoupper($sql);

        if (strpos($sql, 'INSERT') === 0) {
            return self::RETURN_INSERTID;
        }

        if (strpos($sql, 'UPDATE') === 0 || strpos($sql, 'DELETE') === 0 || strpos($sql, 'REPLACE') === 0) {
            return self::RETURN_ROWS;
        }

        return self::RETURN_FETCH;
    }
1294087
private function query($sql) {
		if ($sth = $this->DB->query($sql)) {
			$res = $sth->fetchAll(PDO::FETCH_COLUMN);
		} else {
			$res = false;
		}
		return $res;
	}
689555
function exec($sql)
    {
        if ($this->trace_count){
            Trace::groups('DB')->group('count')->set(Trace::groups('DB')->group('count')->get()+1);
        }
        if ($this->trace_sql){
            Benchmark::start('sql');
            $sql = $this->addPrefixes($sql);
            $result = parent::exec($sql);
            $bm = Benchmark::stop('sql', true);
            if ($bm['time'] >= $this->slow_query){
                Trace::groups('DB')->group('query')->group()->set(array(
                    'sql' => $sql,
                    'benchmark' => $bm
                    )
                );
                Trace::groups('DB')->group('sql_time')->set(Trace::groups('DB')->group('sql_time')->get()+$bm['time']);
                Trace::groups('DB')->group('slow_count')->set(Trace::groups('DB')->group('slow_count')->get()+1);
            }
            return $result;
        }
        return parent::exec($this->addPrefixes($sql));
    }
704755
public static function execute($sql,$bind=[])
    {
        try{
            $bind=is_array($bind) ? $bind : [$bind];
            self::$db=Connect::boot();
            Connect::comSql($sql);
            $sth = self::$db->prepare($sql);
            $sth->execute($bind);
            return $sth->rowCount();
        } catch (\PDOException $e) {
            throw new Exception($e->getMessage());
        }
    }