Skip to content

Error when DB connection does not provide query grammar #1756

@rikwillems

Description

@rikwillems

In my app I'm using the-tinderbox/clickhouse-builder to make a connection to ClickHouse. This connection doesn't provide a query grammar in the class constructor. This leads to an error in the debugbar:

method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given

This related to this line:

if ($query['type'] === 'query' && $this->renderSqlWithParams && method_exists(DB::connection($query['connection'])->getQueryGrammar(), 'substituteBindingsIntoRawSql')) {

As DB::connection($query['connection'])->getQueryGrammar() is returning null we see the error.

I'm preparing a PR and hope you are willing it merge it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions