Add sql and params to return user IDs.

@param string $sql The sql string to return user IDs.
@param array $params Parameters for the sql statement.
768276
public function add_from_sql($sql, $params) {
        global $DB;
        $userids = $DB->get_records_sql($sql, $params);
        if (!empty($userids)) {
            $this->userids = array_merge($this->userids, $userids);
        }
    }
160246
public function getArray($sql, $parameters = array()) {
        $this->execute($sql);
        $result = array();
        while (!!$objs = mysql_fetch_assoc($this->result) ) {
            $result[] = $objs;
        }
        return $result;
    }
616283
public function insert($sql, $parameters = array()) {
	    $this->execute($sql, $parameters);
	    $id = $this->lastInsertId();
	    if (empty($id)) {
	        return $this->rowCount() > 0;
        }
		return $id;
	}
609085
public function getAllPosts($sql, $params)
    {
        $posts = $this->findAllWhere("$sql", $params);

        // array_reverse so latest order question gets returned
        return array_map(array($this, 'setupPost'), $posts);
    }
631472
public function getValues($sql, $params = null)
    {
        $this->log('getValues', $sql, $params);

        return $this->_socket->getColumn($sql, $params);
    }
744225
private function prepare($sql, array $params)
    {
        $statement = $this->connection->prepare($sql);
        foreach ($params as $key => $value) {
            $statement->bindValue($key, $value);
        }

        return $statement;
    }
1122909
public function getColumn($sql, $params = null)
    {
        $stmt = $this->execute($sql, $params);
        $column = [];

        while ($row = $stmt->fetch()) {
            $column[] = $row[0];
        }

        return $column;
    }
248989
public function execute($sql, array $parameters = [])
    {
        $sth = $this->prepare($sql);
        $sth->execute($parameters);
        return $sth;
    }
432604
protected function replaceParams($sql, array $params) {
		$i=0;
		return preg_replace_callback('/\?/', function() use(&$i, $params, $sql) {
			$rep = $params[$i++];
			if(!$rep instanceof Raw && !$rep instanceof static)
				return "'".addslashes($rep)."'";
			else
				return '?';
		}, $sql);
	}
810069
public function query($sql=null, array $params=[]) {
		if($sql === null) {
			$sql = $this->buildSQL();
			$params = $this->getParameters();
		}

		$this->replaceArrayParams($sql, $params);

		return $this->query = $this->db->query($sql, $params);
	}
252981
public function createCommand($sql = null, $params = [])
    {
        /** @var Command $command */
        $command = new $this->commandClass([
            'db' => $this,
            'sql' => $sql,
        ]);

        return $command->bindValues($params);
    }
600382
public function whereNotExistsRaw(string $sql, string ...$params)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->whereNotExistsRaw($sql, ...$params);

        return $instance;
    }
264582
public function sqlFetchAllColumn(string $sql, array $params = [], string $column = '0'): array
    {
        return $this->connection()->sqlFetchAllColumn($sql, $params, $column);
    }
577075
public function createSqlCommand($sql,$params=array())
	{
		$command=$this->_connection->createCommand($sql);
		$this->bindValues($command,$params);
		return $command;
	}
954113
protected function insert( $sql, $params = null ) {
		$stmt = $this->dbh->prepare( $sql );
		try {
			$this->transactionStart();
			$stmt->execute( $params );
			$rowid = $this->dbh->lastInsertId();
			$this->transactionCommit();
			return $rowid;

		} catch ( PDOException $e ) {
			$this->transactionRollback();
			$this->logger->error( 'Insert failed.', [
				'method' => __METHOD__,
				'exception' => $e,
				'sql' => $sql,
				'params' => $params,
			] );
			return false;
		}
	}
1171730
public function run($sql, array $params = array())
    {
        $sth = $this->pdo->prepare($sql);

        foreach ($params as $key => $value) {
            $key = is_numeric($key) ? $key + 1 : ":$key";
            $sth->bindValue($key, $value);
        }

        $sth->execute($params);
        $this->executed[] = $sql;
        return $sth;
    }
1185988
protected function fetchAll( $sql, $params = null ) {
		$this->logger->debug( $sql, $params ?: [] );
		$stmt = $this->dbh->prepare( $sql );
		$this->bind( $stmt, $params );
		$stmt->execute();
		return $stmt->fetchAll();
	}