Skip to content

SQLX decoding issue with mysql #154

@jlf0dev

Description

@jlf0dev

Your OS:

  • Mac OS
  • Windows
  • Linux

Your Database:

  • MySQL
  • Postgres
  • Sqlite3

Your zhobo version
0.1.0

Describe the bug
Thank you for your work here restarting the gobang project! I'm using zhobo to access a mysql database and its throwing the following error:

error occurred while decoding column "Name": mismatched types; Rust type
  | `alloc::string::String` (as SQL type `VARCHAR`) is not compatible with SQL
  | type `VARBINARY`

I believe this may be simply launchbadge/sqlx#3387, and could be fixed by downgrading to 0.7.4.

To Reproduce
Steps to reproduce the behavior:

  1. Create a MySQL database in docker with docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d -p 3306:3306 --volume mysql_dev_data:/var/lib/mysql mysql:latest
  2. Add the following to config.toml
[[conn]]
type = "mysql"
user = "root"
host = "localhost"
port = 3306
password = "my-secret-pw"
name = "dev mysql"
  1. Run zhobo and try to connect using the added connection. See the following error:
thread 'main' panicked at /Users/jacobfink/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sqlx-core-0.8.2/src/row.rs:72:37:
called `Result::unwrap()` on an `Err` value: ColumnDecode { index: "0", source: "mismatched types; Rust type `alloc::string::String` (as SQL type `VARCHAR`) is not compatible with SQL type `VARBINARY`" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior
mysql should be able to connect and work correctly.

Additional context
I have tested this with sqlx 0.7.4 and it seems to fix the issue.

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