Skip to content

error when storing build example in database #65

@mehrancodes

Description

@mehrancodes

Describe the bug
the issue is that I have a query in my API where I had to use some manual queries and when the enlighten wants to create a build example in DatabaseExampleBuilder@addQuery on 95 this is what happening:

enlighten error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set @totalDuration=0, ?, ?, ?, ?, ?, ?, ?)' at line 1 (SQL: insert into `enlighten_example_queries` (`sql`, `bindings`, `time`, `request_id`, `snippet_id`, `example_id`, `updated_at`, `created_at`) values (set @totalDuration=0, [], 0.26, 1050, ?, 896, 2021-11-10 14:41:15, 2021-11-10 14:41:15))

my query

DB::statement(DB::raw('set @totalDuration=0'));

I have tried to fix it on my local simply by putting the value of $queryExecuted->sql inside a double quote so the QUERY getting stored as plain text and it worked.

I would send a PR soon if you think this change doesn't break the system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions