Skip to content
This repository was archived by the owner on Oct 26, 2026. It is now read-only.
This repository was archived by the owner on Oct 26, 2026. It is now read-only.

logSQL() messing up console if there is binary BLOB param #2

Closed

Description

@afriza

The logSQL() function caused problem in the console when I inserted binary BLOB and ExecLogFunc is set to print the SQL.

dbx/query.go

Lines 109 to 110 in cecf5a8

} else if bs, ok := v.([]byte); ok {
sv = "'" + strings.Replace(string(bs), "'", "''", -1) + "'"

For now, in ExecLogFunc I check using string matching if the SQL is involving binary BLOB and don't print it to console.

Activity

  1. added a commit that references this issue on Jan 26, 2023
  2. ganigeorgiev commented on Jan 26, 2023

    @ganigeorgiev
    Member

    I've updated the default logger in v1.9 to print the raw bytes as hex since that is how most db tools (including sqlite3 with mode .quote) seems to handle it.

  3. afriza commented on Jan 28, 2023

    @afriza
    Author

    Thank you.

    Even better, maybe in future, if there's a max limit..

    I saw some go logs showing initial & last few number of bytes as hex.. and the middle shows something like [... 5678 bytes of data ... ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions